aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rwxr-xr-xsrc/server/authserver/Main.cpp87
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.cpp4
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp76
-rwxr-xr-xsrc/server/authserver/Server/RealmAcceptor.h4
-rwxr-xr-xsrc/server/authserver/Server/RealmSocket.cpp2
-rw-r--r--src/server/authserver/authserver.conf.dist212
-rwxr-xr-xsrc/server/collision/BoundingIntervalHierarchy.h5
-rw-r--r--src/server/collision/Management/VMapManager2.cpp4
-rw-r--r--src/server/collision/Maps/MapTree.cpp10
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp10
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp12
-rw-r--r--src/server/collision/Models/WorldModel.cpp2
-rw-r--r--src/server/collision/RegularGrid.h2
-rwxr-xr-xsrc/server/game/AI/CoreAI/CombatAI.cpp4
-rw-r--r--src/server/game/AI/CoreAI/GameObjectAI.h31
-rwxr-xr-xsrc/server/game/AI/CoreAI/GuardAI.cpp87
-rwxr-xr-xsrc/server/game/AI/CoreAI/GuardAI.h23
-rwxr-xr-xsrc/server/game/AI/CoreAI/PassiveAI.h1
-rwxr-xr-xsrc/server/game/AI/CoreAI/PetAI.cpp73
-rwxr-xr-xsrc/server/game/AI/CoreAI/PetAI.h1
-rwxr-xr-xsrc/server/game/AI/CoreAI/UnitAI.cpp2
-rwxr-xr-xsrc/server/game/AI/CreatureAI.cpp4
-rwxr-xr-xsrc/server/game/AI/CreatureAI.h4
-rwxr-xr-xsrc/server/game/AI/CreatureAIImpl.h5
-rwxr-xr-xsrc/server/game/AI/CreatureAIRegistry.cpp1
-rwxr-xr-xsrc/server/game/AI/CreatureAISelector.cpp9
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp63
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.h1
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp263
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp28
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h14
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp50
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp23
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp67
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h55
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp136
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h8
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp190
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h237
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.cpp9
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp132
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.cpp8
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp156
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.h14
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp1110
-rw-r--r--src/server/game/Battlefield/Battlefield.h431
-rw-r--r--src/server/game/Battlefield/BattlefieldHandler.cpp150
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp140
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.h79
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp1097
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h1768
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.cpp24
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp106
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp74
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.h3
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.cpp14
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp12
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp50
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundBE.cpp6
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp11
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundDS.h8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.cpp24
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp26
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundNA.cpp6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRL.cpp6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRV.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.cpp37
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.h218
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.cpp79
-rw-r--r--src/server/game/CMakeLists.txt5
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp42
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.cpp7
-rwxr-xr-xsrc/server/game/Chat/Channels/ChannelMgr.h1
-rwxr-xr-xsrc/server/game/Chat/Chat.cpp379
-rwxr-xr-xsrc/server/game/Chat/Chat.h255
-rwxr-xr-xsrc/server/game/Chat/Commands/Level0.cpp159
-rwxr-xr-xsrc/server/game/Chat/Commands/Level1.cpp763
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp1186
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp4772
-rwxr-xr-xsrc/server/game/Chat/Commands/TicketCommands.cpp457
-rwxr-xr-xsrc/server/game/Combat/HostileRefManager.h1
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp9
-rwxr-xr-xsrc/server/game/Combat/UnitEvents.h2
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp298
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp62
-rwxr-xr-xsrc/server/game/DataStores/DBCEnums.h18
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp14
-rwxr-xr-xsrc/server/game/DataStores/DBCStructure.h6
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp85
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.h1
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp10
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.h2
-rwxr-xr-xsrc/server/game/Entities/Corpse/Corpse.cpp8
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp87
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h11
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp10
-rwxr-xr-xsrc/server/game/Entities/Creature/GossipDef.cpp5
-rwxr-xr-xsrc/server/game/Entities/Creature/TemporarySummon.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/TemporarySummon.h1
-rwxr-xr-xsrc/server/game/Entities/DynamicObject/DynamicObject.cpp4
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp85
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h1
-rwxr-xr-xsrc/server/game/Entities/Item/Container/Bag.cpp4
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp20
-rwxr-xr-xsrc/server/game/Entities/Item/Item.h1
-rwxr-xr-xsrc/server/game/Entities/Item/ItemEnchantmentMgr.cpp10
-rwxr-xr-xsrc/server/game/Entities/Item/ItemPrototype.h12
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp185
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h32
-rwxr-xr-xsrc/server/game/Entities/Object/Updates/UpdateData.cpp10
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp1568
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateFieldFlags.h44
-rwxr-xr-xsrc/server/game/Entities/Object/Updates/UpdateMask.h26
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp41
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.h1
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp749
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h26
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp84
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.h2
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp8
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp1458
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h80
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp24
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.h4
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp217
-rwxr-xr-xsrc/server/game/Globals/ObjectAccessor.cpp2
-rwxr-xr-xsrc/server/game/Globals/ObjectAccessor.h5
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp1566
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h65
-rwxr-xr-xsrc/server/game/Grids/GridStates.h3
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiers.h13
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiersImpl.h25
-rwxr-xr-xsrc/server/game/Grids/ObjectGridLoader.cpp2
-rwxr-xr-xsrc/server/game/Groups/Group.cpp324
-rwxr-xr-xsrc/server/game/Groups/Group.h19
-rw-r--r--src/server/game/Groups/GroupMgr.cpp32
-rwxr-xr-xsrc/server/game/Groups/GroupRefManager.h3
-rwxr-xr-xsrc/server/game/Groups/GroupReference.h1
-rwxr-xr-xsrc/server/game/Guilds/Guild.cpp56
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp71
-rwxr-xr-xsrc/server/game/Handlers/AddonHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/AuctionHouseHandler.cpp25
-rwxr-xr-xsrc/server/game/Handlers/AuthHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/BattleGroundHandler.cpp56
-rwxr-xr-xsrc/server/game/Handlers/CalendarHandler.cpp64
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp79
-rwxr-xr-xsrc/server/game/Handlers/ChatHandler.cpp6
-rwxr-xr-xsrc/server/game/Handlers/CombatHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/DuelHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/GroupHandler.cpp33
-rwxr-xr-xsrc/server/game/Handlers/ItemHandler.cpp17
-rwxr-xr-xsrc/server/game/Handlers/LootHandler.cpp14
-rwxr-xr-xsrc/server/game/Handlers/MailHandler.cpp62
-rwxr-xr-xsrc/server/game/Handlers/MiscHandler.cpp178
-rwxr-xr-xsrc/server/game/Handlers/MovementHandler.cpp120
-rwxr-xr-xsrc/server/game/Handlers/PetHandler.cpp52
-rwxr-xr-xsrc/server/game/Handlers/PetitionsHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/QueryHandler.cpp12
-rwxr-xr-xsrc/server/game/Handlers/QuestHandler.cpp22
-rwxr-xr-xsrc/server/game/Handlers/SpellHandler.cpp36
-rwxr-xr-xsrc/server/game/Handlers/TradeHandler.cpp14
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp20
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp21
-rwxr-xr-xsrc/server/game/Instances/InstanceScript.cpp10
-rwxr-xr-xsrc/server/game/Instances/InstanceScript.h11
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp196
-rwxr-xr-xsrc/server/game/Loot/LootMgr.h3
-rwxr-xr-xsrc/server/game/Mails/Mail.cpp2
-rwxr-xr-xsrc/server/game/Mails/Mail.h16
-rwxr-xr-xsrc/server/game/Maps/Map.cpp233
-rwxr-xr-xsrc/server/game/Maps/Map.h52
-rwxr-xr-xsrc/server/game/Maps/MapInstanced.cpp6
-rwxr-xr-xsrc/server/game/Maps/MapManager.cpp5
-rwxr-xr-xsrc/server/game/Maps/MapManager.h4
-rwxr-xr-xsrc/server/game/Miscellaneous/Formulas.h2
-rwxr-xr-xsrc/server/game/Miscellaneous/Language.h12
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h54
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MotionMaster.cpp83
-rwxr-xr-xsrc/server/game/Movement/MotionMaster.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp17
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/PointMovementGenerator.h3
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp11
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp8
-rw-r--r--src/server/game/Movement/Spline/MoveSplineFlag.h76
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp74
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h41
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInitArgs.h5
-rw-r--r--src/server/game/Movement/Spline/MovementPacketBuilder.cpp16
-rwxr-xr-xsrc/server/game/Movement/Waypoints/WaypointManager.cpp8
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.cpp8
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.cpp14
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp85
-rwxr-xr-xsrc/server/game/Reputation/ReputationMgr.cpp4
-rwxr-xr-xsrc/server/game/Reputation/ReputationMgr.h4
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp102
-rwxr-xr-xsrc/server/game/Scripting/ScriptLoader.cpp32
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.cpp62
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.h17
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp56
-rw-r--r--src/server/game/Scripting/ScriptSystem.h1
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.cpp24
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.h14
-rw-r--r--src/server/game/Server/Protocol/PacketLog.cpp62
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/Protocol/PacketLog.h (renamed from src/server/game/Server/Protocol/WorldLog.h)45
-rwxr-xr-xsrc/server/game/Server/Protocol/WorldLog.cpp114
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp147
-rwxr-xr-xsrc/server/game/Server/WorldSession.h34
-rwxr-xr-xsrc/server/game/Server/WorldSocket.cpp161
-rw-r--r--src/server/game/Server/WorldSocketAcceptor.h4
-rwxr-xr-xsrc/server/game/Server/WorldSocketMgr.cpp18
-rwxr-xr-xsrc/server/game/Skills/SkillDiscovery.cpp20
-rwxr-xr-xsrc/server/game/Skills/SkillExtraItems.cpp16
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp757
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp68
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp480
-rwxr-xr-xsrc/server/game/Spells/Spell.h3
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp594
-rw-r--r--src/server/game/Spells/SpellInfo.cpp44
-rw-r--r--src/server/game/Spells/SpellInfo.h2
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp378
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h2
-rwxr-xr-xsrc/server/game/Spells/SpellScript.cpp183
-rwxr-xr-xsrc/server/game/Spells/SpellScript.h90
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.cpp26
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.cpp47
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp8
-rw-r--r--src/server/game/Tools/PlayerDump.cpp8
-rw-r--r--src/server/game/Warden/Warden.cpp16
-rw-r--r--src/server/game/Warden/Warden.h2
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp45
-rw-r--r--src/server/game/Warden/WardenCheckMgr.h2
-rw-r--r--src/server/game/Warden/WardenMac.cpp14
-rw-r--r--src/server/game/Warden/WardenWin.cpp20
-rwxr-xr-xsrc/server/game/Weather/Weather.cpp6
-rwxr-xr-xsrc/server/game/Weather/WeatherMgr.cpp14
-rwxr-xr-xsrc/server/game/World/World.cpp511
-rw-r--r--[-rwxr-xr-x]src/server/game/World/World.h8
-rw-r--r--src/server/scripts/CMakeLists.txt2
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt27
-rw-r--r--src/server/scripts/Commands/cs_account.cpp22
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp718
-rw-r--r--src/server/scripts/Commands/cs_bf.cpp180
-rw-r--r--src/server/scripts/Commands/cs_cast.cpp310
-rw-r--r--src/server/scripts/Commands/cs_character.cpp924
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp13
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp371
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp12
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gps.cpp144
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp199
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp193
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp72
-rw-r--r--src/server/scripts/Commands/cs_list.cpp469
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp1392
-rw-r--r--src/server/scripts/Commands/cs_message.cpp215
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp2951
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp65
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp43
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp35
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp194
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp313
-rw-r--r--src/server/scripts/Commands/cs_server.cpp420
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp9
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp509
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h39
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp39
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp77
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp25
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.h2
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp25
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp46
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp140
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/alterac_mountains.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/arathi_highlands.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/blasted_lands.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/boss_kruul.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/burning_steppes.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/duskwood.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/eversong_woods.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ghostlands.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/hinterlands.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ironforge.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/loch_modan.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/redridge_mountains.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/silvermoon_city.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/silverpine_forest.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/stormwind_city.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/tirisfal_glades.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/undercity.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/western_plaguelands.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/westfall.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/wetlands.cpp3
-rw-r--r--src/server/scripts/Examples/example_commandscript.cpp2
-rw-r--r--src/server/scripts/Examples/example_creature.cpp4
-rw-r--r--src/server/scripts/Examples/example_escort.cpp4
-rw-r--r--src/server/scripts/Examples/example_gossip_codebox.cpp4
-rw-r--r--src/server/scripts/Examples/example_misc.cpp1
-rw-r--r--src/server/scripts/Examples/example_spell.cpp51
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp23
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp11
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp3
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp3
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp113
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp123
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp69
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp157
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp85
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp29
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h80
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp55
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp11
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp5
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp17
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp24
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp4
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp39
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp39
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp58
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp58
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp302
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp107
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h12
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp7
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp3
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp3
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp4
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp15
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp4
-rw-r--r--src/server/scripts/Kalimdor/ashenvale.cpp196
-rw-r--r--src/server/scripts/Kalimdor/azshara.cpp225
-rw-r--r--src/server/scripts/Kalimdor/azuremyst_isle.cpp186
-rw-r--r--src/server/scripts/Kalimdor/bloodmyst_isle.cpp18
-rw-r--r--src/server/scripts/Kalimdor/boss_azuregos.cpp119
-rw-r--r--src/server/scripts/Kalimdor/darkshore.cpp135
-rw-r--r--src/server/scripts/Kalimdor/desolace.cpp27
-rw-r--r--src/server/scripts/Kalimdor/durotar.cpp24
-rw-r--r--src/server/scripts/Kalimdor/dustwallow_marsh.cpp159
-rw-r--r--src/server/scripts/Kalimdor/felwood.cpp25
-rw-r--r--src/server/scripts/Kalimdor/feralas.cpp6
-rw-r--r--src/server/scripts/Kalimdor/moonglade.cpp217
-rw-r--r--src/server/scripts/Kalimdor/mulgore.cpp171
-rw-r--r--src/server/scripts/Kalimdor/orgrimmar.cpp53
-rw-r--r--src/server/scripts/Kalimdor/silithus.cpp41
-rw-r--r--src/server/scripts/Kalimdor/stonetalon_mountains.cpp6
-rw-r--r--src/server/scripts/Kalimdor/tanaris.cpp306
-rw-r--r--src/server/scripts/Kalimdor/teldrassil.cpp17
-rw-r--r--src/server/scripts/Kalimdor/the_barrens.cpp138
-rw-r--r--src/server/scripts/Kalimdor/thousand_needles.cpp85
-rw-r--r--src/server/scripts/Kalimdor/thunder_bluff.cpp67
-rw-r--r--src/server/scripts/Kalimdor/ungoro_crater.cpp117
-rw-r--r--src/server/scripts/Kalimdor/winterspring.cpp117
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp5
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp3
-rw-r--r--src/server/scripts/Northrend/CMakeLists.txt3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp7
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp15
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp3
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp19
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp3
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp3
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp4
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp49
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp74
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp74
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp58
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp59
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp24
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp185
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h5
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp3
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp3
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp3
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp4
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp10
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp22
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp3
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp583
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp3
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp3
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp3
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp48
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp5
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp11
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp33
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp81
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp3
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_eck.cpp3
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp3
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp3
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp4
-rw-r--r--src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp3
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp76
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp61
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp83
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp4
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp246
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp34
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp140
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp204
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp19
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp150
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h5
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp184
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp67
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp41
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp55
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp5
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_noth.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp5
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp5
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp21
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp42
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp86
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp80
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp376
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp1374
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp22
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp38
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp10
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp42
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp24
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp75
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp31
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp272
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h232
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp5
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp3
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp5
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp3
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp3
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp8
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp21
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp3
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp3
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp4
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp3
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp3
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp6
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp4
-rw-r--r--src/server/scripts/Northrend/borean_tundra.cpp6
-rw-r--r--src/server/scripts/Northrend/crystalsong_forest.cpp3
-rw-r--r--src/server/scripts/Northrend/dalaran.cpp4
-rw-r--r--src/server/scripts/Northrend/dragonblight.cpp105
-rw-r--r--src/server/scripts/Northrend/grizzly_hills.cpp150
-rw-r--r--src/server/scripts/Northrend/howling_fjord.cpp4
-rw-r--r--src/server/scripts/Northrend/icecrown.cpp10
-rw-r--r--src/server/scripts/Northrend/isle_of_conquest.cpp4
-rw-r--r--src/server/scripts/Northrend/sholazar_basin.cpp130
-rw-r--r--src/server/scripts/Northrend/storm_peaks.cpp10
-rw-r--r--src/server/scripts/Northrend/wintergrasp.cpp560
-rw-r--r--src/server/scripts/Northrend/zuldrak.cpp4
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp2
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp11
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp7
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp20
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_supremus.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp11
-rw-r--r--src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp5
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp5
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp19
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp3
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_gruul.cpp89
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp3
-rw-r--r--src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp13
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp5
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp3
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp5
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp54
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp15
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp3
-rw-r--r--src/server/scripts/Outland/blades_edge_mountains.cpp14
-rw-r--r--src/server/scripts/Outland/boss_doomlord_kazzak.cpp91
-rw-r--r--src/server/scripts/Outland/boss_doomwalker.cpp3
-rw-r--r--src/server/scripts/Outland/hellfire_peninsula.cpp6
-rw-r--r--src/server/scripts/Outland/nagrand.cpp9
-rw-r--r--src/server/scripts/Outland/netherstorm.cpp16
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp4
-rw-r--r--src/server/scripts/Outland/shattrath_city.cpp4
-rw-r--r--src/server/scripts/Outland/terokkar_forest.cpp4
-rw-r--r--src/server/scripts/Outland/zangarmarsh.cpp4
-rw-r--r--src/server/scripts/Spells/CMakeLists.txt1
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp93
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp320
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp551
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp7
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp89
-rw-r--r--src/server/scripts/Spells/spell_item.cpp102
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp47
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp168
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp1744
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp182
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp149
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp31
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp198
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp175
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp95
-rwxr-xr-xsrc/server/scripts/World/achievement_scripts.cpp47
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp3
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp24
-rwxr-xr-xsrc/server/scripts/World/chat_log.cpp44
-rw-r--r--src/server/scripts/World/go_scripts.cpp66
-rw-r--r--src/server/scripts/World/guards.cpp3
-rw-r--r--src/server/scripts/World/item_scripts.cpp3
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp4
-rw-r--r--src/server/scripts/World/npc_innkeeper.cpp5
-rw-r--r--src/server/scripts/World/npc_professions.cpp6
-rw-r--r--src/server/scripts/World/npc_taxi.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp475
-rw-r--r--src/server/shared/AutoPtr.h2
-rwxr-xr-xsrc/server/shared/Configuration/Config.cpp8
-rwxr-xr-xsrc/server/shared/Configuration/Config.h1
-rwxr-xr-xsrc/server/shared/Cryptography/ARC4.cpp4
-rwxr-xr-xsrc/server/shared/Cryptography/Authentication/AuthCrypt.h1
-rw-r--r--src/server/shared/Cryptography/WardenKeyGeneration.h42
-rwxr-xr-xsrc/server/shared/DataStores/DBCStore.h10
-rwxr-xr-xsrc/server/shared/Database/DatabaseWorkerPool.h20
-rwxr-xr-xsrc/server/shared/Database/Field.h24
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp32
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h2
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.cpp4
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.h1
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.cpp3
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.h3
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.cpp114
-rwxr-xr-xsrc/server/shared/Database/MySQLThreading.h4
-rwxr-xr-xsrc/server/shared/Database/PreparedStatement.cpp6
-rwxr-xr-xsrc/server/shared/Database/QueryHolder.cpp8
-rwxr-xr-xsrc/server/shared/Database/QueryResult.cpp4
-rwxr-xr-xsrc/server/shared/Debugging/Errors.h8
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp18
-rwxr-xr-xsrc/server/shared/Dynamic/TypeContainerFunctionsPtr.h168
-rw-r--r--src/server/shared/Logging/Appender.cpp224
-rw-r--r--src/server/shared/Logging/Appender.h156
-rw-r--r--src/server/shared/Logging/AppenderConsole.cpp193
-rw-r--r--src/server/shared/Logging/AppenderConsole.h59
-rw-r--r--src/server/shared/Logging/AppenderDB.cpp55
-rw-r--r--src/server/shared/Logging/AppenderDB.h36
-rw-r--r--src/server/shared/Logging/AppenderFile.cpp74
-rw-r--r--src/server/shared/Logging/AppenderFile.h40
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp1183
-rwxr-xr-xsrc/server/shared/Logging/Log.h211
-rw-r--r--src/server/shared/Logging/LogOperation.cpp31
-rw-r--r--src/server/shared/Logging/LogOperation.h41
-rw-r--r--src/server/shared/Logging/LogWorker.cpp50
-rw-r--r--src/server/shared/Logging/LogWorker.h47
-rw-r--r--src/server/shared/Logging/Logger.cpp84
-rw-r--r--src/server/shared/Logging/Logger.h46
-rwxr-xr-xsrc/server/shared/Packets/ByteBuffer.h87
-rwxr-xr-xsrc/server/shared/Utilities/ServiceWin32.cpp2
-rw-r--r--src/server/worldserver/CMakeLists.txt1
-rwxr-xr-xsrc/server/worldserver/CommandLine/CliRunnable.cpp454
-rwxr-xr-xsrc/server/worldserver/Main.cpp22
-rwxr-xr-xsrc/server/worldserver/Master.cpp88
-rw-r--r--src/server/worldserver/RemoteAccess/RARunnable.cpp6
-rwxr-xr-xsrc/server/worldserver/RemoteAccess/RASocket.cpp30
-rwxr-xr-xsrc/server/worldserver/TCSoap/TCSoap.cpp6
-rw-r--r--src/server/worldserver/worldserver.conf.dist586
840 files changed, 37115 insertions, 23516 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index 01a33d836d6..b938706a0be 100755
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -63,7 +63,7 @@ public:
/// Print out the usage string for this program on the console.
void usage(const char *prog)
{
- sLog->outString("Usage: \n %s [<options>]\n"
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r",
prog);
}
@@ -71,7 +71,6 @@ void usage(const char *prog)
// Launch the auth server
extern int main(int argc, char **argv)
{
- sLog->SetLogDB(false);
// Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_REALM_CONFIG;
int c = 1;
@@ -81,7 +80,7 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError("Runtime-Error: -c option requires an input argument");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
@@ -93,17 +92,16 @@ extern int main(int argc, char **argv)
if (!ConfigMgr::Load(cfg_file))
{
- sLog->outError("Invalid or missing configuration file : %s", cfg_file);
- sLog->outError("Verify that the file exists and has \'[authserver]\' written in the top of the file!");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Invalid or missing configuration file : %s", cfg_file);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Verify that the file exists and has \'[authserver]\' written in the top of the file!");
return 1;
}
- sLog->Initialize();
- sLog->outString("%s (authserver)", _FULLVERSION);
- sLog->outString("<Ctrl-C> to stop.\n");
- sLog->outString("Using configuration file %s.", cfg_file);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "<Ctrl-C> to stop.\n");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file);
- sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ sLog->outWarn(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
@@ -111,7 +109,7 @@ extern int main(int argc, char **argv)
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
- sLog->outBasic("Max allowed open files is %d", ACE::max_handles());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles());
// authserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
@@ -120,41 +118,43 @@ extern int main(int argc, char **argv)
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
- sLog->outError("Cannot create PID file %s.\n", pidfile.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
-
- sLog->outString("Daemon PID: %u\n", pid);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid);
}
// Initialize the database connection
if (!StartDB())
return 1;
- // Initialize the log database
- sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
- sLog->SetLogDB(false);
sLog->SetRealmID(0); // ensure we've set realm to 0 (authserver realmid)
// Get the list of realms for the server
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
- sLog->outError("No valid realms specified.");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
- uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
+ int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
+ if (rmport < 0 || rmport > 0xFFFF)
+ {
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
+ return 1;
+ }
+
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
- ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
+ ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
- sLog->outError("Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
@@ -182,13 +182,13 @@ extern int main(int argc, char **argv)
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
- sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
else if (SetProcessAffinityMask(hProcess, curAff))
- sLog->outString("Using processors (bitmask, hex): %x", curAff);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff);
else
- sLog->outError("Can't set used processors (hex): %x", curAff);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff);
}
- sLog->outString();
+
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
@@ -196,10 +196,10 @@ extern int main(int argc, char **argv)
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
- sLog->outString("The auth server process priority class has been set to HIGH");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH");
else
- sLog->outError("Can't set auth server process priority class.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class.");
+
}
}
#endif
@@ -208,17 +208,6 @@ extern int main(int argc, char **argv)
uint32 numLoops = (ConfigMgr::GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
uint32 loopCounter = 0;
- // possibly enable db logging; avoid massive startup spam by doing it here.
- if (sLog->GetLogDBLater())
- {
- sLog->outString("Enabling database logging...");
- sLog->SetLogDBLater(false);
- // login db needs thread for logging
- sLog->SetLogDB(true);
- }
- else
- sLog->SetLogDB(false);
-
// Wait for termination signal
while (!stopEvent)
{
@@ -231,7 +220,7 @@ extern int main(int argc, char **argv)
if ((++loopCounter) == numLoops)
{
loopCounter = 0;
- sLog->outDetail("Ping MySQL to keep connection alive");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Ping MySQL to keep connection alive");
LoginDatabase.KeepAlive();
}
}
@@ -239,7 +228,7 @@ extern int main(int argc, char **argv)
// Close the Database Pool and library
StopDB();
- sLog->outString("Halting process...");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Halting process...");
return 0;
}
@@ -251,31 +240,33 @@ bool StartDB()
std::string dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("Database not specified");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Database not specified");
return false;
}
- uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
+ int32 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (worker_threads < 1 || worker_threads > 32)
{
- sLog->outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
worker_threads = 1;
}
- uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
+ int32 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
if (synch_threads < 1 || synch_threads > 32)
{
- sLog->outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
synch_threads = 1;
}
// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
- if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads))
+ if (!LoginDatabase.Open(dbstring.c_str(), uint8(worker_threads), uint8(synch_threads)))
{
- sLog->outError("Cannot connect to database");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database");
return false;
}
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Started auth database connection pool.");
+ sLog->EnableDBAppenders();
return true;
}
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp
index d988b940809..453efd5bf72 100755
--- a/src/server/authserver/Realms/RealmList.cpp
+++ b/src/server/authserver/Realms/RealmList.cpp
@@ -68,7 +68,7 @@ void RealmList::UpdateIfNeed()
void RealmList::UpdateRealms(bool init)
{
- sLog->outDetail("Updating Realm List...");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Updating Realm List...");
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST);
PreparedQueryResult result = LoginDatabase.Query(stmt);
@@ -93,7 +93,7 @@ void RealmList::UpdateRealms(bool init)
UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build);
if (init)
- sLog->outString("Added realm \"%s\".", fields[1].GetCString());
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Added realm \"%s\".", fields[1].GetCString());
}
while (result->NextRow());
}
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 15555e4d607..0794d9a802a 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -210,12 +210,12 @@ AuthSocket::~AuthSocket(void) {}
// Accept the connection and set the s random value for SRP6
void AuthSocket::OnAccept(void)
{
- sLog->outBasic("'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
void AuthSocket::OnClose(void)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "AuthSocket::OnClose");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "AuthSocket::OnClose");
}
// Read the packet from the client
@@ -234,11 +234,11 @@ void AuthSocket::OnRead()
{
if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED)))
{
- sLog->outStaticDebug("[Auth] got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
if (!(*this.*table[i].handler)())
{
- sLog->outStaticDebug("Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
return;
}
break;
@@ -248,7 +248,7 @@ void AuthSocket::OnRead()
// Report unknown packets in the error log
if (i == AUTH_TOTAL_COMMANDS)
{
- sLog->outError("[Auth] got unknown packet from '%s'", socket().getRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Got unknown packet from '%s'", socket().getRemoteAddress().c_str());
socket().shutdown();
return;
}
@@ -297,7 +297,7 @@ void AuthSocket::_SetVSFields(const std::string& rI)
// Logon Challenge command handler
bool AuthSocket::_HandleLogonChallenge()
{
- sLog->outStaticDebug("Entering _HandleLogonChallenge");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonChallenge");
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
@@ -312,7 +312,7 @@ bool AuthSocket::_HandleLogonChallenge()
#endif
uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size;
- sLog->outStaticDebug("[AuthChallenge] got header, body is %#04x bytes", remaining);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got header, body is %#04x bytes", remaining);
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
return false;
@@ -324,8 +324,8 @@ bool AuthSocket::_HandleLogonChallenge()
// Read the remaining of the packet
socket().recv((char *)&buf[4], remaining);
- sLog->outStaticDebug("[AuthChallenge] got full packet, %#04x bytes", ch->size);
- sLog->outStaticDebug("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got full packet, %#04x bytes", ch->size);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
// BigEndian code, nop in little endian case
// size already converted
@@ -365,7 +365,7 @@ bool AuthSocket::_HandleLogonChallenge()
if (result)
{
pkt << (uint8)WOW_FAIL_BANNED;
- sLog->outBasic("'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
else
{
@@ -383,20 +383,20 @@ bool AuthSocket::_HandleLogonChallenge()
bool locked = false;
if (fields[2].GetUInt8() == 1) // if ip is locked
{
- sLog->outStaticDebug("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString());
- sLog->outStaticDebug("[AuthChallenge] Player address is '%s'", ip_address.c_str());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str());
if (strcmp(fields[3].GetCString(), ip_address.c_str()))
{
- sLog->outStaticDebug("[AuthChallenge] Account IP differs");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs");
pkt << (uint8) WOW_FAIL_SUSPENDED;
locked = true;
}
else
- sLog->outStaticDebug("[AuthChallenge] Account IP matches");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP matches");
}
else
- sLog->outStaticDebug("[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
if (!locked)
{
@@ -412,12 +412,12 @@ bool AuthSocket::_HandleLogonChallenge()
if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64())
{
pkt << (uint8)WOW_FAIL_BANNED;
- sLog->outBasic("'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
else
{
pkt << (uint8)WOW_FAIL_SUSPENDED;
- sLog->outBasic("'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
}
else
@@ -488,7 +488,7 @@ bool AuthSocket::_HandleLogonChallenge()
for (int i = 0; i < 4; ++i)
_localizationName[i] = ch->country[4-i-1];
- sLog->outBasic("'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(),
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(),
_login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)
);
}
@@ -505,7 +505,7 @@ bool AuthSocket::_HandleLogonChallenge()
// Logon Proof command handler
bool AuthSocket::_HandleLogonProof()
{
- sLog->outStaticDebug("Entering _HandleLogonProof");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonProof");
// Read the packet
sAuthLogonProof_C lp;
@@ -600,7 +600,7 @@ bool AuthSocket::_HandleLogonProof()
// Check if SRP6 results match (password is correct), else send an error
if (!memcmp(M.AsByteArray(), lp.M1, 20))
{
- sLog->outBasic("'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
// Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account
// No SQL injection (escaped user name) and IP address as received by socket
@@ -649,7 +649,7 @@ bool AuthSocket::_HandleLogonProof()
char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 };
socket().send(data, sizeof(data));
- sLog->outBasic("'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
uint32 MaxWrongPassCount = ConfigMgr::GetIntDefault("WrongPass.MaxCount", 0);
if (MaxWrongPassCount > 0)
@@ -679,7 +679,7 @@ bool AuthSocket::_HandleLogonProof()
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
- sLog->outBasic("'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times",
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins);
}
else
@@ -689,7 +689,7 @@ bool AuthSocket::_HandleLogonProof()
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
- sLog->outBasic("'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins);
}
}
@@ -703,7 +703,7 @@ bool AuthSocket::_HandleLogonProof()
// Reconnect Challenge command handler
bool AuthSocket::_HandleReconnectChallenge()
{
- sLog->outStaticDebug("Entering _HandleReconnectChallenge");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectChallenge");
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
@@ -718,7 +718,7 @@ bool AuthSocket::_HandleReconnectChallenge()
#endif
uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size;
- sLog->outStaticDebug("[ReconnectChallenge] got header, body is %#04x bytes", remaining);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got header, body is %#04x bytes", remaining);
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
return false;
@@ -730,8 +730,8 @@ bool AuthSocket::_HandleReconnectChallenge()
// Read the remaining of the packet
socket().recv((char *)&buf[4], remaining);
- sLog->outStaticDebug("[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
- sLog->outStaticDebug("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
_login = (const char*)ch->I;
@@ -742,7 +742,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Stop if the account is not found
if (!result)
{
- sLog->outError("'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -778,7 +778,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Reconnect Proof command handler
bool AuthSocket::_HandleReconnectProof()
{
- sLog->outStaticDebug("Entering _HandleReconnectProof");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectProof");
// Read the packet
sAuthReconnectProof_C lp;
if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C)))
@@ -809,7 +809,7 @@ bool AuthSocket::_HandleReconnectProof()
}
else
{
- sLog->outError("'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -818,7 +818,7 @@ bool AuthSocket::_HandleReconnectProof()
// Realm List command handler
bool AuthSocket::_HandleRealmList()
{
- sLog->outStaticDebug("Entering _HandleRealmList");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleRealmList");
if (socket().recv_len() < 5)
return false;
@@ -831,7 +831,7 @@ bool AuthSocket::_HandleRealmList()
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
{
- sLog->outError("'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -927,11 +927,11 @@ bool AuthSocket::_HandleRealmList()
// Resume patch transfer
bool AuthSocket::_HandleXferResume()
{
- sLog->outStaticDebug("Entering _HandleXferResume");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume");
// Check packet length and patch existence
if (socket().recv_len() < 9 || !pPatch)
{
- sLog->outError("Error while resuming patch transfer (wrong packet)");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)");
return false;
}
@@ -948,7 +948,7 @@ bool AuthSocket::_HandleXferResume()
// Cancel patch transfer
bool AuthSocket::_HandleXferCancel()
{
- sLog->outStaticDebug("Entering _HandleXferCancel");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferCancel");
// Close and delete the socket
socket().recv_skip(1); //clear input buffer
@@ -960,12 +960,12 @@ bool AuthSocket::_HandleXferCancel()
// Accept patch transfer
bool AuthSocket::_HandleXferAccept()
{
- sLog->outStaticDebug("Entering _HandleXferAccept");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferAccept");
// Check packet length and patch existence
if (!pPatch)
{
- sLog->outError("Error while accepting patch transfer (wrong packet)");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error while accepting patch transfer (wrong packet)");
return false;
}
@@ -1050,7 +1050,7 @@ void Patcher::LoadPatchMD5(char *szFileName)
if (!pPatch)
{
- sLog->outError("Error loading patch %s\n", path.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error loading patch %s\n", path.c_str());
return;
}
diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h
index 32f4f3e4122..b764e4d2494 100755
--- a/src/server/authserver/Server/RealmAcceptor.h
+++ b/src/server/authserver/Server/RealmAcceptor.h
@@ -48,7 +48,7 @@ protected:
virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/)
{
- sLog->outBasic("Resuming acceptor");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Resuming acceptor");
reactor()->cancel_timer(this, 1);
return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK);
}
@@ -58,7 +58,7 @@ protected:
#if defined(ENFILE) && defined(EMFILE)
if (errno == ENFILE || errno == EMFILE)
{
- sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Out of file descriptors, suspending incoming connections for 10 seconds");
reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
reactor()->schedule_timer(this, NULL, ACE_Time_Value(10));
}
diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp
index e839457d1c9..c868bb43777 100755
--- a/src/server/authserver/Server/RealmSocket.cpp
+++ b/src/server/authserver/Server/RealmSocket.cpp
@@ -59,7 +59,7 @@ int RealmSocket::open(void * arg)
if (peer().get_remote_addr(addr) == -1)
{
- sLog->outError("Error %s while opening realm socket!", ACE_OS::strerror(errno));
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error %s while opening realm socket!", ACE_OS::strerror(errno));
return -1;
}
diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist
index e9ed4bd752d..ee7e5970155 100644
--- a/src/server/authserver/authserver.conf.dist
+++ b/src/server/authserver/authserver.conf.dist
@@ -69,116 +69,6 @@ BindIP = "0.0.0.0"
PidFile = ""
#
-# LogLevel
-# Description: Server console level of logging
-# Default: 0 - (Minimum)
-# 1 - (Basic)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogLevel = 0
-
-#
-# LogFile
-# Description: Log file for main server log.
-# Default: "Auth.log" - (Enabled)
-# "" - (Disabled)
-
-LogFile = "Auth.log"
-
-#
-# Debug Log Mask
-# Description: Bitmask that determines which debug log output (level 3)
-# will be logged.
-# Possible flags:
-#
-# 64 - Anything related to network input/output,
-# such as packet handlers and netcode logs
-#
-# Simply add the values together to create a bitmask.
-# For more info see enum DebugLogFilters in Log.h
-#
-# Default: 0 (nothing)
-
-DebugLogMask = 64
-
-#
-# SQLDriverLogFile
-# Description: Log file for SQL driver events.
-# Example: "SQLDriver.log" - (Enabled)
-# Default: "" - (Disabled)
-
-SQLDriverLogFile = ""
-
-#
-# SQLDriverQueryLogging
-# Description: Log SQL queries to the SQLDriverLogFile and console.
-# Default: 0 - (Disabled, Query errors only)
-# 1 - (Enabled, Full query logging - may have performance impact)
-
-SQLDriverQueryLogging = 0
-
-#
-# LogTimestamp
-# Description: Append timestamp to the server log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogTimestamp = 0
-
-#
-# LogFileLevel
-# Description: Server file level of logging
-# Default: 0 - (Minimum)
-# 1 - (Basic)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogFileLevel = 0
-
-#
-# LogColors
-# Description: Colors for log messages (Format: "normal basic detail debug").
-# Colors: 0 - Black
-# 1 - Red
-# 2 - Green
-# 3 - Brown
-# 4 - Blue
-# 5 - Magenta
-# 6 - Cyan
-# 7 - Grey
-# 8 - Yellow
-# 9 - Lred
-# 10 - Lgreen
-# 11 - Lblue
-# 12 - Lmagenta
-# 13 - Lcyan
-# 14 - White
-# Example: "13 11 9 5" - (Enabled)
-# Default: "" - (Disabled)
-
-LogColors = ""
-
-#
-# EnableLogDB
-# Description: Write log messages to database (LogDatabaseInfo).
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-EnableLogDB = 0
-
-#
-# DBLogLevel
-# Description: Log level of databases logging.
-# Default: 1 - (Basic)
-# 0 - (Minimum)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-DBLogLevel = 1
-
-#
# UseProcessors
# Description: Processors mask for Windows based multi-processor systems.
# Default: 0 - (Selected by OS)
@@ -255,3 +145,105 @@ LoginDatabase.WorkerThreads = 1
#
###################################################################################################
+
+###################################################################################################
+#
+# Logging system options.
+#
+# Appender config values: Given a appender "name"
+# Appender.name
+# Description: Defines 'where to log'
+# Format: Type,LogLevel,Flags,optional1,optional2
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "13 11 9 5 3 1"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+
+Appender.Console=1,2,0
+Appender.Auth=2,2,0,Auth.log,w
+
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+# Appenders
+# Description: List of Appenders to read from config
+# (Using spaces as separator).
+# Default: "Console Server"
+
+Appenders=Console Auth
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: Type,LogLevel,AppenderList
+# Type
+# 0 - Default. Each type that has no config will
+# rely on this one. Core will create this logger
+# (disabled) if it's not configured
+# 7 - Network input/output,
+# 30 - Authserver
+
+Logger.Root=0,3,Console Auth
+
+#
+# Loggers
+# Description: List of Loggers to read from config
+# (Using spaces as separator).
+# Default: "root"
+
+Loggers=Root
diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h
index ea70fc3e322..a4bbe21006a 100755
--- a/src/server/collision/BoundingIntervalHierarchy.h
+++ b/src/server/collision/BoundingIntervalHierarchy.h
@@ -128,7 +128,7 @@ class BIH
delete[] dat.primBound;
delete[] dat.indices;
}
- uint32 primCount() { return objects.size(); }
+ uint32 primCount() const { return objects.size(); }
template<typename RayCallback>
void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const
@@ -400,7 +400,8 @@ class BIH
void buildHierarchy(std::vector<uint32> &tempTree, buildData &dat, BuildStats &stats);
- void createNode(std::vector<uint32> &tempTree, int nodeIndex, uint32 left, uint32 right) {
+ void createNode(std::vector<uint32> &tempTree, int nodeIndex, uint32 left, uint32 right) const
+ {
// write leaf node
tempTree[nodeIndex + 0] = (3 << 30) | left;
tempTree[nodeIndex + 1] = right - left + 1;
diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp
index b9f0f25c2f9..81328d31d7b 100644
--- a/src/server/collision/Management/VMapManager2.cpp
+++ b/src/server/collision/Management/VMapManager2.cpp
@@ -257,7 +257,7 @@ namespace VMAP
WorldModel* worldmodel = new WorldModel();
if (!worldmodel->readFile(basepath + filename + ".vmo"))
{
- sLog->outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel;
return NULL;
}
@@ -277,7 +277,7 @@ namespace VMAP
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{
- sLog->outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
return;
}
if (model->second.decRefCount() == 0)
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index f4a3f1c7b30..6489ddd7a4f 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -320,7 +320,7 @@ namespace VMAP
else
{
success = false;
- sLog->outError("StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str());
}
}
@@ -356,7 +356,7 @@ namespace VMAP
}
if (!iTreeValues)
{
- sLog->outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY);
return false;
}
bool result = true;
@@ -382,7 +382,7 @@ namespace VMAP
// acquire model instance
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
if (!model)
- sLog->outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY);
// update tree
uint32 referencedVal;
@@ -432,7 +432,7 @@ namespace VMAP
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
if (tile == iLoadedTiles.end())
{
- sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
return;
}
if (tile->second) // file associated with tile
@@ -466,7 +466,7 @@ namespace VMAP
else
{
if (!iLoadedSpawns.count(referencedNode))
- sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
else if (--iLoadedSpawns[referencedNode] == 0)
{
iTreeValues[referencedNode].setUnloaded();
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index e7693a70de4..207b652a4d6 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -312,7 +312,7 @@ namespace VMAP
// write WorldModel
WorldModel model;
model.setRootWmoID(raw_model.RootWMOID);
- if (raw_model.groupsArray.size())
+ if (!raw_model.groupsArray.empty())
{
std::vector<GroupModel> groupsArray;
@@ -336,9 +336,15 @@ namespace VMAP
void TileAssembler::exportGameobjectModels()
{
FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb");
+ if (!model_list)
+ return;
+
FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb");
- if (!model_list || !model_list_copy)
+ if (!model_list_copy)
+ {
+ fclose(model_list);
return;
+ }
uint32 name_length, displayId;
char buff[500];
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 84c736c22e8..6cb0f90d98e 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -53,7 +53,7 @@ void LoadGameObjectModelList()
FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
if (!model_list_file)
{
- sLog->outError("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
+ sLog->outError(LOG_FILTER_GENERAL, "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
return;
}
@@ -72,7 +72,7 @@ void LoadGameObjectModelList()
|| fread(&v1, sizeof(Vector3), 1, model_list_file) != 1
|| fread(&v2, sizeof(Vector3), 1, model_list_file) != 1)
{
- sLog->outError("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
+ sLog->outError(LOG_FILTER_GENERAL, "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
break;
}
@@ -83,8 +83,8 @@ void LoadGameObjectModelList()
}
fclose(model_list_file);
- sLog->outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
+
}
GameObjectModel::~GameObjectModel()
@@ -103,7 +103,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
// ignore models with no bounds
if (mdl_box == G3D::AABox::zero())
{
- sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
return false;
}
@@ -176,7 +176,7 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto
Ray modRay(p, iInvRot * ray.direction());
float distance = MaxDist * iInvScale;
bool hit = iModel->IntersectRay(modRay, distance, StopAtFirstHit);
- if(hit)
+ if (hit)
{
distance *= iScale;
MaxDist = distance;
diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp
index b818232fb32..b4f3f73fc98 100644
--- a/src/server/collision/Models/WorldModel.cpp
+++ b/src/server/collision/Models/WorldModel.cpp
@@ -42,7 +42,7 @@ namespace VMAP
const Vector3 p(ray.direction().cross(e2));
const float a = e1.dot(p);
- if (abs(a) < EPS) {
+ if (fabs(a) < EPS) {
// Determinant is ill-conditioned; abort early
return false;
}
diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h
index 2867b29cfc1..00d7b0cd209 100644
--- a/src/server/collision/RegularGrid.h
+++ b/src/server/collision/RegularGrid.h
@@ -176,7 +176,7 @@ public:
}
if (cell == last_cell)
break;
- if(tMaxX < tMaxY)
+ if (tMaxX < tMaxY)
{
tMaxX += tDeltaX;
cell.x += stepX;
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 86f2c6a28b7..7d7a27fce13 100755
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -182,7 +182,7 @@ void CasterAI::UpdateAI(const uint32 diff)
ArcherAI::ArcherAI(Creature* c) : CreatureAI(c)
{
if (!me->m_spells[0])
- sLog->outError("ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
@@ -231,7 +231,7 @@ void ArcherAI::UpdateAI(const uint32 /*diff*/)
TurretAI::TurretAI(Creature* c) : CreatureAI(c)
{
if (!me->m_spells[0])
- sLog->outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h
index b9d385ba675..6dfea9ac158 100644
--- a/src/server/game/AI/CoreAI/GameObjectAI.h
+++ b/src/server/game/AI/CoreAI/GameObjectAI.h
@@ -33,24 +33,33 @@ class GameObjectAI
explicit GameObjectAI(GameObject* g) : go(g) {}
virtual ~GameObjectAI() {}
- virtual void UpdateAI(const uint32 /*diff*/) {}
+ virtual void UpdateAI(uint32 /*diff*/) {}
virtual void InitializeAI() { Reset(); }
virtual void Reset() {};
- static int Permissible(const GameObject* go);
+ // Pass parameters between AI
+ virtual void DoAction(const int32 /*param = 0 */) {}
+ virtual void SetGUID(const uint64& /*guid*/, int32 /*id = 0 */) {}
+ virtual uint64 GetGUID(int32 /*id = 0 */) { return 0; }
- virtual bool GossipHello(Player* /*player*/) {return false;}
- virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {return false;}
- virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) {return false;}
- virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) {return false;}
- virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {return false;}
- virtual uint32 GetDialogStatus(Player* /*player*/) {return 100;}
+ static int Permissible(GameObject const* go);
+
+ virtual bool GossipHello(Player* /*player*/) { return false; }
+ virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
+ virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; }
+ virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; }
+ virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
+ virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; }
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
+ virtual uint32 GetData(uint32 /*id*/) { return 0; }
+ virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
+ virtual uint64 GetData64(uint32 /*id*/) { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
- virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) { }
+ virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
+ virtual void EventInform(uint32 /*eventId*/) {}
};
class NullGameObjectAI : public GameObjectAI
@@ -58,8 +67,8 @@ class NullGameObjectAI : public GameObjectAI
public:
explicit NullGameObjectAI(GameObject* g);
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
- static int Permissible(const GameObject* /*go*/) { return PERMIT_BASE_IDLE; }
+ static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
};
#endif
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 252bcbabca5..6e2326ca9d5 100755
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -23,7 +23,7 @@
#include "World.h"
#include "CreatureAIImpl.h"
-int GuardAI::Permissible(const Creature* creature)
+int GuardAI::Permissible(Creature const* creature)
{
if (creature->isGuard())
return PERMIT_BASE_SPECIAL;
@@ -31,7 +31,7 @@ int GuardAI::Permissible(const Creature* creature)
return PERMIT_BASE_NO;
}
-GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
+GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature)
{
}
@@ -40,108 +40,35 @@ bool GuardAI::CanSeeAlways(WorldObject const* obj)
if (!obj->isType(TYPEMASK_UNIT))
return false;
- std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
- {
- if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
- if (unit == obj)
- return true;
- }
+ std::list<HostileReference*> threatList = me->getThreatManager().getThreatList();
+ for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+ if ((*itr)->getUnitGuid() == obj->GetGUID())
+ return true;
return false;
}
-void GuardAI::MoveInLineOfSight(Unit* unit)
-{
- // Ignore Z for flying creatures
- if (!me->CanFly() && me->GetDistanceZ(unit) > CREATURE_Z_ATTACK_RANGE)
- return;
-
- if (!me->getVictim() && me->IsValidAttackTarget(unit) &&
- (unit->IsHostileToPlayers() || me->IsHostileTo(unit)) &&
- unit->isInAccessiblePlaceFor(me))
- {
- float attackRadius = me->GetAttackDistance(unit);
- if (me->IsWithinDistInMap(unit, attackRadius))
- {
- //Need add code to let guard support player
- AttackStart(unit);
- //u->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
- }
- }
-}
-
void GuardAI::EnterEvadeMode()
{
if (!me->isAlive())
{
- sLog->outStaticDebug("Creature stopped attacking because he is dead [guid=%u]", me->GetGUIDLow());
me->GetMotionMaster()->MoveIdle();
-
- i_state = STATE_NORMAL;
-
- i_victimGuid = 0;
me->CombatStop(true);
me->DeleteThreatList();
return;
}
- Unit* victim = ObjectAccessor::GetUnit(*me, i_victimGuid);
-
- if (!victim)
- {
- sLog->outStaticDebug("Creature stopped attacking because victim does not exist [guid=%u]", me->GetGUIDLow());
- }
- else if (!victim->isAlive())
- {
- sLog->outStaticDebug("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow());
- }
- else if (victim->HasStealthAura())
- {
- sLog->outStaticDebug("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow());
- }
- else if (victim->isInFlight())
- {
- sLog->outStaticDebug("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow());
- }
- else
- {
- sLog->outStaticDebug("Creature stopped attacking because victim outran him [guid=%u]", me->GetGUIDLow());
- }
+ sLog->outDebug(LOG_FILTER_UNITS, "Guard entry: %u enters evade mode.", me->GetEntry());
me->RemoveAllAuras();
me->DeleteThreatList();
- i_victimGuid = 0;
me->CombatStop(true);
- i_state = STATE_NORMAL;
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
me->GetMotionMaster()->MoveTargetedHome();
}
-void GuardAI::UpdateAI(const uint32 /*diff*/)
-{
- // update i_victimGuid if me->getVictim() !=0 and changed
- if (!UpdateVictim())
- return;
-
- Unit* const victim = me->getVictim();
- if (!victim)
- return;
-
- i_victimGuid = victim->GetGUID();
-
- if (me->isAttackReady())
- {
- if (me->IsWithinMeleeRange(victim))
- {
- me->AttackerStateUpdate(victim);
- me->resetAttackTimer();
- }
- }
-}
-
void GuardAI::JustDied(Unit* killer)
{
if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h
index c80c5a6c343..c8dd9d54921 100755
--- a/src/server/game/AI/CoreAI/GuardAI.h
+++ b/src/server/game/AI/CoreAI/GuardAI.h
@@ -20,34 +20,19 @@
#define TRINITY_GUARDAI_H
#include "ScriptedCreature.h"
-#include "Timer.h"
class Creature;
class GuardAI : public ScriptedAI
{
- enum GuardState
- {
- STATE_NORMAL = 1,
- STATE_LOOK_AT_VICTIM = 2
- };
-
public:
+ explicit GuardAI(Creature* creature);
- explicit GuardAI(Creature* c);
-
- void MoveInLineOfSight(Unit*);
- void EnterEvadeMode();
- void JustDied(Unit*);
+ static int Permissible(Creature const* creature);
bool CanSeeAlways(WorldObject const* obj);
- void UpdateAI(const uint32);
- static int Permissible(const Creature*);
-
- private:
- uint64 i_victimGuid;
- GuardState i_state;
- TimeTracker i_tracker;
+ void EnterEvadeMode();
+ void JustDied(Unit* killer);
};
#endif
diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h
index d7bf8656f23..b4fd579d693 100755
--- a/src/server/game/AI/CoreAI/PassiveAI.h
+++ b/src/server/game/AI/CoreAI/PassiveAI.h
@@ -20,7 +20,6 @@
#define TRINITY_PASSIVEAI_H
#include "CreatureAI.h"
-//#include "CreatureAIImpl.h"
class PassiveAI : public CreatureAI
{
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index bcec8d273b9..99cf1cda4fc 100755
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -61,7 +61,7 @@ void PetAI::_stopAttack()
{
if (!me->isAlive())
{
- sLog->outStaticDebug("Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->CombatStop();
@@ -100,7 +100,7 @@ void PetAI::UpdateAI(const uint32 diff)
if (_needToStop())
{
- sLog->outStaticDebug("Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
_stopAttack();
return;
}
@@ -153,40 +153,56 @@ void PetAI::UpdateAI(const uint32 diff)
if (spellInfo->IsPositive())
{
- // non combat spells allowed
- // only pet spells have IsNonCombatSpell and not fit this reqs:
- // Consume Shadows, Lesser Invisibility, so ignore checks for its
if (spellInfo->CanBeUsedInCombat())
{
- // allow only spell without spell cost or with spell cost but not duration limit
- int32 duration = spellInfo->GetDuration();
- if ((spellInfo->ManaCost || spellInfo->ManaCostPercentage || spellInfo->ManaPerSecond) && duration > 0)
+ // check spell cooldown
+ if (me->HasSpellCooldown(spellInfo->Id))
continue;
- // allow only spell without cooldown > duration
- int32 cooldown = spellInfo->GetRecoveryTime();
- if (cooldown >= 0 && duration >= 0 && cooldown > duration)
+ // Check if we're in combat or commanded to attack
+ if (!me->isInCombat() && !me->GetCharmInfo()->IsCommandAttack())
continue;
}
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
-
bool spellUsed = false;
- for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
- {
- Unit* target = ObjectAccessor::GetUnit(*me, *tar);
- //only buff targets that are in combat, unless the spell can only be cast while out of combat
- if (!target)
- continue;
+ // Some spells can target enemy or friendly (DK Ghoul's Leap)
+ // Check for enemy first (pet then owner)
+ Unit* target = me->getAttackerForHelper();
+ if (!target && owner)
+ target = owner->getAttackerForHelper();
- if (spell->CanAutoCast(target))
+ if (target)
+ {
+ if (CanAttack(target) && spell->CanAutoCast(target))
{
targetSpellStore.push_back(std::make_pair(target, spell));
spellUsed = true;
- break;
}
}
+
+ // No enemy, check friendly
+ if (!spellUsed)
+ {
+ for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
+ {
+ Unit* ally = ObjectAccessor::GetUnit(*me, *tar);
+
+ //only buff targets that are in combat, unless the spell can only be cast while out of combat
+ if (!ally)
+ continue;
+
+ if (spell->CanAutoCast(ally))
+ {
+ targetSpellStore.push_back(std::make_pair(ally, spell));
+ spellUsed = true;
+ break;
+ }
+ }
+ }
+
+ // No valid targets at all
if (!spellUsed)
delete spell;
}
@@ -414,7 +430,6 @@ void PetAI::HandleReturnMovement()
}
}
}
-
}
void PetAI::DoAttack(Unit* target, bool chase)
@@ -516,3 +531,19 @@ bool PetAI::CanAttack(Unit* target)
// default, though we shouldn't ever get here
return false;
}
+
+void PetAI::ReceiveEmote(Player* player, uint32 emote)
+{
+ if (me->GetOwnerGUID() && me->GetOwnerGUID() == player->GetGUID())
+ switch (emote)
+ {
+ case TEXT_EMOTE_COWER:
+ if (me->isPet() && me->ToPet()->IsPetGhoul())
+ me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
+ break;
+ case TEXT_EMOTE_ANGRY:
+ if (me->isPet() && me->ToPet()->IsPetGhoul())
+ me->HandleEmoteCommand(EMOTE_ONESHOT_COWER);
+ break;
+ }
+}
diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h
index ed3e2305556..8e5311fa000 100755
--- a/src/server/game/AI/CoreAI/PetAI.h
+++ b/src/server/game/AI/CoreAI/PetAI.h
@@ -42,6 +42,7 @@ class PetAI : public CreatureAI
void MovementInform(uint32 moveType, uint32 data);
void OwnerDamagedBy(Unit* attacker);
void OwnerAttacked(Unit* target);
+ void ReceiveEmote(Player* player, uint32 textEmote);
private:
bool _isVisible(Unit*) const;
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index bf50909eeee..e159c1a7d9b 100755
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -130,7 +130,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
void UnitAI::DoCast(uint32 spellId)
{
Unit* target = NULL;
- //sLog->outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
+ //sLog->outError(LOG_FILTER_GENERAL, "aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
switch (AISpellInfo[spellId].target)
{
default:
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 9c236cbd039..17cef3ec1a1 100755
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -54,7 +54,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
Map* map = creature->GetMap();
if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
{
- sLog->outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
+ sLog->outError(LOG_FILTER_GENERAL, "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
return;
}
@@ -77,7 +77,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
- sLog->outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
return;
}
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 94ac452b9f3..68752b82e7f 100755
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -128,8 +128,6 @@ class CreatureAI : public UnitAI
void OnCharmed(bool apply);
- //virtual void SpellClick(Player* player) {}
-
// Called at reaching home after evade
virtual void JustReachedHome() {}
@@ -171,6 +169,8 @@ class CreatureAI : public UnitAI
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {}
+ virtual void OnSpellClick(Unit* /*clicker*/) { }
+
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
protected:
virtual void MoveInLineOfSight(Unit* /*who*/);
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index f568da80b49..d097adf38ec 100755
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -326,11 +326,15 @@ class EventMap : private std::map<uint32, uint32>
uint32 GetPhaseMask() const { return (_phase >> 24) & 0xFF; }
+ bool Empty() const { return empty(); }
+
// Sets event phase, must be in range 1 - 8
void SetPhase(uint32 phase)
{
if (phase && phase < 8)
_phase = (1 << (phase + 24));
+ else if (!phase)
+ _phase = 0;
}
// Creates new event entry in map with given id, time, group if given (1 - 8) and phase if given (1 - 8)
@@ -604,6 +608,7 @@ inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered)
{
+ // Why don't we check for casting unit_state and existing target as we do in DoCast(.. ?
me->CastSpell(me->getVictim(), spellId, triggered);
}
diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp
index e4cb62c56de..e5c689da339 100755
--- a/src/server/game/AI/CreatureAIRegistry.cpp
+++ b/src/server/game/AI/CreatureAIRegistry.cpp
@@ -30,7 +30,6 @@
#include "CreatureAIFactory.h"
#include "SmartAI.h"
-//#include "CreatureAIImpl.h"
namespace AIRegistry
{
void Initialize()
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index ebe14c0d7d0..4ccaa174e67 100755
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
@@ -125,7 +125,6 @@ namespace FactorySelector
}*/
return (mv_factory == NULL ? NULL : mv_factory->Create(creature));
-
}
GameObjectAI* SelectGameObjectAI(GameObject* go)
@@ -133,8 +132,16 @@ namespace FactorySelector
const GameObjectAICreator* ai_factory = NULL;
GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance());
+ if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
+ return scriptedAI;
+
ai_factory = ai_registry.GetRegistryItem(go->GetAIName());
+ // scriptname in db
+ if (!ai_factory)
+ if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
+ return scriptedAI;
+
//future goAI types go here
std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index 7a2b83273c9..aa14bc1b56e 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -40,7 +40,7 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM
Time = urand(repeatMin, repeatMax);
else
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
Enabled = false;
return false;
}
@@ -64,7 +64,6 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
std::vector<CreatureEventAI_Event>::const_iterator i;
for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i)
{
-
//Debug check
#ifndef TRINITY_DEBUG
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
@@ -83,10 +82,10 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
}
//EventMap had events but they were not added because they must be for instance
if (m_CreatureEventAIList.empty())
- sLog->outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry());
}
else
- sLog->outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry());
m_bEmptyList = m_CreatureEventAIList.empty();
m_Phase = 0;
@@ -319,7 +318,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& holder, Unit* actionIn
break;
}
default:
- sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type);
break;
}
@@ -492,10 +491,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED));
}
-
}
else
- sLog->outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId);
}
break;
}
@@ -511,7 +509,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
creature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!creature)
- sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, eventId, me->GetEntry());
else if (action.summon.target != TARGET_T_SELF && target)
creature->AI()->AttackStart(target);
break;
@@ -607,12 +605,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
int32 new_phase = int32(m_Phase)+action.set_inc_phase.step;
if (new_phase < 0)
{
- sLog->outErrorDb("CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry());
m_Phase = 0;
}
else if (new_phase >= MAX_PHASE)
{
- sLog->outErrorDb("CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry());
m_Phase = MAX_PHASE-1;
}
else
@@ -663,7 +661,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax)
m_Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax);
else
- sLog->outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry());
break;
case ACTION_T_SUMMON_ID:
{
@@ -672,7 +670,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr->GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
if (i == sEventAIMgr->GetCreatureEventAISummonMap().end())
{
- sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, eventId, me->GetEntry());
return;
}
@@ -683,7 +681,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
creature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!creature)
- sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, eventId, me->GetEntry());
else if (action.summon_id.target != TARGET_T_SELF && target)
creature->AI()->AttackStart(target);
@@ -703,10 +701,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_SET_INST_DATA:
{
- InstanceScript* instance = (InstanceScript*)me->GetInstanceScript();
+ InstanceScript* instance = me->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry());
return;
}
@@ -718,14 +716,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
Unit* target = GetTargetByType(action.set_inst_data64.target, actionInvoker);
if (!target)
{
- sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry());
return;
}
- InstanceScript* instance = (InstanceScript*)me->GetInstanceScript();
+ InstanceScript* instance = me->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry());
return;
}
@@ -735,8 +733,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_UPDATE_TEMPLATE:
if (me->GetEntry() == action.update_template.creatureId)
{
-
- sLog->outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry());
return;
}
@@ -745,8 +742,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_DIE:
if (me->isDead())
{
-
- sLog->outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry());
return;
}
me->Kill(me);
@@ -798,7 +794,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
object = me->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2);
if (!object)
{
- sLog->outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_TSCR, "EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry());
}
break;
}
@@ -843,6 +839,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
+ default:
+ break;
}
}
@@ -1048,7 +1046,6 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
void CreatureEventAI::SpellHit(Unit* unit, const SpellInfo* spell)
{
-
if (m_bEmptyList)
return;
@@ -1107,10 +1104,12 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
break;
case EVENT_T_RANGE:
if (me->getVictim())
- if (me->IsInMap(me->getVictim()))
+ if (me->IsInMap(me->getVictim()) && me->InSamePhase(me->getVictim()))
if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist))
ProcessEvent(*i);
break;
+ default:
+ break;
}
}
@@ -1230,13 +1229,13 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
{
if (!source)
{
- sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry);
return;
}
if (textEntry >= 0)
{
- sLog->outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
return;
}
@@ -1244,7 +1243,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
if (i == sEventAIMgr->GetCreatureEventAITextMap().end())
{
- sLog->outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
return;
}
@@ -1255,7 +1254,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
if (sSoundEntriesStore.LookupEntry((*i).second.SoundId))
source->PlayDirectSound((*i).second.SoundId);
else
- sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId);
}
if ((*i).second.Emote)
@@ -1265,7 +1264,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
((Unit*)source)->HandleEmoteCommand((*i).second.Emote);
}
else
- sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId());
}
switch ((*i).second.Type)
@@ -1286,13 +1285,13 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
{
if (target && target->GetTypeId() == TYPEID_PLAYER)
source->MonsterWhisper(textEntry, target->GetGUID());
- else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
+ else sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
case CHAT_TYPE_BOSS_WHISPER:
{
if (target && target->GetTypeId() == TYPEID_PLAYER)
source->MonsterWhisper(textEntry, target->GetGUID(), true);
- else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
+ else sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
case CHAT_TYPE_ZONE_YELL:
source->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index 3d2bcf888c8..b9e1ae32be4 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -589,7 +589,6 @@ struct CreatureEventAIHolder
class CreatureEventAI : public CreatureAI
{
-
public:
explicit CreatureEventAI(Creature* c);
~CreatureEventAI()
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index 517e55af457..728b17b0bbf 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -38,13 +38,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
// Load EventAI Text
sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
- // Gather Additional data from EventAI Texts 0 1 2 3 4
+ // Gather Additional data from EventAI Texts 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
if (!result)
{
- sLog->outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
+
return;
}
@@ -64,33 +64,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
// range negative
if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
{
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
continue;
}
// range negative (must not happen, loaded from same table)
if (!sObjectMgr->GetTrinityStringLocale(i))
{
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i);
continue;
}
if (temp.SoundId)
{
if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId);
}
if (!GetLanguageDescByID(temp.Language))
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language);
if (temp.Type > CHAT_TYPE_ZONE_YELL)
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type);
if (temp.Emote)
{
if (!sEmotesStore.LookupEntry(temp.Emote))
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote);
}
m_CreatureEventAI_TextMap[i] = temp;
@@ -98,11 +98,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
-// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
{
uint32 oldMSTime = getMSTime();
@@ -115,8 +114,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
if (!result)
{
- sLog->outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
+
return;
}
@@ -137,7 +136,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
if (!Trinity::IsValidMapCoord(temp.position_x, temp.position_y, temp.position_z, temp.orientation))
{
- sLog->outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation);
continue;
}
@@ -147,11 +146,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
-// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
uint32 oldMSTime = getMSTime();
@@ -169,8 +167,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
if (!result)
{
- sLog->outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
+
return;
}
@@ -191,7 +189,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
//Report any errors in event
if (e_type >= EVENT_T_END)
{
- sLog->outErrorDb("CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type);
continue;
}
temp.event_type = EventAI_Type(e_type);
@@ -204,20 +202,25 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
temp.raw.param3 = fields[8].GetInt32();
temp.raw.param4 = fields[9].GetInt32();
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
//Creature does not exist in database
- if (!sObjectMgr->GetCreatureTemplate(temp.creature_id))
+ if (!cInfo)
{
- sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id);
continue;
}
+ // Only on the first script
+ if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty())
+ sLog->outError(LOG_FILTER_SQL, "Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id);
+
//No chance of this event occuring
if (temp.event_chance == 0)
- sLog->outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
//Chance above 100, force it to be 100
else if (temp.event_chance > 100)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
temp.event_chance = 100;
}
@@ -227,23 +230,23 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_TIMER:
case EVENT_T_TIMER_OOC:
if (temp.timer.initialMax < temp.timer.initialMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
if (temp.timer.repeatMax < temp.timer.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_HP:
case EVENT_T_MANA:
case EVENT_T_TARGET_HP:
case EVENT_T_TARGET_MANA:
if (temp.percent_range.percentMax > 100)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
if (temp.percent_range.percentMax <= temp.percent_range.percentMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
temp.event_flags &= ~EFLAG_REPEATABLE;
}
break;
@@ -253,29 +256,29 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!spell)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
if ((temp.spell_hit.schoolMask & spell->SchoolMask) != spell->SchoolMask)
- sLog->outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
}
if (!temp.spell_hit.schoolMask)
- sLog->outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_RANGE:
if (temp.range.maxDist < temp.range.minDist)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
if (temp.range.repeatMax < temp.range.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_OOC_LOS:
if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SPAWNED:
switch (temp.spawned.condition)
@@ -284,55 +287,55 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case SPAWNED_EVENT_MAP:
if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
break;
case SPAWNED_EVENT_ZONE:
if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
default:
- sLog->outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
break;
}
break;
case EVENT_T_FRIENDLY_HP:
if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_FRIENDLY_IS_CC:
if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_FRIENDLY_MISSING_BUFF:
{
SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!spell)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
}
case EVENT_T_KILL:
if (temp.kill.repeatMax < temp.kill.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_TARGET_CASTING:
if (temp.target_casting.repeatMax < temp.target_casting.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SUMMONED_UNIT:
if (!sObjectMgr->GetCreatureTemplate(temp.summon_unit.creatureId))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_QUEST_ACCEPT:
case EVENT_T_QUEST_COMPLETE:
if (!sObjectMgr->GetQuestTemplate(temp.quest.questId))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
- sLog->outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
continue;
case EVENT_T_AGGRO:
@@ -342,7 +345,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (temp.event_flags & EFLAG_REPEATABLE)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
temp.event_flags &= ~EFLAG_REPEATABLE;
}
@@ -353,7 +356,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId))
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId);
continue;
}
if (temp.receive_emote.condition)
@@ -364,14 +367,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
cond.ConditionValue2 = temp.receive_emote.conditionValue2;
if (!sConditionMgr->isConditionTypeValid(&cond))
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition);
continue;
}
}
if (!(temp.event_flags & EFLAG_REPEATABLE))
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
temp.event_flags |= EFLAG_REPEATABLE;
}
@@ -384,16 +387,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.buffed.spellId);
if (!spell)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
if (temp.buffed.repeatMax < temp.buffed.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
}
default:
- sLog->outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
break;
}
@@ -402,7 +405,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
uint16 action_type = fields[10+(j*4)].GetUInt8();
if (action_type >= ACTION_T_END)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
temp.action[j].type = ACTION_T_NONE;
continue;
}
@@ -424,30 +427,30 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
if (action.text.TextId1 < 0)
{
if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
}
if (action.text.TextId2 < 0)
{
if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
if (!action.text.TextId1)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
}
if (action.text.TextId3 < 0)
{
if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
if (!action.text.TextId1 || !action.text.TextId2)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
}
break;
}
case ACTION_T_SET_FACTION:
if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId);
action.set_faction.factionId = 0;
}
break;
@@ -456,7 +459,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.morph.creatureId && !sObjectMgr->GetCreatureTemplate(action.morph.creatureId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
action.morph.creatureId = 0;
}
@@ -464,12 +467,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.morph.creatureId)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId);
action.morph.modelId = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId);
action.morph.modelId = 0;
}
}
@@ -477,33 +480,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case ACTION_T_SOUND:
if (!sSoundEntriesStore.LookupEntry(action.sound.soundId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId);
break;
case ACTION_T_EMOTE:
if (!sEmotesStore.LookupEntry(action.emote.emoteId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId);
break;
case ACTION_T_RANDOM_SOUND:
if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1);
if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2);
if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3);
break;
case ACTION_T_RANDOM_EMOTE:
if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1);
if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2);
if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3);
break;
case ACTION_T_CAST:
{
const SpellInfo* spell = sSpellMgr->GetSpellInfo(action.cast.spellId);
if (!spell)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
/* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
else
{
@@ -521,143 +524,143 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
action.cast.castFlags |= CAST_TRIGGERED;
if (action.cast.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
}
case ACTION_T_SUMMON:
if (!sObjectMgr->GetCreatureTemplate(action.summon.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
if (action.summon.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_THREAT_SINGLE_PCT:
if (std::abs(action.threat_single_pct.percent) > 100)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent);
if (action.threat_single_pct.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_THREAT_ALL_PCT:
if (std::abs(action.threat_all_pct.percent) > 100)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
break;
case ACTION_T_QUEST_EVENT:
if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event.questId))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
}
else
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId);
if (action.quest_event.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_CAST_EVENT:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
if (!sSpellMgr->GetSpellInfo(action.cast_event.spellId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
if (action.cast_event.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_UNIT_FIELD:
if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
if (action.set_unit_field.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_UNIT_FLAG:
case ACTION_T_REMOVE_UNIT_FLAG:
if (action.unit_flag.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_PHASE:
if (action.set_phase.phase >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
break;
case ACTION_T_INC_PHASE:
if (action.set_inc_phase.step == 0)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
break;
case ACTION_T_QUEST_EVENT_ALL:
if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event_all.questId))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
}
else
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
break;
case ACTION_T_CAST_EVENT_ALL:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event_all.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
if (!sSpellMgr->GetSpellInfo(action.cast_event_all.spellId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
break;
case ACTION_T_REMOVEAURASFROMSPELL:
if (!sSpellMgr->GetSpellInfo(action.remove_aura.spellId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
if (action.remove_aura.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3
if (action.random_phase.phase1 >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase.phase2 >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase.phase3 >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
break;
case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
if (action.random_phase_range.phaseMin >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase_range.phaseMin >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1);
std::swap(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax);
// equal case processed at call
}
break;
case ACTION_T_SUMMON_ID:
if (!sObjectMgr->GetCreatureTemplate(action.summon_id.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId);
if (action.summon_id.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
break;
case ACTION_T_KILLED_MONSTER:
if (!sObjectMgr->GetCreatureTemplate(action.killed_monster.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
if (action.killed_monster.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_INST_DATA:
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
if (action.set_inst_data.value > 4/*SPECIAL*/)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
break;
case ACTION_T_SET_INST_DATA64:
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
if (action.set_inst_data64.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_UPDATE_TEMPLATE:
if (!sObjectMgr->GetCreatureTemplate(action.update_template.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
break;
case ACTION_T_SET_SHEATH:
if (action.set_sheath.sheath >= MAX_SHEATH_STATE)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
action.set_sheath.sheath = SHEATH_STATE_UNARMED;
}
break;
@@ -666,7 +669,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.invincibility_hp_level.hp_level > 100)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
action.invincibility_hp_level.hp_level = 100;
}
}
@@ -676,7 +679,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.mount.creatureId && !sObjectMgr->GetCreatureTemplate(action.mount.creatureId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
action.morph.creatureId = 0;
}
@@ -684,12 +687,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.mount.creatureId)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
action.mount.modelId = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
action.mount.modelId = 0;
}
}
@@ -709,7 +712,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_RANDOM_SAY:
case ACTION_T_RANDOM_YELL:
case ACTION_T_RANDOM_TEXTEMOTE:
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
break;
case ACTION_T_MOVE_RANDOM_POINT:
@@ -723,7 +726,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
default:
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type);
break;
}
}
@@ -735,18 +738,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
while (result->NextRow());
- for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
- {
- if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(itr->first))
- {
- if (cInfo->AIName != "EventAI")
- {
- sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI', changing to EventAI", itr->first);
- const_cast<CreatureTemplate*>(cInfo)->AIName = "EventAI";
- }
- }
- }
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
}
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 0f0e2e416a2..76bb3aaa76a 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -5,9 +5,13 @@
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
#include "Item.h"
#include "Spell.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "ObjectMgr.h"
#include "TemporarySummon.h"
@@ -114,15 +118,7 @@ void ScriptedAI::UpdateAI(uint32 const /*diff*/)
if (!UpdateVictim())
return;
- if (me->isAttackReady())
- {
- //If we are within range melee the target
- if (me->IsWithinMeleeRange(me->getVictim()))
- {
- me->AttackerStateUpdate(me->getVictim());
- me->resetAttackTimer();
- }
- }
+ DoMeleeAttackIfReady();
}
void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle)
@@ -161,7 +157,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
if (!sSoundEntriesStore.LookupEntry(soundId))
{
- sLog->outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
+ sLog->outError(LOG_FILTER_TSCR, "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
return;
}
@@ -177,11 +173,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
{
//No target so we can't cast
if (!target)
- return false;
+ return NULL;
//Silenced so we can't cast
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
- return false;
+ return NULL;
//Using the extended script system we first create a list of viable spells
SpellInfo const* apSpell[CREATURE_MAX_SPELLS];
@@ -254,7 +250,7 @@ void ScriptedAI::DoResetThreat()
{
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
{
- sLog->outError("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
+ sLog->outError(LOG_FILTER_TSCR, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
return;
}
@@ -303,7 +299,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
- sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
+ sLog->outError(LOG_FILTER_TSCR, "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
}
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
@@ -435,7 +431,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
return false;
break;
default: // For most of creatures that certain area is their home area.
- sLog->outDetail("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
+ sLog->outInfo(LOG_FILTER_GENERAL, "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ());
if (me->GetAreaId() == homeAreaId)
return false;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index 4fac8b3cba5..ba0a94d2590 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -191,7 +191,7 @@ struct ScriptedAI : public CreatureAI
//Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims
void SetCombatMovement(bool allowMovement);
- bool IsCombatMovementAllowed() { return _isCombatMovementAllowed; }
+ bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; }
bool EnterEvadeIfOutOfCombatArea(uint32 const diff);
@@ -200,16 +200,16 @@ struct ScriptedAI : public CreatureAI
// - for raid in mode 10-Heroic
// - for raid in mode 25-heroic
// DO NOT USE to check raid in mode 25-normal.
- bool IsHeroic() { return _isHeroic; }
+ bool IsHeroic() const { return _isHeroic; }
// return the dungeon or raid difficulty
- Difficulty GetDifficulty() { return _difficulty; }
+ Difficulty GetDifficulty() const { return _difficulty; }
// return true for 25 man or 25 man heroic mode
- bool Is25ManRaid() { return _difficulty & RAID_DIFFICULTY_MASK_25MAN; }
+ bool Is25ManRaid() const { return _difficulty & RAID_DIFFICULTY_MASK_25MAN; }
template<class T> inline
- const T& DUNGEON_MODE(const T& normal5, const T& heroic10)
+ const T& DUNGEON_MODE(const T& normal5, const T& heroic10) const
{
switch (_difficulty)
{
@@ -225,7 +225,7 @@ struct ScriptedAI : public CreatureAI
}
template<class T> inline
- const T& RAID_MODE(const T& normal10, const T& normal25)
+ const T& RAID_MODE(const T& normal10, const T& normal25) const
{
switch (_difficulty)
{
@@ -241,7 +241,7 @@ struct ScriptedAI : public CreatureAI
}
template<class T> inline
- const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25)
+ const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) const
{
switch (_difficulty)
{
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 688d48b41ad..003c9ac9d1c 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -9,7 +9,7 @@ SDComment:
SDCategory: Npc
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
@@ -32,7 +32,8 @@ npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
m_bCanReturnToStart(false),
DespawnAtEnd(true),
DespawnAtFar(true),
- ScriptWP(false)
+ ScriptWP(false),
+ HasImmuneToNPCFlags(false)
{}
void npc_escortAI::AttackStart(Unit* who)
@@ -174,11 +175,13 @@ void npc_escortAI::EnterEvadeMode()
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has left combat and is now returning to last point");
}
else
{
me->GetMotionMaster()->MoveTargetedHome();
+ if (HasImmuneToNPCFlags)
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
Reset();
}
}
@@ -213,7 +216,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
{
if (DespawnAtEnd)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints");
if (m_bCanReturnToStart)
{
@@ -224,7 +227,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
m_uiWPWaitTimer = 0;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
return;
}
@@ -240,7 +243,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
}
else
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints with Despawn off");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints with Despawn off");
return;
}
@@ -249,7 +252,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
@@ -267,7 +270,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
{
if (DespawnAtFar && !IsPlayerOrGroupInRange())
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI failed because player/group was to far away or not found");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI failed because player/group was to far away or not found");
if (m_bCanInstantRespawn)
{
@@ -305,7 +308,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
//Combat start position reached, continue waypoint movement
if (pointId == POINT_LAST_POINT)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original position before combat");
me->SetWalk(!m_bIsRunning);
RemoveEscortState(STATE_ESCORT_RETURNING);
@@ -315,7 +318,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
}
else if (pointId == POINT_HOME)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
CurrentWP = WaypointList.begin();
m_uiWPWaitTimer = 1;
@@ -325,11 +328,11 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
//Make sure that we are still on the right waypoint
if (CurrentWP->id != pointId)
{
- sLog->outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
return;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI Waypoint %u reached", CurrentWP->id);
//Call WP function
WaypointReached(CurrentWP->id);
@@ -383,7 +386,7 @@ void npc_escortAI::FillPointMovementListForCreature()
if (movePoints.empty())
return;
- ScriptPointVector::const_iterator itrEnd = movePoints.end();;
+ ScriptPointVector::const_iterator itrEnd = movePoints.end();
for (ScriptPointVector::const_iterator itr = movePoints.begin(); itr != itrEnd; ++itr)
{
Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime);
@@ -398,14 +401,14 @@ void npc_escortAI::SetRun(bool on)
if (!m_bIsRunning)
me->SetWalk(false);
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->SetWalk(true);
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set walk mode, but is already walking.");
}
m_bIsRunning = on;
@@ -416,13 +419,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
{
if (me->getVictim())
{
- sLog->outError("TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
- sLog->outError("TSCR: EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
+ sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
@@ -435,7 +438,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
if (WaypointList.empty())
{
- sLog->outErrorDb("TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
+ sLog->outError(LOG_FILTER_SQL, "TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
@@ -451,19 +454,24 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
m_bCanReturnToStart = canLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
+ if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
+ {
+ HasImmuneToNPCFlags = true;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
+ }
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 24d15f9079b..4b4f3656a8d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -120,6 +120,6 @@ struct npc_escortAI : public ScriptedAI
bool DespawnAtEnd;
bool DespawnAtFar;
bool ScriptWP;
+ bool HasImmuneToNPCFlags;
};
#endif
-
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 13bbbe2c338..1e83c203553 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -9,7 +9,7 @@ SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
#include "ScriptedFollowerAI.h"
#include "Group.h"
@@ -165,7 +165,7 @@ void FollowerAI::EnterEvadeMode()
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI left combat, returning to CombatStartPosition.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI left combat, returning to CombatStartPosition.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
{
@@ -191,7 +191,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is set completed, despawns.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is set completed, despawns.");
me->DespawnOrUnsummon();
return;
}
@@ -202,7 +202,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is returning to leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
@@ -231,7 +231,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI failed because player/group was to far away or not found");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI failed because player/group was to far away or not found");
me->DespawnOrUnsummon();
return;
}
@@ -274,13 +274,13 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
{
if (me->getVictim())
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI attempt to StartFollow while in combat.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outError("TSCR: FollowerAI attempt to StartFollow while already following.");
+ sLog->outError(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following.");
return;
}
@@ -296,7 +296,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
@@ -305,7 +305,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID);
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID);
}
Player* FollowerAI::GetLeaderForFollower()
@@ -324,17 +324,16 @@ Player* FollowerAI::GetLeaderForFollower()
if (member && member->isAlive() && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader changed and returned new leader.");
m_uiLeaderGUID = member->GetGUID();
return member;
- break;
}
}
}
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader can not find suitable leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader can not find suitable leader.");
return NULL;
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 4eb7f8a7f50..0b8236908a0 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -27,9 +27,8 @@
#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "Group.h"
-
#include "SmartAI.h"
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
SmartAI::SmartAI(Creature* c) : CreatureAI(c)
{
@@ -108,7 +107,7 @@ WayPoint* SmartAI::GetNextWayPoint()
mLastWP = (*itr).second;
if (mLastWP->id != mCurrentWPID)
{
- sLog->outError("SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
+ sLog->outError(LOG_FILTER_GENERAL, "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
}
return (*itr).second;
}
@@ -119,7 +118,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
{
if (me->isInCombat())// no wp movement in combat
{
- sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
@@ -135,8 +134,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
SetRun(run);
- WayPoint* wp = GetNextWayPoint();
- if (wp)
+ if (WayPoint* wp = GetNextWayPoint())
{
me->GetPosition(&mLastOOCPos);
me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
@@ -164,7 +162,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
return;
if (HasEscortState(SMART_ESCORT_PAUSED))
{
- sLog->outError("SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
return;
}
mForcedPaused = forced;
@@ -302,7 +300,6 @@ void SmartAI::UpdatePath(const uint32 diff)
mWPPauseTimer = 0;
} else {
mWPPauseTimer -= diff;
-
}
}
if (HasEscortState(SMART_ESCORT_RETURNING))
@@ -324,15 +321,12 @@ void SmartAI::UpdatePath(const uint32 diff)
if (mCurrentWPID == GetWPCount())
{
EndPath();
- } else {
- WayPoint* wp = GetNextWayPoint();
- if (wp)
- {
- SetRun(mRun);
- me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
- }
}
-
+ else if (WayPoint* wp = GetNextWayPoint())
+ {
+ SetRun(mRun);
+ me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
+ }
}
}
@@ -696,8 +690,9 @@ void SmartAI::OnCharmed(bool apply)
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply);
}
-void SmartAI::DoAction(const int32 /*param*/)
+void SmartAI::DoAction(const int32 param)
{
+ GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param);
}
uint32 SmartAI::GetData(uint32 /*id*/)
@@ -804,12 +799,12 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
return;
SetRun(mRun);
mFollowGuid = target->GetGUID();
- mFollowDist = dist ? dist : PET_FOLLOW_DIST;
- mFollowAngle = angle ? angle : me->GetFollowAngle();
+ mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST;
+ mFollowAngle = angle >= 0.0f ? angle : me->GetFollowAngle();
mFollowArrivedTimer = 1000;
mFollowCredit = credit;
mFollowArrivedEntry = end;
- me->GetMotionMaster()->MoveFollow(target, dist, angle);
+ me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
mFollowCreditType = creditType;
}
@@ -825,27 +820,10 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId)
GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId);
}
-/*
-SMART_EVENT_UPDATE_OOC
-SMART_EVENT_SPELLHIT
-SMART_EVENT_RANGE
-SMART_EVENT_RESPAWN
-SMART_EVENT_SUMMONED_UNIT
-SMART_EVENT_ACCEPTED_QUEST
-SMART_EVENT_REWARD_QUEST
-SMART_EVENT_TARGET_BUFFED
-SMART_EVENT_SUMMON_DESPAWNED
-SMART_EVENT_AI_INIT
-SMART_EVENT_DATA_SET
-SMART_EVENT_TEXT_OVER
-SMART_EVENT_TIMED_EVENT_TRIGGERED
-SMART_EVENT_UPDATE
-SMART_EVENT_LINK
-SMART_EVENT_GOSSIP_SELECT
-SMART_EVENT_JUST_CREATED
-SMART_EVENT_GOSSIP_HELLO
-SMART_EVENT_DEATH
-*/
+void SmartAI::OnSpellClick(Unit* clicker)
+{
+ GetScript()->ProcessEventsFor(SMART_EVENT_ON_SPELLCLICK, clicker);
+}
int SmartGameObjectAI::Permissible(const GameObject* g)
{
@@ -854,7 +832,7 @@ int SmartGameObjectAI::Permissible(const GameObject* g)
return PERMIT_BASE_NO;
}
-void SmartGameObjectAI::UpdateAI(const uint32 diff)
+void SmartGameObjectAI::UpdateAI(uint32 diff)
{
GetScript()->OnUpdate(diff);
}
@@ -937,6 +915,11 @@ void SmartGameObjectAI::OnStateChanged(uint32 state, Unit* unit)
GetScript()->ProcessEventsFor(SMART_EVENT_GO_STATE_CHANGED, unit, state);
}
+void SmartGameObjectAI::EventInform(uint32 eventId)
+{
+ GetScript()->ProcessEventsFor(SMART_EVENT_GO_EVENT_INFORM, NULL, eventId);
+}
+
class SmartTrigger : public AreaTriggerScript
{
public:
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 94e5e65cf8b..79cef0c3b37 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -62,6 +62,7 @@ class SmartAI : public CreatureAI
void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
void SetCombatMove(bool on);
+ bool CanCombatMove() { return mCanCombatMove; }
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0);
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
@@ -197,6 +198,8 @@ class SmartAI : public CreatureAI
void RemoveAuras();
+ void OnSpellClick(Unit* clicker);
+
private:
uint32 mFollowCreditType;
uint32 mFollowArrivedTimer;
@@ -224,7 +227,6 @@ class SmartAI : public CreatureAI
bool mCanCombatMove;
bool mForcedPaused;
uint32 mInvincibilityHpLevel;
-
bool AssistPlayerInCombat(Unit* who);
uint32 mDespawnTime;
@@ -235,30 +237,31 @@ class SmartAI : public CreatureAI
class SmartGameObjectAI : public GameObjectAI
{
-public:
- SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {}
- ~SmartGameObjectAI() {}
-
- void UpdateAI(const uint32 diff);
- void InitializeAI();
- void Reset();
- SmartScript* GetScript() { return &mScript; }
- static int Permissible(const GameObject* g);
-
- bool GossipHello(Player* player);
- bool GossipSelect(Player* player, uint32 sender, uint32 action);
- bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/);
- bool QuestAccept(Player* player, Quest const* quest);
- bool QuestReward(Player* player, Quest const* quest, uint32 opt);
- uint32 GetDialogStatus(Player* /*player*/);
- void Destroyed(Player* player, uint32 eventId);
- void SetData(uint32 id, uint32 value);
- void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
- void OnGameEvent(bool start, uint16 eventId);
- void OnStateChanged(uint32 state, Unit* unit);
-
-protected:
- GameObject* const go;
- SmartScript mScript;
+ public:
+ SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {}
+ ~SmartGameObjectAI() {}
+
+ void UpdateAI(uint32 diff);
+ void InitializeAI();
+ void Reset();
+ SmartScript* GetScript() { return &mScript; }
+ static int Permissible(const GameObject* g);
+
+ bool GossipHello(Player* player);
+ bool GossipSelect(Player* player, uint32 sender, uint32 action);
+ bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/);
+ bool QuestAccept(Player* player, Quest const* quest);
+ bool QuestReward(Player* player, Quest const* quest, uint32 opt);
+ uint32 GetDialogStatus(Player* /*player*/);
+ void Destroyed(Player* player, uint32 eventId);
+ void SetData(uint32 id, uint32 value);
+ void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
+ void OnGameEvent(bool start, uint16 eventId);
+ void OnStateChanged(uint32 state, Unit* unit);
+ void EventInform(uint32 eventId);
+
+ protected:
+ GameObject* const go;
+ SmartScript mScript;
};
#endif
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 209eb38e13a..6e5a34e8c33 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -160,9 +160,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
case SMART_ACTION_TALK:
{
- if (!me)
- break;
-
ObjectList* targets = GetTargets(e, unit);
Creature* talker = me;
Player* targetPlayer = NULL;
@@ -185,6 +182,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
}
+ if (!talker)
+ break;
+
mTalkerEntry = talker->GetEntry();
mLastTextID = e.action.talk.textGroupID;
mTextTimer = e.action.talk.duration;
@@ -789,7 +789,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsUnit((*itr)))
continue;
- (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell);
+ if (e.action.removeAura.spell == 0)
+ (*itr)->ToUnit()->RemoveAllAuras();
+ else
+ (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell);
+
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u",
(*itr)->GetGUIDLow(), e.action.removeAura.spell);
}
@@ -906,7 +910,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
break;
}
@@ -927,7 +931,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
break;
}
@@ -1119,12 +1123,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
- if (!IsUnit(*itr))
- continue;
-
(*itr)->GetPosition(x, y, z, o);
+ x += e.target.x;
+ y += e.target.y;
+ z += e.target.z;
+ o += e.target.o;
if (Creature* summon = GetBaseObject()->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration))
- if (unit && e.action.summonCreature.attackInvoker)
+ if (e.action.summonCreature.attackInvoker)
summon->AI()->AttackStart((*itr)->ToUnit());
}
@@ -1154,6 +1159,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
continue;
(*itr)->GetPosition(x, y, z, o);
+ x += e.target.x;
+ y += e.target.y;
+ z += e.target.z;
+ o += e.target.o;
GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime);
}
@@ -1429,7 +1438,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry);
if (!einfo)
{
- sLog->outErrorDb("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry);
return;
}
npc->SetCurrentEquipmentId(e.action.equip.entry);
@@ -1529,11 +1538,32 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
case SMART_ACTION_CALL_SCRIPT_RESET:
OnReset();
break;
+ case SMART_ACTION_SET_RANGED_MOVEMENT:
+ {
+ if (!IsSmart())
+ break;
+
+ float attackDistance = float(e.action.setRangedMovement.distance);
+ float attackAngle = float(e.action.setRangedMovement.angle) / 180.0f * M_PI;
+
+ ObjectList* targets = GetTargets(e, unit);
+ if (targets)
+ {
+ for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (Creature* target = (*itr)->ToCreature())
+ if (IsSmart(target) && target->getVictim())
+ if (CAST_AI(SmartAI, target->AI())->CanCombatMove())
+ target->GetMotionMaster()->MoveChase(target->getVictim(), attackDistance, attackAngle);
+
+ delete targets;
+ }
+ break;
+ }
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
{
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1657,7 +1687,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = temp[urand(0, count)];
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1687,7 +1717,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1752,7 +1782,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsUnit(*itr))
- (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.setunitByte.byte1);
+ (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, e.action.setunitByte.type, e.action.setunitByte.byte1);
delete targets;
break;
@@ -1765,7 +1795,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsUnit(*itr))
- (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.delunitByte.byte1);
+ (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, e.action.delunitByte.type, e.action.delunitByte.byte1);
delete targets;
break;
@@ -1879,14 +1909,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()))
ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list
else
- sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping");
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping");
}
else if (IsGameObject(*itr))
{
if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI()))
ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list
else
- sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping");
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping");
}
}
@@ -1920,7 +1950,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
}
default:
- sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
}
@@ -1930,7 +1960,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (linked.GetActionType() && linked.GetEventType() == SMART_EVENT_LINK)
ProcessEvent(linked, unit, var0, var1, bvar, spell, gob);
else
- sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
}
}
@@ -1940,7 +1970,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
return;
if (mTemplate)
{
- sLog->outErrorDb("SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
return;
}
mTemplate = (SMARTAI_TEMPLATE)e.action.installTtemplate.id;
@@ -1990,16 +2020,16 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
if (!go)
return;
//store hostage as id1
- AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0);
+ AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0);
//store invoker as id2
- AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 2, 0, 0, 0, 0, 0, SMART_TARGET_NONE, 0, 0, 0, 0);
+ AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 2, 0, 0, 0, 0, 0, SMART_TARGET_NONE, 0, 0, 0, 0);
//signal hostage
- AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_SET_DATA, 0, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 1, 0, 0, 0);
+ AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_SET_DATA, 0, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 1, 0, 0, 0);
//when hostage raeched end point, give credit to invoker
if (e.action.installTtemplate.param2)
AddEvent(SMART_EVENT_DATA_SET, 0, 0, 0, 0, 0, SMART_ACTION_CALL_KILLEDMONSTER, e.action.installTtemplate.param1, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 2, 0, 0, 0);
else
- AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_CALL_KILLEDMONSTER, e.action.installTtemplate.param1, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 2, 0, 0, 0);
+ AddEvent(SMART_EVENT_GO_STATE_CHANGED, 0, 2, 0, 0, 0, SMART_ACTION_CALL_KILLEDMONSTER, e.action.installTtemplate.param1, 0, 0, 0, 0, 0, SMART_TARGET_STORED, 2, 0, 0, 0);
break;
}
case SMARTAI_TEMPLATE_BASIC:
@@ -2093,12 +2123,20 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
case SMART_TARGET_INVOKER_PARTY:
if (trigger)
{
- l->push_back(trigger);
if (Player* player = trigger->ToPlayer())
+ {
if (Group* group = player->GetGroup())
+ {
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
if (Player* member = groupRef->getSource())
l->push_back(member);
+ }
+ // We still add the player to the list if there is no group. If we do
+ // this even if there is a group (thus the else-check), it will add the
+ // same player to the list twice. We don't want that to happen.
+ else
+ l->push_back(trigger);
+ }
}
break;
case SMART_TARGET_CREATURE_RANGE:
@@ -2189,7 +2227,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (!trigger && !GetBaseObject())
{
- sLog->outErrorDb("SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry");
+ sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry");
break;
}
@@ -2212,7 +2250,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (!trigger && !GetBaseObject())
{
- sLog->outErrorDb("SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry");
+ sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry");
break;
}
@@ -2496,6 +2534,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
case SMART_EVENT_JUST_CREATED:
case SMART_EVENT_GOSSIP_HELLO:
case SMART_EVENT_FOLLOW_COMPLETED:
+ case SMART_EVENT_ON_SPELLCLICK:
ProcessAction(e, unit, var0, var1, bvar, spell, gob);
break;
case SMART_EVENT_IS_BEHIND_TARGET:
@@ -2733,8 +2772,22 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
ProcessAction(e, unit, var0, var1);
break;
}
+ case SMART_EVENT_GO_EVENT_INFORM:
+ {
+ if (e.event.eventInform.eventId != var0)
+ return;
+ ProcessAction(e, NULL, var0);
+ break;
+ }
+ case SMART_EVENT_ACTION_DONE:
+ {
+ if (e.event.doAction.eventId != var0)
+ return;
+ ProcessAction(e, unit, var0);
+ break;
+ }
default:
- sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
break;
}
}
@@ -2849,23 +2902,6 @@ void SmartScript::InstallEvents()
}
}
-bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3)
-{
- if (c == 0)
- return true;
-
- if (!u || !u->ToPlayer())
- return false;
-
- Condition cond;
- cond.ConditionType = ConditionTypes(uint32(c));
- cond.ConditionValue1 = uint32(v1);
- cond.ConditionValue1 = uint32(v2);
- cond.ConditionValue1 = uint32(v3);
- ConditionSourceInfo srcInfo = ConditionSourceInfo(u->ToPlayer());
- return cond.Meets(srcInfo);
-}
-
void SmartScript::OnUpdate(uint32 const diff)
{
if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !GetBaseObject())
@@ -2948,9 +2984,9 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn
mEvents.push_back((*i));//NOTE: 'world(0)' events still get processed in ANY instance mode
}
if (mEvents.empty() && obj)
- sLog->outErrorDb("SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry());
if (mEvents.empty() && at)
- sLog->outErrorDb("SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id);
}
void SmartScript::GetScript()
@@ -2994,7 +3030,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry());
break;
default:
- sLog->outError("SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
+ sLog->outError(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
return;
}
} else if (at)
@@ -3005,7 +3041,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
}
else
{
- sLog->outError("SmartScript::OnInitialize: !WARNING! Initialized objects are NULL.");
+ sLog->outError(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: !WARNING! Initialized objects are NULL.");
return;
}
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 5fb691c87f2..2a0eceb574a 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -83,8 +83,6 @@ class SmartScript
return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT;
}
- bool ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3);
-
void OnUpdate(const uint32 diff);
void OnMoveInLineOfSight(Unit* who);
@@ -119,7 +117,7 @@ class SmartScript
smart = false;
if (!smart)
- sLog->outErrorDb("SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
return smart;
}
@@ -133,7 +131,7 @@ class SmartScript
if (!go || go->GetAIName() != "SmartGameObjectAI")
smart = false;
if (!smart)
- sLog->outErrorDb("SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
return smart;
}
@@ -256,7 +254,6 @@ class SmartScript
mStoredEvents.erase(i);
return;
}
-
}
}
}
@@ -270,7 +267,6 @@ class SmartScript
{
return (*i);
}
-
}
}
SmartScriptHolder s;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index b0f1fcb8ede..3b69408354e 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -50,8 +50,8 @@ void SmartWaypointMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
+
return;
}
@@ -78,7 +78,7 @@ void SmartWaypointMgr::LoadFromDB()
}
if (last_id != id)
- sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
+ sLog->outError(LOG_FILTER_SQL, "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
last_id++;
(*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
@@ -88,8 +88,8 @@ void SmartWaypointMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
+
}
SmartWaypointMgr::~SmartWaypointMgr()
@@ -117,8 +117,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
+
return;
}
@@ -134,7 +134,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8();
if (source_type >= SMART_SCRIPT_TYPE_MAX)
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
continue;
}
if (temp.entryOrGuid >= 0)
@@ -145,7 +145,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@@ -154,7 +154,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@@ -163,7 +163,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@@ -171,7 +171,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST:
break;//nothing to check, really
default:
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
continue;
}
}
@@ -179,7 +179,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
continue;
}
}
@@ -234,8 +234,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
@@ -249,7 +249,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
return false;
}
break;
@@ -259,7 +259,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
return false;
}
break;
@@ -281,7 +281,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.playerDistance.dist == 0)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@@ -305,7 +305,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_STORED:
break;
default:
- sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@@ -315,23 +315,28 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.type >= SMART_EVENT_END)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
return false;
}
// in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core
if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1]))
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
return false;
}
- if (e.action.type >= SMART_ACTION_END)
+ if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
return false;
}
if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
+ return false;
+ }
+ if (e.event.event_flags > SMART_EVENT_FLAGS_ALL)
+ {
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
return false;
}
if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)
@@ -372,12 +377,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
if (!spellInfo)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
}
@@ -392,12 +397,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
return false;
}
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
return false;
}
break;
@@ -470,64 +475,78 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_EVENT_TRANSPORT_ADDCREATURE:
- {
- if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature))
- return false;
- break;
- }
+ {
+ if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature))
+ return false;
+ break;
+ }
case SMART_EVENT_MOVEMENTINFORM:
+ {
+ if (e.event.movementInform.type > NULL_MOTION_TYPE)
{
- if (e.event.movementInform.type > NULL_MOTION_TYPE)
- {
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
- return false;
- }
- break;
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
+ return false;
}
+ break;
+ }
case SMART_EVENT_DATA_SET:
- {
- if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax))
- return false;
- break;
- }
+ {
+ if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax))
+ return false;
+ break;
+ }
case SMART_EVENT_AREATRIGGER_ONTRIGGER:
- {
- if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id))
- return false;
- break;
- }
+ {
+ if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id))
+ return false;
+ break;
+ }
case SMART_EVENT_TEXT_OVER:
//if (e.event.textOver.textGroupID && !IsTextValid(e, e.event.textOver.textGroupID)) return false;// 0 is a valid text group!
break;
case SMART_EVENT_LINK:
+ {
+ if (e.link && e.link == e.event_id)
{
- if (e.link && e.link == e.event_id)
- {
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
- return false;
- }
- break;
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
+ return false;
}
+ break;
+ }
case SMART_EVENT_DUMMY_EFFECT:
+ {
if (!IsSpellValid(e, e.event.dummy.spell))
return false;
if (e.event.dummy.effIndex > EFFECT_2)
return false;
break;
+ }
case SMART_EVENT_IS_BEHIND_TARGET:
+ {
if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax))
return false;
break;
+ }
case SMART_EVENT_GAME_EVENT_START:
case SMART_EVENT_GAME_EVENT_END:
+ {
+ GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
+ if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
+ return false;
+ break;
+ }
+ case SMART_EVENT_ACTION_DONE:
+ {
+ if (e.event.doAction.eventId > EVENT_CHARGE)
{
- GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
- if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
- return false;
- break;
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
+ return false;
}
+ break;
+ }
case SMART_EVENT_GO_STATE_CHANGED:
+ case SMART_EVENT_GO_EVENT_INFORM:
case SMART_EVENT_TIMED_EVENT_TRIGGERED:
case SMART_EVENT_INSTANCE_PLAYER_ENTER:
case SMART_EVENT_TRANSPORT_RELOCATE:
@@ -558,9 +577,10 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_GOSSIP_HELLO:
case SMART_EVENT_JUST_CREATED:
case SMART_EVENT_FOLLOW_COMPLETED:
+ case SMART_EVENT_ON_SPELLCLICK:
break;
default:
- sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@@ -570,7 +590,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_FACTION:
if (e.action.faction.factionID && !sFactionTemplateStore.LookupEntry(e.action.faction.factionID))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
return false;
}
break;
@@ -580,7 +600,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
return false;
}
@@ -588,12 +608,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
return false;
}
}
@@ -604,7 +624,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
if (e.action.sound.range > TEXT_RANGE_WORLD)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range);
return false;
}
break;
@@ -622,7 +642,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
return false;
}
break;
@@ -658,13 +678,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
}
else
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
break;
@@ -675,24 +695,22 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (!IsSpellValid(e, e.action.castCreatureOrGO.spell))
return false;
break;
-
-
case SMART_ACTION_SET_EVENT_PHASE:
if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1);
return false;
}
break;
case SMART_ACTION_INC_EVENT_PHASE:
if (!e.action.incEventPhase.inc && !e.action.incEventPhase.dec)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@@ -704,7 +722,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
break;
case SMART_ACTION_REMOVEAURASFROMSPELL:
- if (!IsSpellValid(e, e.action.removeAura.spell))
+ if (e.action.removeAura.spell != 0 && !IsSpellValid(e, e.action.removeAura.spell))
return false;
break;
case SMART_ACTION_RANDOM_PHASE:
@@ -716,7 +734,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@@ -726,7 +744,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax))
@@ -738,7 +756,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
return false;
}
break;
@@ -753,7 +771,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
return false;
}
break;
@@ -761,7 +779,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.react.state > REACT_AGGRESSIVE)
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
return false;
}
break;
@@ -781,14 +799,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
return false;
}
break;
case SMART_ACTION_INSTALL_AI_TEMPLATE:
if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END)
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
return false;
}
break;
@@ -800,14 +818,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
}
if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
return false;
if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
return false;
}
break;
@@ -888,7 +906,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SEND_TARGET_TO_TARGET:
break;
default:
- sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
}
@@ -906,7 +924,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
CreatureData const* data = sObjectMgr->GetCreatureData(entry);
if (!data)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
else
@@ -916,7 +934,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
error = true;
if (error)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
return false;
}
return true;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 8d3686a265d..05965d8ffa0 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -22,7 +22,6 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "Unit.h"
-#include "ConditionMgr.h"
#include "Spell.h"
//#include "SmartScript.h"
@@ -82,80 +81,82 @@ const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] =
enum SMART_EVENT
{
- SMART_EVENT_UPDATE_IC = 0, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax
- SMART_EVENT_UPDATE_OOC = 1, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax
- SMART_EVENT_HEALT_PCT = 2, //1 // HPMin%, HPMax%, RepeatMin, RepeatMax
- SMART_EVENT_MANA_PCT = 3, //1 // ManaMin%, ManaMax%, RepeatMin, RepeatMax
- SMART_EVENT_AGGRO = 4, //1 // NONE
- SMART_EVENT_KILL = 5, //1 // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3
- SMART_EVENT_DEATH = 6, //1 // NONE
- SMART_EVENT_EVADE = 7, //1 // NONE
- SMART_EVENT_SPELLHIT = 8, //1 // SpellID, School, CooldownMin, CooldownMax
- SMART_EVENT_RANGE = 9, //1 // MinDist, MaxDist, RepeatMin, RepeatMax
- SMART_EVENT_OOC_LOS = 10, //1 // NoHostile, MaxRnage, CooldownMin, CooldownMax
- SMART_EVENT_RESPAWN = 11, //1 // type, MapId, ZoneId
- SMART_EVENT_TARGET_HEALTH_PCT = 12, //1 // HPMin%, HPMax%, RepeatMin, RepeatMax
- SMART_EVENT_TARGET_CASTING = 13, //1 // RepeatMin, RepeatMax
- SMART_EVENT_FRIENDLY_HEALTH = 14, //1 // HPDeficit, Radius, RepeatMin, RepeatMax
- SMART_EVENT_FRIENDLY_IS_CC = 15, //1 // Radius, RepeatMin, RepeatMax
- SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, //1 // SpellId, Radius, RepeatMin, RepeatMax
- SMART_EVENT_SUMMONED_UNIT = 17, //1 // CreatureId(0 all), CooldownMin, CooldownMax
- SMART_EVENT_TARGET_MANA_PCT = 18, //1 // ManaMin%, ManaMax%, RepeatMin, RepeatMax
- SMART_EVENT_ACCEPTED_QUEST = 19, //1 // QuestID(0any)
- SMART_EVENT_REWARD_QUEST = 20, //1 // QuestID(0any)
- SMART_EVENT_REACHED_HOME = 21, //1 // NONE
- SMART_EVENT_RECEIVE_EMOTE = 22, //1 // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3
- SMART_EVENT_HAS_AURA = 23, //1 // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax
- SMART_EVENT_TARGET_BUFFED = 24, //1 // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax
- SMART_EVENT_RESET = 25, //1 // Called after combat, when the creature respawn and spawn.
-
- SMART_EVENT_IC_LOS = 26, //1 // NoHostile, MaxRnage, CooldownMin, CooldownMax
- SMART_EVENT_PASSENGER_BOARDED = 27, //1 // CooldownMin, CooldownMax
- SMART_EVENT_PASSENGER_REMOVED = 28, //1 // CooldownMin, CooldownMax
- SMART_EVENT_CHARMED = 29, //1 // NONE
- SMART_EVENT_CHARMED_TARGET = 30, //1 // NONE
- SMART_EVENT_SPELLHIT_TARGET = 31, //1 // SpellID, School, CooldownMin, CooldownMax
- SMART_EVENT_DAMAGED = 32, //1 // MinDmg, MaxDmg, CooldownMin, CooldownMax
- SMART_EVENT_DAMAGED_TARGET = 33, //1 // MinDmg, MaxDmg, CooldownMin, CooldownMax
- SMART_EVENT_MOVEMENTINFORM = 34, //1 // MovementType(any), PointID
- SMART_EVENT_SUMMON_DESPAWNED = 35, //1 // Entry, CooldownMin, CooldownMax
- SMART_EVENT_CORPSE_REMOVED = 36, //1 // NONE
- SMART_EVENT_AI_INIT = 37, //1 // NONE
- SMART_EVENT_DATA_SET = 38, //1 // Id, Value, CooldownMin, CooldownMax
- SMART_EVENT_WAYPOINT_START = 39, //1 // PointId(0any), pathID(0any)
- SMART_EVENT_WAYPOINT_REACHED = 40, //1 // PointId(0any), pathID(0any)
- SMART_EVENT_TRANSPORT_ADDPLAYER = 41, //1 // NONE
- SMART_EVENT_TRANSPORT_ADDCREATURE = 42, //1 // Entry (0 any)
- SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, //1 // NONE
- SMART_EVENT_TRANSPORT_RELOCATE = 44, //1 // PointId
- SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, //1 // Team (0 any), CooldownMin, CooldownMax
- SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, //1 // TriggerId(0 any)
- SMART_EVENT_QUEST_ACCEPTED = 47, //1 // none
- SMART_EVENT_QUEST_OBJ_COPLETETION = 48, //1 // none
- SMART_EVENT_QUEST_COMPLETION = 49, //1 // none
- SMART_EVENT_QUEST_REWARDED = 50, //1 // none
- SMART_EVENT_QUEST_FAIL = 51, //1 // none
- SMART_EVENT_TEXT_OVER = 52, //1 // GroupId from creature_text, creature entry who talks (0 any)
- SMART_EVENT_RECEIVE_HEAL = 53, //1 // MinHeal, MaxHeal, CooldownMin, CooldownMax
- SMART_EVENT_JUST_SUMMONED = 54, //1 // none
- SMART_EVENT_WAYPOINT_PAUSED = 55, //1 // PointId(0any), pathID(0any)
- SMART_EVENT_WAYPOINT_RESUMED = 56, //1 // PointId(0any), pathID(0any)
- SMART_EVENT_WAYPOINT_STOPPED = 57, //1 // PointId(0any), pathID(0any)
- SMART_EVENT_WAYPOINT_ENDED = 58, //1 // PointId(0any), pathID(0any)
- SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, //1 // id
- SMART_EVENT_UPDATE = 60, //1 // InitialMin, InitialMax, RepeatMin, RepeatMax
- SMART_EVENT_LINK = 61, //1 // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly
- SMART_EVENT_GOSSIP_SELECT = 62, //1 // menuID, actionID
- SMART_EVENT_JUST_CREATED = 63, //1 // none
- SMART_EVENT_GOSSIP_HELLO = 64, //1 // none
- SMART_EVENT_FOLLOW_COMPLETED = 65, //1 // none
- SMART_EVENT_DUMMY_EFFECT = 66, //1 // spellId, effectIndex
- SMART_EVENT_IS_BEHIND_TARGET = 67, //1 // cooldownMin, CooldownMax
- SMART_EVENT_GAME_EVENT_START = 68, //1 // game_event.Entry
- SMART_EVENT_GAME_EVENT_END = 69, //1 // game_event.Entry
- SMART_EVENT_GO_STATE_CHANGED = 70, // go state
-
- SMART_EVENT_END = 71,
+ SMART_EVENT_UPDATE_IC = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax
+ SMART_EVENT_UPDATE_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax
+ SMART_EVENT_HEALT_PCT = 2, // HPMin%, HPMax%, RepeatMin, RepeatMax
+ SMART_EVENT_MANA_PCT = 3, // ManaMin%, ManaMax%, RepeatMin, RepeatMax
+ SMART_EVENT_AGGRO = 4, // NONE
+ SMART_EVENT_KILL = 5, // CooldownMin0, CooldownMax1, playerOnly2, else creature entry3
+ SMART_EVENT_DEATH = 6, // NONE
+ SMART_EVENT_EVADE = 7, // NONE
+ SMART_EVENT_SPELLHIT = 8, // SpellID, School, CooldownMin, CooldownMax
+ SMART_EVENT_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax
+ SMART_EVENT_OOC_LOS = 10, // NoHostile, MaxRnage, CooldownMin, CooldownMax
+ SMART_EVENT_RESPAWN = 11, // type, MapId, ZoneId
+ SMART_EVENT_TARGET_HEALTH_PCT = 12, // HPMin%, HPMax%, RepeatMin, RepeatMax
+ SMART_EVENT_TARGET_CASTING = 13, // RepeatMin, RepeatMax
+ SMART_EVENT_FRIENDLY_HEALTH = 14, // HPDeficit, Radius, RepeatMin, RepeatMax
+ SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax
+ SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax
+ SMART_EVENT_SUMMONED_UNIT = 17, // CreatureId(0 all), CooldownMin, CooldownMax
+ SMART_EVENT_TARGET_MANA_PCT = 18, // ManaMin%, ManaMax%, RepeatMin, RepeatMax
+ SMART_EVENT_ACCEPTED_QUEST = 19, // QuestID(0any)
+ SMART_EVENT_REWARD_QUEST = 20, // QuestID(0any)
+ SMART_EVENT_REACHED_HOME = 21, // NONE
+ SMART_EVENT_RECEIVE_EMOTE = 22, // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3
+ SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax
+ SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax
+ SMART_EVENT_RESET = 25, // Called after combat, when the creature respawn and spawn.
+ SMART_EVENT_IC_LOS = 26, // NoHostile, MaxRnage, CooldownMin, CooldownMax
+ SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax
+ SMART_EVENT_PASSENGER_REMOVED = 28, // CooldownMin, CooldownMax
+ SMART_EVENT_CHARMED = 29, // NONE
+ SMART_EVENT_CHARMED_TARGET = 30, // NONE
+ SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax
+ SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax
+ SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax
+ SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID
+ SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax
+ SMART_EVENT_CORPSE_REMOVED = 36, // NONE
+ SMART_EVENT_AI_INIT = 37, // NONE
+ SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax
+ SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any)
+ SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any)
+ SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE
+ SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any)
+ SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE
+ SMART_EVENT_TRANSPORT_RELOCATE = 44, // PointId
+ SMART_EVENT_INSTANCE_PLAYER_ENTER = 45, // Team (0 any), CooldownMin, CooldownMax
+ SMART_EVENT_AREATRIGGER_ONTRIGGER = 46, // TriggerId(0 any)
+ SMART_EVENT_QUEST_ACCEPTED = 47, // none
+ SMART_EVENT_QUEST_OBJ_COPLETETION = 48, // none
+ SMART_EVENT_QUEST_COMPLETION = 49, // none
+ SMART_EVENT_QUEST_REWARDED = 50, // none
+ SMART_EVENT_QUEST_FAIL = 51, // none
+ SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any)
+ SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax
+ SMART_EVENT_JUST_SUMMONED = 54, // none
+ SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any)
+ SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any)
+ SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any)
+ SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any)
+ SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id
+ SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax
+ SMART_EVENT_LINK = 61, // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly
+ SMART_EVENT_GOSSIP_SELECT = 62, // menuID, actionID
+ SMART_EVENT_JUST_CREATED = 63, // none
+ SMART_EVENT_GOSSIP_HELLO = 64, // none
+ SMART_EVENT_FOLLOW_COMPLETED = 65, // none
+ SMART_EVENT_DUMMY_EFFECT = 66, // spellId, effectIndex
+ SMART_EVENT_IS_BEHIND_TARGET = 67, // cooldownMin, CooldownMax
+ SMART_EVENT_GAME_EVENT_START = 68, // game_event.Entry
+ SMART_EVENT_GAME_EVENT_END = 69, // game_event.Entry
+ SMART_EVENT_GO_STATE_CHANGED = 70, // go state
+ SMART_EVENT_GO_EVENT_INFORM = 71, // eventId
+ SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId)
+ SMART_EVENT_ON_SPELLCLICK = 73, // clicker (unit)
+
+ SMART_EVENT_END = 74,
};
struct SmartEvent
@@ -352,6 +353,16 @@ struct SmartEvent
struct
{
+ uint32 eventId;
+ } eventInform;
+
+ struct
+ {
+ uint32 eventId;
+ } doAction;
+
+ struct
+ {
uint32 param1;
uint32 param2;
uint32 param3;
@@ -398,7 +409,7 @@ enum SMART_ACTION
SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote
SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID
SMART_ACTION_CALL_CASTEDCREATUREORGO = 27, // CreatureId, SpellId
- SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid
+ SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid, 0 removes all auras
SMART_ACTION_FOLLOW = 29, // Distance (0 = default), Angle (0 = default), EndCreatureEntry, credit, creditType (0monsterkill, 1event)
SMART_ACTION_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3...
SMART_ACTION_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax
@@ -451,7 +462,7 @@ enum SMART_ACTION
SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // WARNING: CAN CRASH CORE, do not use if you dont know what you are doing
SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // none
SMART_ACTION_CALL_SCRIPT_RESET = 78, // none
- // Unused = 79,
+ SMART_ACTION_SET_RANGED_MOVEMENT = 79, // Distance, angle
SMART_ACTION_CALL_TIMED_ACTIONLIST = 80, // ID (overwrites already running actionlist), stop after combat?(0/1), timer update type(0-OOC, 1-IC, 2-ALWAYS)
SMART_ACTION_SET_NPC_FLAG = 81, // Flags
SMART_ACTION_ADD_NPC_FLAG = 82, // Flags
@@ -523,7 +534,6 @@ struct SmartAction
struct
{
-
uint32 emote1;
uint32 emote2;
uint32 emote3;
@@ -816,11 +826,13 @@ struct SmartAction
struct
{
uint32 byte1;
+ uint32 type;
} setunitByte;
struct
{
uint32 byte1;
+ uint32 type;
} delunitByte;
struct
@@ -846,9 +858,9 @@ struct SmartAction
struct
{
- bool withDelayed;
+ uint32 withDelayed;
uint32 spell_id;
- bool withInstant;
+ uint32 withInstant;
} interruptSpellCasting;
struct
@@ -874,7 +886,7 @@ struct SmartAction
struct
{
- uint8 pointId;
+ uint32 pointId;
} MoveToPos;
struct
@@ -895,6 +907,15 @@ struct SmartAction
struct
{
+ uint32 distance;
+ uint32 angle;
+ } setRangedMovement;
+
+ //! Note for any new future actions
+ //! All parameters must have type uint32
+
+ struct
+ {
uint32 param1;
uint32 param2;
uint32 param3;
@@ -1160,7 +1181,9 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] =
{SMART_EVENT_GAME_EVENT_START, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
-
+ {SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
+ {SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE },
+ {SMART_EVENT_ON_SPELLCLICK, SMART_SCRIPT_TYPE_MASK_CREATURE },
};
enum SmartEventFlags
@@ -1175,7 +1198,8 @@ enum SmartEventFlags
SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build
SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset()
- SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3)
+ SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3),
+ SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET)
};
enum SmartCastFlags
@@ -1220,7 +1244,6 @@ struct SmartScriptHolder
bool active;
bool runOnce;
bool enableTimed;
-
};
typedef UNORDERED_MAP<uint32, WayPoint*> WPPath;
@@ -1287,7 +1310,7 @@ class SmartAIMgr
{
if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
return false;
}
return true;
@@ -1297,7 +1320,7 @@ class SmartAIMgr
{
if (max < min)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
return false;
}
return true;
@@ -1307,7 +1330,7 @@ class SmartAIMgr
{
if (pct < -100 || pct > 100)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
return false;
}
return true;
@@ -1317,7 +1340,7 @@ class SmartAIMgr
{
if (!data)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@@ -1327,7 +1350,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetCreatureTemplate(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1337,7 +1360,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetQuestTemplate(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1347,7 +1370,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetGameObjectTemplate(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1357,7 +1380,7 @@ class SmartAIMgr
{
if (!sSpellMgr->GetSpellInfo(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1367,37 +1390,17 @@ class SmartAIMgr
{
if (!sItemStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
}
- /*inline bool IsConditionValid(SmartScriptHolder e, int32 t, int32 v1, int32 v2, int32 v3)
- {
- bool error = false;
- if (t > 0 && v1 >= 0 && v2 >= 0 && v3 >= 0)
- {
- Condition cond;
- cond.mConditionType = ConditionType(t);
- cond.mConditionValue1 = uint32(v1);
- cond.mConditionValue2 = uint32(v2);
- cond.mConditionValue3 = uint32(v3);
- if (!sConditionMgr->isConditionTypeValid(&cond))
- error = true;
- }
- if (error)
- {
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Condition, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
- return false;
- }
- return true;
- }*/
bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
{
if (!sEmotesTextStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1407,7 +1410,7 @@ class SmartAIMgr
{
if (!sEmotesStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1417,7 +1420,7 @@ class SmartAIMgr
{
if (!sAreaTriggerStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1427,7 +1430,7 @@ class SmartAIMgr
{
if (!sSoundEntriesStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 9963ade54f9..8076f800356 100755
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -91,10 +91,15 @@ AccountOpResult DeleteAccount(uint32 accountId)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS);
stmt->setUInt32(0, accountId);
CharacterDatabase.Execute(stmt);
+
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA);
stmt->setUInt32(0, accountId);
CharacterDatabase.Execute(stmt);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN);
+ stmt->setUInt32(0, accountId);
+ CharacterDatabase.Execute(stmt);
+
SQLTransaction trans = LoginDatabase.BeginTransaction();
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT);
@@ -109,6 +114,10 @@ AccountOpResult DeleteAccount(uint32 accountId)
stmt->setUInt32(0, accountId);
trans->Append(stmt);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED);
+ stmt->setUInt32(0, accountId);
+ trans->Append(stmt);
+
LoginDatabase.CommitTransaction(trans);
return AOR_OK;
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 2a9f4212f46..506495469d3 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -75,7 +75,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
{
if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
{
- sLog->outErrorDb("Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType);
return false;
}
@@ -107,7 +107,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
default:
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
{
- sLog->outErrorDb("Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType);
return false;
}
break;
@@ -122,7 +122,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
if (!creature.id || !sObjectMgr->GetCreatureTemplate(creature.id))
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, creature.id);
return false;
}
@@ -130,19 +130,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
if (!classRace.class_id && !classRace.race_id)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.class_id);
return false;
}
if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.race_id);
return false;
}
@@ -150,7 +150,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
if (health.percent < 1 || health.percent > 100)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, health.percent);
return false;
}
@@ -158,7 +158,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
if (player_dead.own_team_flag > 1)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).",
criteria->ID, criteria->requiredType, dataType, player_dead.own_team_flag);
return false;
}
@@ -169,19 +169,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellEntry)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id);
return false;
}
if (aura.effect_idx >= 3)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx);
return false;
}
if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx);
return false;
}
@@ -190,7 +190,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
if (!GetAreaEntryByAreaID(area.id))
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, area.id);
return false;
}
@@ -198,7 +198,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL:
if (level.minlevel > STRONG_MAX_LEVEL)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, level.minlevel);
return false;
}
@@ -206,7 +206,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER:
if (gender.gender > GENDER_NONE)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, gender.gender);
return false;
}
@@ -214,7 +214,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT:
if (!ScriptId)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
@@ -222,7 +222,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
if (difficulty.difficulty >= MAX_DIFFICULTY)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, difficulty.difficulty);
return false;
}
@@ -230,7 +230,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
if (map_players.maxcount <= 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, map_players.maxcount);
return false;
}
@@ -238,7 +238,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if (team.team != ALLIANCE && team.team != HORDE)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, team.team);
return false;
}
@@ -246,7 +246,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK:
if (drunk.state >= MAX_DRUNKEN)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, drunk.state);
return false;
}
@@ -254,7 +254,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY:
if (!sHolidaysStore.LookupEntry(holiday.id))
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, holiday.id);
return false;
}
@@ -264,7 +264,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM:
if (equipped_item.item_quality >= MAX_ITEM_QUALITY)
{
- sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, equipped_item.item_quality);
return false;
}
@@ -272,7 +272,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID:
if (!sMapStore.LookupEntry(map_id.mapId))
{
- sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, map_id.mapId);
return false;
}
@@ -280,25 +280,25 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE:
if (!classRace.class_id && !classRace.race_id)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.class_id);
return false;
}
if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.race_id);
return false;
}
return true;
default:
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType);
return false;
}
}
@@ -391,14 +391,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
Map* map = source->GetMap();
if (!map->IsDungeon())
{
- sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
InstanceScript* instance = ((InstanceMap*)map)->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
@@ -653,7 +653,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
if (!criteria)
{
// we will remove not existed criteria for all characters
- sLog->outError("Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA);
@@ -2029,7 +2029,7 @@ void AchievementMgr::RemoveTimedAchievement(AchievementCriteriaTimedTypes type,
void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
{
- sLog->outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
+ sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::CompletedAchievement(%u)", achievement->ID);
// disable for gamemasters with GM-mode enabled
if (m_player->isGameMaster())
@@ -2201,14 +2201,12 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (sAchievementCriteriaStore.GetNumRows() == 0)
{
- sLog->outErrorDb(">> Loaded 0 achievement criteria.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria.");
return;
}
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
-
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
if (!criteria)
continue;
@@ -2220,8 +2218,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
}
- sLog->outString(">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@@ -2230,8 +2227,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (sAchievementStore.GetNumRows() == 0)
{
- sLog->outString(">> Loaded 0 achievement references.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references.");
return;
}
@@ -2239,7 +2235,6 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId)
{
-
AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId);
if (!achievement || !achievement->refAchievement)
continue;
@@ -2248,8 +2243,11 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
++count;
}
- sLog->outString(">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ // Once Bitten, Twice Shy (10 player) - Icecrown Citadel
+ if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539))
+ const_cast<AchievementEntry*>(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar)
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementCriteriaData()
@@ -2262,8 +2260,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!result)
{
- sLog->outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
return;
}
@@ -2278,7 +2275,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!criteria)
{
- sLog->outErrorDb("Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
continue;
}
@@ -2288,7 +2285,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (strcmp(scriptName, "")) // not empty
{
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
- sLog->outErrorDb("Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
else
scriptId = sObjectMgr->GetScriptId(scriptName);
}
@@ -2391,11 +2388,10 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
}
if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL))
- sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
- sLog->outString(">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadCompletedAchievements()
@@ -2406,8 +2402,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!result)
{
- sLog->outString(">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
return;
}
@@ -2420,7 +2415,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!achievement)
{
// Remove non existent achievements from all characters
- sLog->outError("Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT);
@@ -2434,8 +2429,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
m_allCompletedAchievements.insert(achievementId);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewards()
@@ -2449,8 +2443,7 @@ void AchievementGlobalMgr::LoadRewards()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return;
}
@@ -2463,7 +2456,7 @@ void AchievementGlobalMgr::LoadRewards()
const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry);
if (!pAchievement)
{
- sLog->outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry);
continue;
}
@@ -2478,19 +2471,19 @@ void AchievementGlobalMgr::LoadRewards()
// must be title or mail at least
if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry);
continue;
}
if (pAchievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0)))
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);
if (reward.titleId[0])
{
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]);
if (!titleEntry)
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);
reward.titleId[0] = 0;
}
}
@@ -2500,7 +2493,7 @@ void AchievementGlobalMgr::LoadRewards()
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]);
if (!titleEntry)
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);
reward.titleId[1] = 0;
}
}
@@ -2510,27 +2503,27 @@ void AchievementGlobalMgr::LoadRewards()
{
if (!sObjectMgr->GetCreatureTemplate(reward.sender))
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
reward.sender = 0;
}
}
else
{
if (reward.itemId)
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);
if (!reward.subject.empty())
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);
if (!reward.text.empty())
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);
}
if (reward.itemId)
{
if (!sObjectMgr->GetItemTemplate(reward.itemId))
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);
reward.itemId = 0;
}
}
@@ -2541,8 +2534,7 @@ void AchievementGlobalMgr::LoadRewards()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewardLocales()
@@ -2557,8 +2549,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (!result)
{
- sLog->outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
return;
}
@@ -2570,7 +2561,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (m_achievementRewards.find(entry) == m_achievementRewards.end())
{
- sLog->outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry);
continue;
}
@@ -2584,6 +2575,5 @@ void AchievementGlobalMgr::LoadRewardLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index 528e682e8d4..a0789040e9a 100755
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
@@ -43,8 +43,8 @@ void LoadFromDB()
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
if (!result)
{
- sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!");
+
return;
}
@@ -63,8 +63,8 @@ void LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SaveAddon(AddonInfo const& addon)
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 683a269f508..84b5513b659 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -134,15 +134,6 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
// receiver exist
if (bidder || bidder_accId)
{
- std::ostringstream msgAuctionWonSubject;
- msgAuctionWonSubject << auction->item_template << ":0:" << AUCTION_WON;
-
- std::ostringstream msgAuctionWonBody;
- msgAuctionWonBody.width(16);
- msgAuctionWonBody << std::right << std::hex << auction->owner;
- msgAuctionWonBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
- sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionWon body string : %s", msgAuctionWonBody.str().c_str());
-
// set owner to bidder (to prevent delete item with sender char deleting)
// owner in `data` will set at mail receive and item extracting
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
@@ -157,7 +148,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
bidder->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
}
- MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str())
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_WON), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, 0, 0))
.AddItem(pItem)
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
}
@@ -170,26 +161,8 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist (online or offline)
if (owner || owner_accId)
- {
- std::ostringstream msgAuctionSalePendingSubject;
- msgAuctionSalePendingSubject << auction->item_template << ":0:" << AUCTION_SALE_PENDING;
-
- std::ostringstream msgAuctionSalePendingBody;
- uint32 auctionCut = auction->GetAuctionCut();
-
- time_t distrTime = time(NULL) + sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY);
-
- msgAuctionSalePendingBody.width(16);
- msgAuctionSalePendingBody << std::right << std::hex << auction->bidder;
- msgAuctionSalePendingBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
- msgAuctionSalePendingBody << ':' << auction->deposit << ':' << auctionCut << ":0:";
- msgAuctionSalePendingBody << secsToTimeBitFields(distrTime);
-
- sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str());
-
- MailDraft(msgAuctionSalePendingSubject.str(), msgAuctionSalePendingBody.str())
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_SALE_PENDING), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED);
- }
}
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
@@ -201,20 +174,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
// owner exist
if (owner || owner_accId)
{
- std::ostringstream msgAuctionSuccessfulSubject;
- msgAuctionSuccessfulSubject << auction->item_template << ":0:" << AUCTION_SUCCESSFUL;
-
- std::ostringstream auctionSuccessfulBody;
- uint32 auctionCut = auction->GetAuctionCut();
-
- auctionSuccessfulBody.width(16);
- auctionSuccessfulBody << std::right << std::hex << auction->bidder;
- auctionSuccessfulBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
- auctionSuccessfulBody << ':' << auction->deposit << ':' << auctionCut;
-
- sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str());
-
- uint32 profit = auction->bid + auction->deposit - auctionCut;
+ uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut();
//FIXME: what do if owner offline
if (owner)
@@ -224,7 +184,8 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
//send auction owner notification, bidder must be current!
owner->GetSession()->SendAuctionOwnerNotification(auction);
}
- MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str())
+
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_SUCCESSFUL), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.AddMoney(profit)
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
}
@@ -244,13 +205,10 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
// owner exist
if (owner || owner_accId)
{
- std::ostringstream subject;
- subject << auction->item_template << ":0:" << AUCTION_EXPIRED << ":0:0";
-
if (owner)
owner->GetSession()->SendAuctionOwnerNotification(auction);
- MailDraft(subject.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
.AddItem(pItem)
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
}
@@ -269,13 +227,10 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
// old bidder exist
if (oldBidder || oldBidder_accId)
{
- std::ostringstream msgAuctionOutbiddedSubject;
- msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED << ":0:0";
-
if (oldBidder && newBidder)
oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
- MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.AddMoney(auction->bid)
.SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
}
@@ -293,14 +248,9 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
// bidder exist
if (bidder || bidder_accId)
- {
- std::ostringstream msgAuctionCancelledSubject;
- msgAuctionCancelledSubject << auction->item_template << ":0:" << AUCTION_CANCELLED_TO_BIDDER << ":0:0";
-
- MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, 0))
.AddMoney(auction->bid)
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
- }
}
void AuctionHouseMgr::LoadAuctionItems()
@@ -313,8 +263,8 @@ void AuctionHouseMgr::LoadAuctionItems()
if (!result)
{
- sLog->outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
+
return;
}
@@ -322,7 +272,6 @@ void AuctionHouseMgr::LoadAuctionItems()
do
{
-
Field* fields = result->Fetch();
uint32 item_guid = fields[11].GetUInt32();
@@ -331,7 +280,7 @@ void AuctionHouseMgr::LoadAuctionItems()
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
if (!proto)
{
- sLog->outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
continue;
}
@@ -347,8 +296,8 @@ void AuctionHouseMgr::LoadAuctionItems()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void AuctionHouseMgr::LoadAuctions()
@@ -360,8 +309,8 @@ void AuctionHouseMgr::LoadAuctions()
if (!result)
{
- sLog->outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
+
return;
}
@@ -386,8 +335,8 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
- sLog->outString(">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void AuctionHouseMgr::AddAItem(Item* it)
@@ -655,7 +604,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
Item* item = sAuctionMgr->GetAItem(item_guidlow);
if (!item)
{
- sLog->outError("AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
return false;
}
data << uint32(Id);
@@ -726,25 +675,26 @@ bool AuctionEntry::LoadFromDB(Field* fields)
auctioneer = fields[1].GetUInt32();
item_guidlow = fields[2].GetUInt32();
item_template = fields[3].GetUInt32();
- owner = fields[4].GetUInt32();
- buyout = fields[5].GetUInt32();
- expire_time = fields[6].GetUInt32();
- bidder = fields[7].GetUInt32();
- bid = fields[8].GetUInt32();
- startbid = fields[9].GetUInt32();
- deposit = fields[10].GetUInt32();
+ itemCount = fields[4].GetUInt32();
+ owner = fields[5].GetUInt32();
+ buyout = fields[6].GetUInt32();
+ expire_time = fields[7].GetUInt32();
+ bidder = fields[8].GetUInt32();
+ bid = fields[9].GetUInt32();
+ startbid = fields[10].GetUInt32();
+ deposit = fields[11].GetUInt32();
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
if (!auctioneerData)
{
- sLog->outError("Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
return false;
}
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
- sLog->outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
return false;
}
@@ -752,7 +702,7 @@ bool AuctionEntry::LoadFromDB(Field* fields)
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId);
if (!auctionHouseEntry)
{
- sLog->outError("Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
return false;
}
@@ -760,7 +710,7 @@ bool AuctionEntry::LoadFromDB(Field* fields)
// and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
if (!sAuctionMgr->GetAItem(item_guidlow))
{
- sLog->outError("Auction %u has not a existing item : %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, item_guidlow);
return false;
}
return true;
@@ -784,8 +734,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
if (!expAuctions)
{
- sLog->outString(">> No expired auctions to delete");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete");
+
return;
}
@@ -832,8 +782,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
} while (expAuctions->NextRow());
- sLog->outString(">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
+
}
@@ -847,25 +797,26 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
auctioneer = fields[1].GetUInt32();
item_guidlow = fields[2].GetUInt32();
item_template = fields[3].GetUInt32();
- owner = fields[4].GetUInt32();
- buyout = fields[5].GetUInt32();
- expire_time = fields[6].GetUInt32();
- bidder = fields[7].GetUInt32();
- bid = fields[8].GetUInt32();
- startbid = fields[9].GetUInt32();
- deposit = fields[10].GetUInt32();
+ itemCount = fields[4].GetUInt32();
+ owner = fields[5].GetUInt32();
+ buyout = fields[6].GetUInt32();
+ expire_time = fields[7].GetUInt32();
+ bidder = fields[8].GetUInt32();
+ bid = fields[9].GetUInt32();
+ startbid = fields[10].GetUInt32();
+ deposit = fields[11].GetUInt32();
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
if (!auctioneerData)
{
- sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
return false;
}
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
- sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
return false;
}
@@ -874,9 +825,26 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
if (!auctionHouseEntry)
{
- sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
return false;
}
return true;
}
+
+std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const
+{
+ std::ostringstream strm;
+ strm << item_template << ":0:" << response << ':' << Id << ':' << itemCount;
+ return strm.str();
+}
+
+std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut)
+{
+ std::ostringstream strm;
+ strm.width(16);
+ strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids
+ strm << std::dec << ':' << bid << ':' << buyout;
+ strm << ':' << deposit << ':' << cut;
+ return strm.str();
+}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h
index 190fbcc5107..049440f99d0 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.h
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h
@@ -48,12 +48,24 @@ enum AuctionAction
AUCTION_PLACE_BID = 2
};
+enum MailAuctionAnswers
+{
+ AUCTION_OUTBIDDED = 0,
+ AUCTION_WON = 1,
+ AUCTION_SUCCESSFUL = 2,
+ AUCTION_EXPIRED = 3,
+ AUCTION_CANCELLED_TO_BIDDER = 4,
+ AUCTION_CANCELED = 5,
+ AUCTION_SALE_PENDING = 6
+};
+
struct AuctionEntry
{
uint32 Id;
uint32 auctioneer; // creature low guid
uint32 item_guidlow;
uint32 item_template;
+ uint32 itemCount;
uint32 owner;
uint32 startbid; //maybe useless
uint32 bid;
@@ -74,6 +86,8 @@ struct AuctionEntry
void SaveToDB(SQLTransaction& trans) const;
bool LoadFromDB(Field* fields);
bool LoadFromFieldList(Field* fields);
+ std::string BuildAuctionMailSubject(MailAuctionAnswers response) const;
+ static std::string BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut);
};
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
new file mode 100644
index 00000000000..d159580d189
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -0,0 +1,1110 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Map.h"
+#include "MapManager.h"
+#include "Group.h"
+#include "WorldPacket.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
+#include "GroupMgr.h"
+
+Battlefield::Battlefield()
+{
+ m_Timer = 0;
+ m_IsEnabled = true;
+ m_isActive = false;
+ m_DefenderTeam = TEAM_NEUTRAL;
+
+ m_TypeId = 0;
+ m_BattleId = 0;
+ m_ZoneId = 0;
+ m_MapId = 0;
+ m_MaxPlayer = 0;
+ m_MinPlayer = 0;
+ m_BattleTime = 0;
+ m_NoWarBattleTime = 0;
+ m_TimeForAcceptInvite = 20;
+ m_uiKickDontAcceptTimer = 1000;
+
+ m_uiKickAfkPlayersTimer = 1000;
+
+ m_LastResurectTimer = 30 * IN_MILLISECONDS;
+ m_StartGroupingTimer = 0;
+ m_StartGrouping = false;
+ StalkerGuid = 0;
+}
+
+Battlefield::~Battlefield()
+{
+}
+
+// Called when a player enters the zone
+void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
+{
+ // If battle is started,
+ // If not full of players > invite player to join the war
+ // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
+ if (IsWarTime())
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
+ InvitePlayerToWar(player);
+ else // No more vacant places
+ {
+ // TODO: Send a packet to announce it to player
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ InvitePlayerToQueue(player);
+ }
+ }
+ else
+ {
+ // If time left is < 15 minutes invite player to join queue
+ if (m_Timer <= m_StartGroupingTimer)
+ InvitePlayerToQueue(player);
+ }
+
+ // Add player in the list of player in zone
+ m_players[player->GetTeamId()].insert(player->GetGUID());
+ OnPlayerEnterZone(player);
+}
+
+// Called when a player leave the zone
+void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
+{
+ if (IsWarTime())
+ {
+ // If the player is participating to the battle
+ if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
+ {
+ m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
+ player->GetSession()->SendBfLeaveMessage(m_BattleId);
+ if (Group* group = player->GetGroup()) // Remove the player from the raid group
+ group->RemoveMember(player->GetGUID());
+
+ OnPlayerLeaveWar(player);
+ }
+ }
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ itr->second->HandlePlayerLeave(player);
+
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_players[player->GetTeamId()].erase(player->GetGUID());
+ SendRemoveWorldStates(player);
+ RemovePlayerFromResurrectQueue(player->GetGUID());
+ OnPlayerLeaveZone(player);
+}
+
+bool Battlefield::Update(uint32 diff)
+{
+ if (m_Timer <= diff)
+ {
+ // Battlefield ends on time
+ if (IsWarTime())
+ EndBattle(true);
+ else // Time to start a new battle!
+ StartBattle();
+ }
+ else
+ m_Timer -= diff;
+
+ // Invite players a few minutes before the battle's beginning
+ if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer)
+ {
+ m_StartGrouping = true;
+ InvitePlayersInZoneToQueue();
+ OnStartGrouping();
+ }
+
+ bool objective_changed = false;
+ if (IsWarTime())
+ {
+ if (m_uiKickAfkPlayersTimer <= diff)
+ {
+ m_uiKickAfkPlayersTimer = 1000;
+ KickAfkPlayers();
+ }
+ else
+ m_uiKickAfkPlayersTimer -= diff;
+
+ // Kick players who chose not to accept invitation to the battle
+ if (m_uiKickDontAcceptTimer <= diff)
+ {
+ for (int team = 0; team < 2; team++)
+ for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
+ if ((*itr).second <= time(NULL))
+ KickPlayerFromBattlefield((*itr).first);
+
+ InvitePlayersInZoneToWar();
+ for (int team = 0; team < 2; team++)
+ for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
+ if ((*itr).second <= time(NULL))
+ KickPlayerFromBattlefield((*itr).first);
+
+ m_uiKickDontAcceptTimer = 1000;
+ }
+ else
+ m_uiKickDontAcceptTimer -= diff;
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ if (itr->second->Update(diff))
+ objective_changed = true;
+ }
+
+
+ if (m_LastResurectTimer <= diff)
+ {
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ if (GetGraveyardById(i))
+ m_GraveyardList[i]->Resurrect();
+ m_LastResurectTimer = RESURRECTION_INTERVAL;
+ }
+ else
+ m_LastResurectTimer -= diff;
+
+ return objective_changed;
+}
+
+void Battlefield::InvitePlayersInZoneToQueue()
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ InvitePlayerToQueue(player);
+}
+
+void Battlefield::InvitePlayerToQueue(Player* player)
+{
+ if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer)
+ player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
+}
+
+void Battlefield::InvitePlayersInQueueToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else
+ {
+ //Full
+ }
+ }
+ }
+ m_PlayersInQueue[team].clear();
+ }
+}
+
+void Battlefield::InvitePlayersInZoneToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ continue;
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else // Battlefield is full of players
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ }
+ }
+}
+
+void Battlefield::InvitePlayerToWar(Player* player)
+{
+ if (!player)
+ return;
+
+ // TODO : needed ?
+ if (player->isInFlight())
+ return;
+
+ if (player->InArena() || player->GetBattleground())
+ {
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+ return;
+ }
+
+ // If the player does not match minimal level requirements for the battlefield, kick him
+ if (player->getLevel() < m_MinLevel)
+ {
+ if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ return;
+ }
+
+ // Check if player is not already in war
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite;
+ player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
+}
+
+void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
+{
+ if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
+ StalkerGuid = creature->GetGUID();
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
+}
+
+void Battlefield::KickAfkPlayers()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->isAFK())
+ KickPlayerFromBattlefield(*itr);
+}
+
+void Battlefield::KickPlayerFromBattlefield(uint64 guid)
+{
+ if (Player* player = sObjectAccessor->FindPlayer(guid))
+ if (player->GetZoneId() == GetZoneId())
+ player->TeleportTo(KickPosition);
+}
+
+void Battlefield::StartBattle()
+{
+ if (m_isActive)
+ return;
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ {
+ m_PlayersInWar[team].clear();
+ m_Groups[team].clear();
+ }
+
+ m_Timer = m_BattleTime;
+ m_isActive = true;
+
+ InvitePlayersInZoneToWar();
+ InvitePlayersInQueueToWar();
+
+ DoPlaySoundToAll(BF_START);
+
+ OnBattleStart();
+}
+
+void Battlefield::EndBattle(bool endByTimer)
+{
+ if (!m_isActive)
+ return;
+
+ m_isActive = false;
+
+ m_StartGrouping = false;
+
+ if (!endByTimer)
+ SetDefenderTeam(GetAttackerTeam());
+
+ if (GetDefenderTeam() == TEAM_ALLIANCE)
+ DoPlaySoundToAll(BF_ALLIANCE_WINS);
+ else
+ DoPlaySoundToAll(BF_HORDE_WINS);
+
+ OnBattleEnd(endByTimer);
+
+ // Reset battlefield timer
+ m_Timer = m_NoWarBattleTime;
+ SendInitWorldStatesToAll();
+}
+
+void Battlefield::DoPlaySoundToAll(uint32 SoundID)
+{
+ WorldPacket data;
+ data.Initialize(SMSG_PLAY_SOUND, 4);
+ data << uint32(SoundID);
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+bool Battlefield::HasPlayer(Player* player) const
+{
+ return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end();
+}
+
+// Called in WorldSession::HandleBfQueueInviteResponse
+void Battlefield::PlayerAcceptInviteToQueue(Player* player)
+{
+ // Add player in queue
+ m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
+ // Send notification
+ player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
+}
+
+// Called in WorldSession::HandleBfExitRequest
+void Battlefield::AskToLeaveQueue(Player* player)
+{
+ // Remove player from queue
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+}
+
+// Called in WorldSession::HandleBfEntryInviteResponse
+void Battlefield::PlayerAcceptInviteToWar(Player* player)
+{
+ if (!IsWarTime())
+ return;
+
+ if (AddOrSetPlayerToCorrectBfGroup(player))
+ {
+ player->GetSession()->SendBfEntered(m_BattleId);
+ m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+
+ if (player->isAFK())
+ player->ToggleAFK();
+
+ OnPlayerJoinWar(player); //for scripting
+ }
+}
+
+void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
+{
+ if (spellId > 0)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, uint32(spellId), true);
+ else
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(uint32(-spellId));
+}
+
+void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg)
+{
+ WorldPacket data(SMSG_MESSAGECHAT, 200);
+
+ data << uint8(CHAT_MSG_RAID_BOSS_EMOTE);
+ data << uint32(LANG_UNIVERSAL);
+ data << uint64(0);
+ data << uint32(0); // 2.1.0
+ data << uint32(1);
+ data << uint8(0);
+ data << uint64(0);
+ data << uint32(strlen(msg.c_str()) + 1);
+ data << msg.c_str();
+ data << uint8(0);
+
+ return data;
+}
+
+void Battlefield::SendWarningToAllInZone(uint32 entry)
+{
+ if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
+ if (Creature* stalker = unit->ToCreature())
+ // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
+ sCreatureTextMgr->SendChat(stalker, (uint8) entry, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
+}
+
+/*void Battlefield::SendWarningToAllInWar(int32 entry,...)
+{
+ const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
+ va_list ap;
+ char str [1024];
+ va_start(ap, entry);
+ vsnprintf(str,1024,format, ap);
+ va_end(ap);
+ std::string msg = (std::string)str;
+
+ WorldPacket data = BuildWarningAnnPacket(msg);
+ BroadcastPacketWar(data);
+}*/
+
+void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
+{
+ if (player)
+ if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
+ if (Creature* stalker = unit->ToCreature())
+ sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
+}
+
+void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
+ for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void Battlefield::RegisterZone(uint32 zoneId)
+{
+ sBattlefieldMgr->AddZone(zoneId, this);
+}
+
+void Battlefield::HideNpc(Creature* creature)
+{
+ creature->CombatStop();
+ creature->SetReactState(REACT_PASSIVE);
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ creature->SetPhaseMask(2, true);
+ creature->DisappearAndDie();
+ creature->SetVisible(false);
+}
+
+void Battlefield::ShowNpc(Creature* creature, bool aggressive)
+{
+ creature->SetPhaseMask(1, true);
+ creature->SetVisible(true);
+ creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ if (!creature->isAlive())
+ creature->Respawn(true);
+ if (aggressive)
+ creature->SetReactState(REACT_AGGRESSIVE);
+ else
+ {
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ creature->SetReactState(REACT_PASSIVE);
+ }
+}
+
+// ****************************************************
+// ******************* Group System *******************
+// ****************************************************
+Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (!group->IsFull())
+ return group;
+
+ return NULL;
+}
+
+Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (group->IsMember(guid))
+ return group;
+
+ return NULL;
+}
+
+bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
+{
+ if (!player->IsInWorld())
+ return false;
+
+ if (Group* group = player->GetGroup())
+ group->RemoveMember(player->GetGUID());
+
+ Group* group = GetFreeBfRaid(player->GetTeamId());
+ if (!group)
+ {
+ group = new Group;
+ group->SetBattlefieldGroup(this);
+ group->Create(player);
+ sGroupMgr->AddGroup(group);
+ m_Groups[player->GetTeamId()].insert(group->GetGUID());
+ }
+ else if (group->IsMember(player->GetGUID()))
+ {
+ uint8 subgroup = group->GetMemberGroup(player->GetGUID());
+ player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
+ }
+ else
+ group->AddMember(player);
+
+ return true;
+}
+
+//***************End of Group System*******************
+
+//*****************************************************
+//***************Spirit Guide System*******************
+//*****************************************************
+
+//--------------------
+//-Battlefield Method-
+//--------------------
+BfGraveyard* Battlefield::GetGraveyardById(uint32 id)
+{
+ if (id < m_GraveyardList.size())
+ {
+ if (m_GraveyardList[id])
+ return m_GraveyardList[id];
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u not existed", id);
+ }
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u cant be found", id);
+
+ return NULL;
+}
+
+WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player)
+{
+ BfGraveyard* closestGY = NULL;
+ float maxdist = -1;
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (m_GraveyardList[i])
+ {
+ if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId())
+ continue;
+
+ float dist = m_GraveyardList[i]->GetDistance(player);
+ if (dist < maxdist || maxdist < 0)
+ {
+ closestGY = m_GraveyardList[i];
+ maxdist = dist;
+ }
+ }
+ }
+
+ if (closestGY)
+ return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId());
+
+ return NULL;
+}
+
+void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasNpc(npcGuid))
+ {
+ m_GraveyardList[i]->AddPlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasPlayer(playerGuid))
+ {
+ m_GraveyardList[i]->RemovePlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
+{
+ WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
+ uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
+
+ data << guid << time;
+ ASSERT(player && player->GetSession());
+ player->GetSession()->SendPacket(&data);
+}
+
+// ----------------------
+// - BfGraveyard Method -
+// ----------------------
+BfGraveyard::BfGraveyard(Battlefield* battlefield)
+{
+ m_Bf = battlefield;
+ m_GraveyardId = 0;
+ m_ControlTeam = TEAM_NEUTRAL;
+ m_SpiritGuide[0] = NULL;
+ m_SpiritGuide[1] = NULL;
+ m_ResurrectQueue.clear();
+}
+
+void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
+{
+ m_ControlTeam = startControl;
+ m_GraveyardId = graveyardId;
+}
+
+void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
+{
+ if (!spirit)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "BfGraveyard::SetSpirit: Invalid Spirit.");
+ return;
+ }
+
+ m_SpiritGuide[team] = spirit->GetGUID();
+ spirit->SetReactState(REACT_PASSIVE);
+}
+
+float BfGraveyard::GetDistance(Player* player)
+{
+ const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
+ return player->GetDistance2d(safeLoc->x, safeLoc->y);
+}
+
+void BfGraveyard::AddPlayer(uint64 playerGuid)
+{
+ if (!m_ResurrectQueue.count(playerGuid))
+ {
+ m_ResurrectQueue.insert(playerGuid);
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
+ }
+}
+
+void BfGraveyard::RemovePlayer(uint64 playerGuid)
+{
+ m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
+}
+
+void BfGraveyard::Resurrect()
+{
+ if (m_ResurrectQueue.empty())
+ return;
+
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ // Get player object from his guid
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ // Check if the player is in world and on the good graveyard
+ if (player->IsInWorld())
+ if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
+ spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
+
+ // Resurect player
+ player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
+ player->ResurrectPlayer(1.0f);
+ player->CastSpell(player, 6962, true);
+ player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
+
+ sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID());
+ }
+
+ m_ResurrectQueue.clear();
+}
+
+// For changing graveyard control
+void BfGraveyard::GiveControlTo(TeamId team)
+{
+ // Guide switching
+ // Note: Visiblity changes are made by phasing
+ /*if (m_SpiritGuide[1 - team])
+ m_SpiritGuide[1 - team]->SetVisible(false);
+ if (m_SpiritGuide[team])
+ m_SpiritGuide[team]->SetVisible(true);*/
+
+ m_ControlTeam = team;
+ // Teleport to other graveyard, player witch were on this graveyard
+ RelocateDeadPlayers();
+}
+
+void BfGraveyard::RelocateDeadPlayers()
+{
+ WorldSafeLocsEntry const* closestGrave = NULL;
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ else
+ {
+ closestGrave = m_Bf->GetClosestGraveYard(player);
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ }
+ }
+}
+
+// *******************************************************
+// *************** End Spirit Guide system ***************
+// *******************************************************
+// ********************** Misc ***************************
+// *******************************************************
+
+Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
+{
+ return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team);
+}
+
+Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)
+{
+ //Get map object
+ Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId));
+ if (!map)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
+ return 0;
+ }
+
+ Creature* creature = new Creature;
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
+ delete creature;
+ return NULL;
+ }
+
+ creature->SetHomePosition(x, y, z, o);
+
+ CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
+ if (!cinfo)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry);
+ return NULL;
+ }
+ // force using DB speeds -- do we really need this?
+ creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
+ creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
+
+ // Set creature in world
+ map->AddToMap(creature);
+ creature->setActive(true);
+
+ return creature;
+}
+
+// Method for spawning gameobject on map
+GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
+{
+ // Get map object
+ Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits*
+ if (!map)
+ return 0;
+
+ // Create gameobject
+ GameObject* go = new GameObject;
+ if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
+ delete go;
+ return NULL;
+ }
+
+ // Add to world
+ map->AddToMap(go);
+ go->setActive(true);
+
+ return go;
+}
+
+// *******************************************************
+// ******************* CapturePoint **********************
+// *******************************************************
+
+BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL)
+{
+ m_team = TEAM_NEUTRAL;
+ m_value = 0;
+ m_maxValue = 0;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_capturePointEntry = 0;
+ m_neutralValuePct = 0;
+ m_maxSpeed = 0;
+}
+
+bool BfCapturePoint::HandlePlayerEnter(Player* player)
+{
+ if (m_capturePoint)
+ {
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
+ return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
+}
+
+GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
+{
+ if (m_capturePoint)
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
+
+ GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
+
+ if (current == m_activePlayers[player->GetTeamId()].end())
+ return current; // return end()
+
+ m_activePlayers[player->GetTeamId()].erase(current++);
+ return current;
+}
+
+void BfCapturePoint::SendChangePhase()
+{
+ if (!m_capturePoint)
+ return;
+
+ // send this too, sometimes the slider disappears, dunno why :(
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ // send these updates to only the ones in this objective
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
+ // send this too, sometimes it resets :S
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+}
+
+bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
+{
+ ASSERT(capturePoint);
+
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry());
+
+ m_capturePoint = capturePoint;
+
+ // check info existence
+ GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
+ if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry());
+ return false;
+ }
+
+ // get the needed values from goinfo
+ m_maxValue = goinfo->capturePoint.maxTime;
+ m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
+ m_neutralValuePct = goinfo->capturePoint.neutralPercent;
+ m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100;
+ m_capturePointEntry = capturePoint->GetEntry();
+ if (m_team == TEAM_ALLIANCE)
+ {
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ }
+ else
+ {
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::DelCapturePoint()
+{
+ if (m_capturePoint)
+ {
+ m_capturePoint->SetRespawnTime(0); // not save respawn time
+ m_capturePoint->Delete();
+ m_capturePoint = NULL;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::Update(uint32 diff)
+{
+ if (!m_capturePoint)
+ return false;
+
+ float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ itr = HandlePlayerLeave(player);
+ else
+ ++itr;
+ }
+ else
+ ++itr;
+ }
+ }
+
+ std::list<Player*> players;
+ Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_capturePoint, players, checker);
+ m_capturePoint->VisitNearbyWorldObject(radius, searcher);
+
+ for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
+ if ((*itr)->IsOutdoorPvPActive())
+ if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
+ HandlePlayerEnter(*itr);
+
+ // get the difference of numbers
+ float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
+ if (!fact_diff)
+ return false;
+
+ uint32 Challenger = 0;
+ float maxDiff = m_maxSpeed * diff;
+
+ if (fact_diff < 0)
+ {
+ // horde is in majority, but it's already horde-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
+ return false;
+
+ if (fact_diff < -maxDiff)
+ fact_diff = -maxDiff;
+
+ Challenger = HORDE;
+ }
+ else
+ {
+ // ally is in majority, but it's already ally-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
+ return false;
+
+ if (fact_diff > maxDiff)
+ fact_diff = maxDiff;
+
+ Challenger = ALLIANCE;
+ }
+
+ float oldValue = m_value;
+ TeamId oldTeam = m_team;
+
+ m_OldState = m_State;
+
+ m_value += fact_diff;
+
+ if (m_value < -m_minValue) // red
+ {
+ if (m_value < -m_maxValue)
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ m_team = TEAM_HORDE;
+ }
+ else if (m_value > m_minValue) // blue
+ {
+ if (m_value > m_maxValue)
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ m_team = TEAM_ALLIANCE;
+ }
+ else if (oldValue * m_value <= 0) // grey, go through mid point
+ {
+ // if challenger is ally, then n->a challenge
+ if (Challenger == ALLIANCE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
+ // if challenger is horde, then n->h challenge
+ else if (Challenger == HORDE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+ else // grey, did not go through mid point
+ {
+ // old phase and current are on the same side, so one team challenges the other
+ if (Challenger == ALLIANCE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
+ else if (Challenger == HORDE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+
+ if (m_value != oldValue)
+ SendChangePhase();
+
+ if (m_OldState != m_State)
+ {
+ //sLog->outError(LOG_FILTER_BATTLEFIELD, "%u->%u", m_OldState, m_State);
+ if (oldTeam != m_team)
+ ChangeTeam(oldTeam);
+ return true;
+ }
+
+ return false;
+}
+
+void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
+{
+ uint8 team;
+ switch (m_State)
+ {
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE:
+ team = 0;
+ break;
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE:
+ team = 1;
+ break;
+ default:
+ return;
+ }
+
+ // send to all players present in the area
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->KilledMonsterCredit(id, guid);
+}
+
+bool BfCapturePoint::IsInsideObjective(Player* player) const
+{
+ return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end();
+}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
new file mode 100644
index 00000000000..5fa8d6b1bc8
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -0,0 +1,431 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_H_
+#define BATTLEFIELD_H_
+
+#include "Utilities/Util.h"
+#include "SharedDefines.h"
+#include "ZoneScript.h"
+#include "WorldPacket.h"
+#include "GameObject.h"
+#include "Battleground.h"
+#include "ObjectAccessor.h"
+
+enum BattlefieldTypes
+{
+ BATTLEFIELD_WG, // Wintergrasp
+ BATTLEFIELD_TB, // Tol Barad (cataclysm)
+};
+
+enum BattlefieldIDs
+{
+ BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
+};
+
+enum BattlefieldObjectiveStates
+{
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE,
+};
+
+enum BattlefieldSounds
+{
+ BF_HORDE_WINS = 8454,
+ BF_ALLIANCE_WINS = 8455,
+ BF_START = 3439
+};
+
+enum BattlefieldTimers
+{
+ BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000
+};
+
+// some class predefs
+class Player;
+class GameObject;
+class WorldPacket;
+class Creature;
+class Unit;
+
+class Battlefield;
+class BfGraveyard;
+
+typedef std::set<uint64> GuidSet;
+typedef std::vector<BfGraveyard*> GraveyardVect;
+typedef std::map<uint64, uint32> PlayerTimerMap;
+
+class BfCapturePoint
+{
+ public:
+ BfCapturePoint(Battlefield* bf);
+
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ // Send world state update to all players present
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ // Send kill notify to players in the controlling faction
+ void SendObjectiveComplete(uint32 id, uint64 guid);
+
+ // Used when player is activated/inactivated in the area
+ virtual bool HandlePlayerEnter(Player* player);
+ virtual GuidSet::iterator HandlePlayerLeave(Player* player);
+ //virtual void HandlePlayerActivityChanged(Player* player);
+
+ // Checks if player is in range of a capture credit marker
+ bool IsInsideObjective(Player* player) const;
+
+ // Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
+ virtual bool Update(uint32 diff);
+ virtual void ChangeTeam(TeamId /*oldTeam*/) {}
+ virtual void SendChangePhase();
+
+ bool SetCapturePointData(GameObject* capturePoint);
+ GameObject* GetCapturePointGo() { return m_capturePoint; }
+
+ TeamId GetTeamId() { return m_team; }
+ protected:
+ bool DelCapturePoint();
+
+ // active Players in the area of the objective, 0 - alliance, 1 - horde
+ GuidSet m_activePlayers[2];
+
+ // Total shift needed to capture the objective
+ float m_maxValue;
+ float m_minValue;
+
+ // Maximum speed of capture
+ float m_maxSpeed;
+
+ // The status of the objective
+ float m_value;
+ TeamId m_team;
+
+ // Objective states
+ BattlefieldObjectiveStates m_OldState;
+ BattlefieldObjectiveStates m_State;
+
+ // Neutral value on capture bar
+ uint32 m_neutralValuePct;
+
+ // Pointer to the Battlefield this objective belongs to
+ Battlefield* m_Bf;
+
+ // Capture point entry
+ uint32 m_capturePointEntry;
+
+ // Gameobject related to that capture point
+ GameObject* m_capturePoint;
+};
+
+class BfGraveyard
+{
+ public:
+ BfGraveyard(Battlefield* Bf);
+
+ // Method to changing who controls the graveyard
+ void GiveControlTo(TeamId team);
+ TeamId GetControlTeamId() { return m_ControlTeam; }
+
+ // Find the nearest graveyard to a player
+ float GetDistance(Player* player);
+
+ // Initialize the graveyard
+ void Initialize(TeamId startcontrol, uint32 gy);
+
+ // Set spirit service for the graveyard
+ void SetSpirit(Creature* spirit, TeamId team);
+
+ // Add a player to the graveyard
+ void AddPlayer(uint64 player_guid);
+
+ // Remove a player from the graveyard
+ void RemovePlayer(uint64 player_guid);
+
+ // Resurrect players
+ void Resurrect();
+
+ // Move players waiting to that graveyard on the nearest one
+ void RelocateDeadPlayers();
+
+ // Check if this graveyard has a spirit guide
+ bool HasNpc(uint64 guid)
+ {
+ if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
+ return false;
+
+ if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) ||
+ !sObjectAccessor->FindUnit(m_SpiritGuide[1]))
+ return false;
+
+ return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
+ }
+
+ // Check if a player is in this graveyard's ressurect queue
+ bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
+
+ // Get the graveyard's ID.
+ uint32 GetGraveyardId() { return m_GraveyardId; }
+
+ protected:
+ TeamId m_ControlTeam;
+ uint32 m_GraveyardId;
+ uint64 m_SpiritGuide[2];
+ GuidSet m_ResurrectQueue;
+ Battlefield* m_Bf;
+};
+
+class Battlefield : public ZoneScript
+{
+ friend class BattlefieldMgr;
+
+ public:
+ /// Constructor
+ Battlefield();
+ /// Destructor
+ virtual ~Battlefield();
+
+ /// typedef of map witch store capturepoint and the associate gameobject entry
+ typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
+
+ /// Call this to init the Battlefield
+ virtual bool SetupBattlefield() { return true; }
+
+ /// Generate packet which contain all worldstatedata of area
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ /// Update data of a worldstate to all players present in zone
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ /**
+ * \brief Called every time for update bf data and time
+ * - Update timer for start/end battle
+ * - Invite player in zone to queue m_StartGroupingTimer minutes before start
+ * - Kick Afk players
+ * \param diff : time ellapsed since last call (in ms)
+ */
+ virtual bool Update(uint32 diff);
+
+ /// Invite all players in zone to join the queue, called x minutes before battle start in Update()
+ void InvitePlayersInZoneToQueue();
+ /// Invite all players in queue to join battle on battle start
+ void InvitePlayersInQueueToWar();
+ /// Invite all players in zone to join battle on battle start
+ void InvitePlayersInZoneToWar();
+
+ /// Called when a Unit is kill in battlefield zone
+ virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
+
+ uint32 GetTypeId() { return m_TypeId; }
+ uint32 GetZoneId() { return m_ZoneId; }
+
+ void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
+
+ /// Return true if battle is start, false if battle is not started
+ bool IsWarTime() { return m_isActive; }
+
+ /// Enable or Disable battlefield
+ void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
+ /// Return if battlefield is enable
+ bool IsEnabled() { return m_IsEnabled; }
+
+ /**
+ * \brief Kick player from battlefield and teleport him to kick-point location
+ * \param guid : guid of player who must be kick
+ */
+ void KickPlayerFromBattlefield(uint64 guid);
+
+ /// Called when player (player) enter in zone
+ void HandlePlayerEnterZone(Player* player, uint32 zone);
+ /// Called when player (player) leave the zone
+ void HandlePlayerLeaveZone(Player* player, uint32 zone);
+
+ // All-purpose data storage 64 bit
+ virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; }
+ virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
+
+ // All-purpose data storage 32 bit
+ virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; }
+ virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
+ virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
+
+ // Battlefield - generic methods
+ TeamId GetDefenderTeam() { return m_DefenderTeam; }
+ TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
+ TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
+ void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
+
+ // Group methods
+ /**
+ * \brief Find a not full battlefield group, if there is no, create one
+ * \param TeamId : Id of player team for who we search a group (player->GetTeamId())
+ */
+ Group* GetFreeBfRaid(TeamId TeamId);
+ /// Return battlefield group where player is.
+ Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
+ /// Force player to join a battlefield group
+ bool AddOrSetPlayerToCorrectBfGroup(Player* player);
+
+ // Graveyard methods
+ // Find which graveyard the player must be teleported to to be resurrected by spiritguide
+ WorldSafeLocsEntry const * GetClosestGraveYard(Player* player);
+
+ virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
+ void RemovePlayerFromResurrectQueue(uint64 player_guid);
+ void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
+ BfGraveyard* GetGraveyardById(uint32 id);
+
+ // Misc methods
+ Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
+ Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
+ GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
+
+ // Script-methods
+
+ /// Called on start
+ virtual void OnBattleStart() {};
+ /// Called at the end of battle
+ virtual void OnBattleEnd(bool /*endByTimer*/) {};
+ /// Called x minutes before battle start when player in zone are invite to join queue
+ virtual void OnStartGrouping() {};
+ /// Called when a player accept to join the battle
+ virtual void OnPlayerJoinWar(Player* /*player*/) {};
+ /// Called when a player leave the battle
+ virtual void OnPlayerLeaveWar(Player* /*player*/) {};
+ /// Called when a player leave battlefield zone
+ virtual void OnPlayerLeaveZone(Player* /*player*/) {};
+ /// Called when a player enter in battlefield zone
+ virtual void OnPlayerEnterZone(Player* /*player*/) {};
+
+ WorldPacket BuildWarningAnnPacket(std::string msg);
+ void SendWarningToAllInZone(uint32 entry);
+ //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
+ void SendWarningToPlayer(Player* player, uint32 entry);
+
+ void PlayerAcceptInviteToQueue(Player* player);
+ void PlayerAcceptInviteToWar(Player* player);
+ uint32 GetBattleId() { return m_BattleId; }
+ void AskToLeaveQueue(Player* player);
+
+ virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
+
+ /// Send all worldstate data to all player in zone.
+ virtual void SendInitWorldStatesToAll() {};
+
+ /// Return if we can use mount in battlefield
+ bool CanFlyIn() { return !m_isActive; }
+
+ void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
+
+ void StartBattle();
+ void EndBattle(bool endByTimer);
+
+ void HideNpc(Creature* creature);
+ void ShowNpc(Creature* creature, bool aggressive);
+
+ GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
+
+ uint32 GetTimer() { return m_Timer; }
+ void SetTimer(uint32 timer) { m_Timer = timer; }
+
+ void DoPlaySoundToAll(uint32 SoundID);
+
+ void InvitePlayerToQueue(Player* player);
+ void InvitePlayerToWar(Player* player);
+
+ void InitStalker(uint32 entry, float x, float y, float z, float o);
+
+ protected:
+ uint64 StalkerGuid;
+ uint32 m_Timer; // Global timer for event
+ bool m_IsEnabled;
+ bool m_isActive;
+ TeamId m_DefenderTeam;
+
+ // Map of the objectives belonging to this OutdoorPvP
+ BfCapturePointMap m_capturePoints;
+
+ // Players info maps
+ GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
+ GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
+ GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
+ PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
+ PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
+
+ // Variables that must exist for each battlefield
+ uint32 m_TypeId; // See enum BattlefieldTypes
+ uint32 m_BattleId; // BattleID (for packet)
+ uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
+ uint32 m_MapId; // MapId where is Battlefield
+ uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
+ uint32 m_MinPlayer; // Minimum number of player for Battlefield start
+ uint32 m_MinLevel; // Required level to participate at Battlefield
+ uint32 m_BattleTime; // Length of a battle
+ uint32 m_NoWarBattleTime; // Time between two battles
+ uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
+ uint32 m_TimeForAcceptInvite;
+ uint32 m_uiKickDontAcceptTimer;
+ WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
+
+ uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
+
+ // 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_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
+
+ GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
+
+ std::vector<uint64> m_Data64;
+ std::vector<uint32> m_Data32;
+
+ void KickAfkPlayers();
+
+ // use for switch off all worldstate for client
+ virtual void SendRemoveWorldStates(Player* /*player*/) {}
+
+ // use for send a packet for all player list
+ void BroadcastPacketToZone(WorldPacket& data) const;
+ void BroadcastPacketToQueue(WorldPacket& data) const;
+ void BroadcastPacketToWar(WorldPacket& data) const;
+
+ // CapturePoint system
+ void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
+
+ BfCapturePoint* GetCapturePoint(uint32 lowguid) const
+ {
+ Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
+ if (itr != m_capturePoints.end())
+ return itr->second;
+ return NULL;
+ }
+
+ void RegisterZone(uint32 zoneid);
+ bool HasPlayer(Player* player) const;
+ void TeamCastSpell(TeamId team, int32 spellId);
+};
+
+#endif
diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp
new file mode 100644
index 00000000000..09c6f18f796
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldHandler.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Common.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Opcodes.h"
+
+//This send to player windows for invite player to join the war
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(time) Time in second that the player have for accept
+void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
+{
+ //Send packet
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint32((time(NULL) + p_time));
+
+ //Sending the packet to player
+ SendPacket(&data);
+}
+
+//This send invitation to player to join the queue
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
+
+ data << uint32(BattleId);
+ data << uint8(1); //warmup ? used ?
+
+ //Sending packet to player
+ SendPacket(&data);
+}
+
+//This send packet for inform player that he join queue
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(CanQueue) if able to queue
+//Param4:(Full) on log in is full
+void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
+ data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
+ data << uint8(1); //Warmup
+ SendPacket(&data);
+}
+
+//This is call when player accept to join war
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfEntered(uint32 BattleId)
+{
+// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
+ data << uint32(BattleId);
+ data << uint8(1); //unk
+ data << uint8(1); //unk
+ data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK
+ SendPacket(&data);
+}
+
+void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
+ data << uint32(BattleId);
+ data << uint8(reason);//byte Reason
+ data << uint8(2);//byte BattleStatus
+ data << uint8(0);//bool Relocated
+ SendPacket(&data);
+}
+
+//Send by client when he click on accept for queue
+void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recv_data >> BattleId >> Accepted;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToQueue(_player);
+ }
+}
+
+//Send by client on clicking in accept or refuse of invitation windows for join game
+void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recv_data >> BattleId >> Accepted;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ //If player accept invitation
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToWar(_player);
+ }
+ else
+ {
+ if (_player->GetZoneId() == Bf->GetZoneId())
+ Bf->KickPlayerFromBattlefield(_player->GetGUID());
+ }
+}
+
+void WorldSession::HandleBfExitRequest(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+
+ recv_data >> BattleId;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ Bf->AskToLeaveQueue(_player);
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
new file mode 100644
index 00000000000..6122b25e8e8
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BattlefieldMgr.h"
+#include "Zones/BattlefieldWG.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+
+BattlefieldMgr::BattlefieldMgr()
+{
+ m_UpdateTimer = 0;
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr");
+}
+
+BattlefieldMgr::~BattlefieldMgr()
+{
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr");
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ delete *itr;
+}
+
+void BattlefieldMgr::InitBattlefield()
+{
+ Battlefield* pBf = new BattlefieldWG;
+ // respawn, init variables
+ if (!pBf->SetupBattlefield())
+ {
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated.");
+ }
+
+ /* For Cataclysm: Tol Barad
+ pBf = new BattlefieldTB;
+ // respawn, init variables
+ if(!pBf->SetupBattlefield())
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
+ } */
+}
+
+void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
+{
+ m_BattlefieldMap[zoneid] = handle;
+}
+
+void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
+ return;
+
+ itr->second->HandlePlayerEnterZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ // teleport: remove once in removefromworld, once in updatezone
+ if (!itr->second->HasPlayer(player))
+ return;
+ itr->second->HandlePlayerLeaveZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ {
+ // no handle for this zone, return
+ return NULL;
+ }
+ if (!itr->second->IsEnabled())
+ return NULL;
+ return itr->second;
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
+{
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ {
+ if ((*itr)->GetBattleId() == battleid)
+ return (*itr);
+ }
+ return NULL;
+}
+
+void BattlefieldMgr::Update(uint32 diff)
+{
+ m_UpdateTimer += diff;
+ if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
+ {
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ if ((*itr)->IsEnabled())
+ (*itr)->Update(m_UpdateTimer);
+ m_UpdateTimer = 0;
+ }
+}
+
+ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
+ if (itr != m_BattlefieldMap.end())
+ return itr->second;
+ else
+ return NULL;
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h
new file mode 100644
index 00000000000..4ee37e424fd
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_MGR_H_
+#define BATTLEFIELD_MGR_H_
+
+#include "Battlefield.h"
+#include "ace/Singleton.h"
+
+class Player;
+class GameObject;
+class Creature;
+class ZoneScript;
+struct GossipMenuItems;
+
+// class to handle player enter / leave / areatrigger / GO use events
+class BattlefieldMgr
+{
+ public:
+ // ctor
+ BattlefieldMgr();
+ // dtor
+ ~BattlefieldMgr();
+
+ // create battlefield events
+ void InitBattlefield();
+ // called when a player enters an battlefield area
+ void HandlePlayerEnterZone(Player * player, uint32 areaflag);
+ // called when player leaves an battlefield area
+ void HandlePlayerLeaveZone(Player * player, uint32 areaflag);
+ // called when player resurrects
+ void HandlePlayerResurrects(Player * player, uint32 areaflag);
+ // return assigned battlefield
+ Battlefield *GetBattlefieldToZoneId(uint32 zoneid);
+ Battlefield *GetBattlefieldByBattleId(uint32 battleid);
+
+ ZoneScript *GetZoneScript(uint32 zoneId);
+
+ void AddZone(uint32 zoneid, Battlefield * handle);
+
+ void Update(uint32 diff);
+
+ void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
+
+ bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
+
+ void HandleDropFlag(Player * player, uint32 spellId);
+
+ typedef std::vector < Battlefield * >BattlefieldSet;
+ typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
+ private:
+ // contains all initiated battlefield events
+ // used when initing / cleaning up
+ BattlefieldSet m_BattlefieldSet;
+ // maps the zone ids to an battlefield event
+ // used in player event handling
+ BattlefieldMap m_BattlefieldMap;
+ // update interval
+ uint32 m_UpdateTimer;
+};
+
+#define sBattlefieldMgr ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance()
+
+#endif
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
new file mode 100644
index 00000000000..634b1bb2cea
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -0,0 +1,1097 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// TODO: Implement proper support for vehicle+player teleportation
+// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor
+// TODO: Add proper implement of achievement
+
+#include "ObjectMgr.h"
+#include "BattlefieldWG.h"
+#include "SpellAuras.h"
+#include "Vehicle.h"
+
+enum WintergrastData
+{
+ BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp
+ BATTLEFIELD_WG_MAPID = 571, // Northrend
+};
+
+enum WGVehicles
+{
+ NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312,
+ NPC_WG_SEIGE_ENGINE_HORDE = 32627,
+ NPC_WG_DEMOLISHER = 28094,
+ NPC_WG_CATAPULT = 27881,
+};
+
+bool BattlefieldWG::SetupBattlefield()
+{
+ InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
+
+ m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes
+ m_BattleId = BATTLEFIELD_BATTLEID_WG;
+ m_ZoneId = BATTLEFIELD_WG_ZONEID;
+ m_MapId = BATTLEFIELD_WG_MAPID;
+
+ m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
+ m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
+ m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
+ m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
+ m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;
+
+ m_TimeForAcceptInvite = 20;
+ m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS;
+ m_StartGrouping = false;
+
+ m_tenacityStack = 0;
+
+ KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
+ KickPosition.m_mapId = m_MapId;
+
+ RegisterZone(m_ZoneId);
+
+ m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);
+
+ m_saveTimer = 60000;
+
+ // Init GraveYards
+ SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);
+
+ // Load from db
+ if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
+ && (sWorld->getWorldState(ClockWorldState[0]) == 0))
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
+ sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
+ }
+
+ m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
+ m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));
+
+ m_Timer = sWorld->getWorldState(ClockWorldState[0]);
+ if (m_isActive)
+ {
+ m_isActive = false;
+ m_Timer = m_RestartAfterCrash;
+ }
+
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
+ {
+ BfGraveyardWG* graveyard = new BfGraveyardWG(this);
+
+ // When between games, the graveyard is controlled by the defending team
+ if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
+ graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
+ else
+ graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
+
+ graveyard->SetTextId(WGGraveYard[i].textid);
+ m_GraveyardList[i] = graveyard;
+ }
+
+
+ // Spawn workshop creatures and gameobjects
+ for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
+ {
+ WGWorkshop* workshop = new WGWorkshop(this, i);
+ if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ workshop->GiveControlTo(GetAttackerTeam(), true);
+ else
+ workshop->GiveControlTo(GetDefenderTeam(), true);
+
+ // Note: Capture point is added once the gameobject is created.
+ WorkshopsList.insert(workshop);
+ }
+
+ // Spawn NPCs in the defender's keep, both Horde and Alliance
+ for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
+ {
+ // Horde npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
+ KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
+ // Alliance npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
+ KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Hide NPCs from the Attacker's team in the keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ // Spawn Horde NPCs outside the keep
+ for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
+ OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
+
+ // Spawn Alliance NPCs outside the keep
+ for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
+ OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+
+ // Hide units outside the keep that are defenders
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ // Spawn turrets and hide them per default
+ for (uint8 i = 0; i < WG_MAX_TURRET; i++)
+ {
+ Position towerCannonPos;
+ WGTurret[i].GetPosition(&towerCannonPos);
+ if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
+ {
+ CanonList.insert(creature->GetGUID());
+ HideNpc(creature);
+ }
+ }
+
+ // Spawn all gameobjects
+ for (uint8 i = 0; i < WG_MAX_OBJ; i++)
+ {
+ GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o);
+ BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
+ b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
+ BuildingsInZone.insert(b);
+ }
+
+ // Spawning portal defender
+ for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
+ {
+ GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
+ DefenderPortalList.insert(go);
+ go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ }
+
+ // Spawn banners in the keep
+ for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++)
+ {
+ if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
+ {
+ go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY);
+ m_KeepGameObject[1].insert(go);
+ }
+ if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
+ {
+ go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
+ m_KeepGameObject[0].insert(go);
+ }
+ }
+
+ // Show defender banner in keep
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide attackant banner in keep
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ UpdateCounterVehicle(true);
+ return true;
+}
+
+bool BattlefieldWG::Update(uint32 diff)
+{
+ bool m_return = Battlefield::Update(diff);
+ if (m_saveTimer <= diff)
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive);
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam);
+ sWorld->setWorldState(ClockWorldState[0], m_Timer);
+ m_saveTimer = 60 * IN_MILLISECONDS;
+ }
+ else
+ m_saveTimer -= diff;
+
+ return m_return;
+}
+
+void BattlefieldWG::OnBattleStart()
+{
+ // Spawn titan relic
+ m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
+ if (m_titansRelic)
+ {
+ // Update faction of relic, only attacker can click on
+ m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
+ // Set in use (not allow to click on before last door is broken)
+ m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ }
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic.");
+
+
+ // Update tower visibility and update faction
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ ShowNpc(creature, true);
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ }
+ }
+ }
+
+ // Rebuild all wall
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (*itr)
+ {
+ (*itr)->Rebuild();
+ (*itr)->UpdateTurretAttack(false);
+ }
+ }
+
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0);
+
+ // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ (*itr)->UpdateGraveyardAndWorkshop();
+
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ // Kick player in orb room, TODO: offline player ?
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ float x, y, z;
+ player->GetPosition(x, y, z);
+ if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
+ player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
+ SendInitWorldStatesTo(player);
+ }
+ }
+ // Initialize vehicle counter
+ UpdateCounterVehicle(true);
+ // Send start warning to all players
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
+}
+
+void BattlefieldWG::UpdateCounterVehicle(bool init)
+{
+ if (init)
+ {
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0);
+ }
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0);
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->teamControl == TEAM_ALLIANCE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4);
+ else if (workshop->teamControl == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4);
+ }
+ }
+
+ UpdateVehicleCountWG();
+}
+
+void BattlefieldWG::OnBattleEnd(bool endByTimer)
+{
+ // Remove relic
+ if (m_titansRelic)
+ m_titansRelic->RemoveFromWorld();
+ m_titansRelic = NULL;
+
+ // Remove turret
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (!endByTimer)
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ HideNpc(creature);
+ }
+ }
+ }
+
+ if (!endByTimer) // One player triggered the relic
+ {
+ // Change all npc in keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ ShowNpc(creature, true);
+
+ // Change all npc out of keep
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ ShowNpc(creature, true);
+ }
+
+ // Update all graveyard, control is to defender when no wartime
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
+ if (BfGraveyard* graveyard = GetGraveyardById(i))
+ graveyard->GiveControlTo(GetDefenderTeam());
+
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Update portal defender faction
+ for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
+ (*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+
+ // Saving data
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ (*itr)->Save();
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ (*itr)->Save();
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
+ player->CastSpell(player, SPELL_VICTORY_REWARD, true);
+ // Send Wintergrasp victory achievement
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player);
+ // Award achievement for succeeding in Wintergrasp in 10 minutes or less
+ if (!endByTimer && GetTimer() <= 10000)
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player);
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ RemoveAurasFromPlayer(player);
+
+ m_PlayersInWar[team].clear();
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ if (creature->IsVehicle())
+ creature->GetVehicleKit()->Dismiss();
+
+ m_vehicles[team].clear();
+ }
+
+ if (!endByTimer)
+ {
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID());
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ }
+ }
+ }
+ }
+
+ if (!endByTimer) // win alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
+ else // defend alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
+}
+
+// *******************************************************
+// ******************* Reward System *********************
+// *******************************************************
+void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/)
+{
+ AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement);
+
+ if (!achievementEntry)
+ return;
+
+ switch (achievement)
+ {
+ case ACHIEVEMENTS_WIN_WG_100:
+ {
+ // player->GetAchievementMgr().UpdateAchievementCriteria();
+ }
+ default:
+ {
+ if (player)
+ player->CompletedAchievement(achievementEntry);
+ break;
+ }
+ }
+
+}
+
+void BattlefieldWG::OnStartGrouping()
+{
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
+}
+
+uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId)
+{
+ switch (areaId)
+ {
+ case AREA_WINTERGRASP_FORTRESS:
+ return BATTLEFIELD_WG_GY_KEEP;
+ case AREA_THE_SUNKEN_RING:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NE;
+ case AREA_THE_BROKEN_TEMPLATE:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NW;
+ case AREA_WESTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SW;
+ case AREA_EASTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SE;
+ case AREA_WINTERGRASP:
+ return BATTLEFIELD_WG_GY_ALLIANCE;
+ case AREA_THE_CHILLED_QUAGMIRE:
+ return BATTLEFIELD_WG_GY_HORDE;
+ default:
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
+ break;
+ }
+
+ return 0;
+}
+
+void BattlefieldWG::OnCreatureCreate(Creature* creature)
+{
+ // Accessing to db spawned creatures
+ switch (creature->GetEntry())
+ {
+ case NPC_DWARVEN_SPIRIT_GUIDE:
+ case NPC_TAUNKA_SPIRIT_GUIDE:
+ {
+ TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
+ uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId());
+ if (m_GraveyardList[graveyardId])
+ m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
+ break;
+ }
+ }
+
+ // untested code - not sure if it is valid.
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ if (!creature->ToTempSummon()->GetSummonerGUID() || !sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID()))
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ Player* creator = sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
+ TeamId team = creator->GetTeamId();
+
+ if (team == TEAM_HORDE)
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
+ creature->AddAura(SPELL_HORDE_FLAG, creature);
+ creature->setFaction(creator->getFaction());
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
+ creature->AddAura(SPELL_ALLIANCE_FLAG, creature);
+ creature->setFaction(creator->getFaction());
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ }
+
+ creature->CastSpell(creator, SPELL_GRAB_PASSENGER, true);
+ break;
+ }
+ }
+ }
+}
+
+void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
+{
+/* possibly can be used later
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ uint8 team;
+ if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
+ team = TEAM_ALLIANCE;
+ else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
+ team = TEAM_HORDE;
+ else
+ return;
+
+ m_vehicles[team].erase(creature->GetGUID());
+ if (team == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ UpdateVehicleCountWG();
+
+ break;
+ }
+ }
+ }*/
+}
+
+void BattlefieldWG::OnGameObjectCreate(GameObject* go)
+{
+ bool isWorkshop = false;
+ uint8 workshopId = 0;
+
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FACTORY_BANNER_NE:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_NW:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NW;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SE:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SW:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SW;
+ break;
+
+ }
+
+ if (!isWorkshop)
+ return;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->workshopId == workshopId)
+ {
+ WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam());
+
+ capturePoint->SetCapturePointData(go);
+ capturePoint->LinkToWorkshop(workshop);
+ AddCapturePoint(capturePoint);
+ break;
+ }
+ }
+ }
+}
+
+// Called when player kill a unit in wg zone
+void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
+{
+ if (killer == victim)
+ return;
+
+ bool again = false;
+ TeamId killerTeam = killer->GetTeamId();
+
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->GetDistance2d(killer) < 40)
+ PromotePlayer(player);
+ return;
+ }
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
+ itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (victim->GetEntry() == creature->GetEntry() && !again)
+ {
+ again = true;
+ for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
+ if (Player* player = sObjectAccessor->FindPlayer(*iter))
+ if (player->GetDistance2d(killer) < 40.0f)
+ PromotePlayer(player);
+ }
+ }
+ }
+ }
+ // TODO:Recent PvP activity worldstate
+}
+
+bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
+{
+ for (uint32 itr = 0; itr < 2; ++itr)
+ {
+ if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end())
+ {
+ m_vehicles[itr].erase(vehicle->GetGUID());
+ if (itr == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ return true;
+ }
+ }
+ return false;
+}
+
+void BattlefieldWG::OnUnitDeath(Unit* unit)
+{
+ if (IsWarTime())
+ if (unit->IsVehicle())
+ if (FindAndRemoveVehicleFromList(unit))
+ UpdateVehicleCountWG();
+}
+
+// Update rank for player
+void BattlefieldWG::PromotePlayer(Player* killer)
+{
+ if (!m_isActive)
+ return;
+ // Updating rank of player
+ if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_RECRUIT);
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_RECRUIT, true);
+ }
+ else if (Aura* aur = killer->GetAura(SPELL_CORPORAL))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_CORPORAL);
+ killer->CastSpell(killer, SPELL_LIEUTENANT, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ }
+}
+
+void BattlefieldWG::RemoveAurasFromPlayer(Player* player)
+{
+ player->RemoveAurasDueToSpell(SPELL_RECRUIT);
+ player->RemoveAurasDueToSpell(SPELL_CORPORAL);
+ player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
+ player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
+ player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+ player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
+ player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
+}
+
+void BattlefieldWG::OnPlayerJoinWar(Player* player)
+{
+ RemoveAurasFromPlayer(player);
+
+ player->CastSpell(player, SPELL_RECRUIT, true);
+
+ if (player->GetZoneId() != m_ZoneId)
+ {
+ if (player->GetTeamId() == GetDefenderTeam())
+ player->TeleportTo(571, 5345, 2842, 410, 3.14f);
+ else
+ {
+ if (player->GetTeamId() == TEAM_HORDE)
+ player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f);
+ else
+ player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f);
+ }
+ }
+
+ UpdateTenacity();
+
+ if (player->GetTeamId() == GetAttackerTeam())
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ SendInitWorldStatesTo(player);
+}
+
+void BattlefieldWG::OnPlayerLeaveWar(Player* player)
+{
+ // Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG
+ if (!player->GetSession()->PlayerLogout())
+ {
+ if (player->GetVehicle()) // Remove vehicle of player if he go out.
+ player->GetVehicle()->Dismiss();
+ RemoveAurasFromPlayer(player);
+ }
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerLeaveZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerEnterZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ // Send worldstate to player
+ SendInitWorldStatesTo(player);
+}
+
+uint32 BattlefieldWG::GetData(uint32 data)
+{
+ switch (data)
+ {
+ // Used to determine when the phasing spells must be casted
+ // See: SpellArea::IsFitToRequirements
+ case AREA_THE_SUNKEN_RING:
+ case AREA_THE_BROKEN_TEMPLATE:
+ case AREA_WESTPARK_WORKSHOP:
+ case AREA_EASTPARK_WORKSHOP:
+ // Graveyards and Workshops are controlled by the same team.
+ if (m_GraveyardList[GetSpiritGraveyardId(data)])
+ return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
+ }
+
+ return Battlefield::GetData(data);
+}
+
+// Method sending worldsate to player
+WorldPacket BattlefieldWG::BuildInitWorldStates()
+{
+ WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8)));
+
+ data << uint32(m_MapId);
+ data << uint32(m_ZoneId);
+ data << uint32(0);
+ data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkshopsList.size());
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); // Note: cleanup these two, their names look awkward
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime()? 1 : 0);
+
+ for (uint32 i = 0; i < 2; ++i)
+ data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000));
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H);
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A);
+
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ data << (*itr)->m_WorldState << (*itr)->m_State;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state;
+
+ return data;
+}
+
+void BattlefieldWG::SendInitWorldStatesTo(Player* player)
+{
+ WorldPacket data = BuildInitWorldStates();
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::SendInitWorldStatesToAll()
+{
+ WorldPacket data = BuildInitWorldStates();
+ for (uint8 team = 0; team < 2; team++)
+ for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
+{
+// might be some use for this in the future. old code commented out below. KL
+/* if (team == GetDefenderTeam())
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
+ }
+ }*/
+}
+
+// Called when a tower is broke
+void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team)
+{
+ // Destroy an attack tower
+ if (team == GetAttackerTeam())
+ {
+ // Update counter
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1);
+
+ // Remove buff stack on attackers
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
+
+ // Add buff stack to defenders
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_TOWER_CONTROL, true);
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player);
+ }
+
+ // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3)
+ {
+ if (int32(m_Timer - 600000) < 0)
+ m_Timer = 0;
+ else
+ m_Timer -= 600000;
+ SendInitWorldStatesToAll();
+ }
+ }
+ else
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1);
+ }
+}
+
+void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
+{
+ if (!obj || !IsWarTime())
+ return;
+
+ // We handle only gameobjects here
+ GameObject* go = obj->ToGameObject();
+ if (!go)
+ return;
+
+ // On click on titan relic
+ if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC)
+ {
+ if (CanInteractWithRelic())
+ EndBattle(false);
+ else
+ GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ // if destroy or damage event, search the wall/tower and update worldstate/send warning message
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (go->GetEntry() == (*itr)->m_Build->GetEntry())
+ {
+ if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId)
+ (*itr)->Damaged();
+
+ if ((*itr)->m_Build->GetGOInfo()->building.destroyedEvent == eventId)
+ (*itr)->Destroyed();
+
+ break;
+ }
+ }
+}
+
+// Called when a tower is damaged, used for honor reward calcul
+void BattlefieldWG::UpdateDamagedTowerCount(TeamId team)
+{
+ if (team == GetAttackerTeam())
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1);
+}
+
+// Update vehicle count WorldState to player
+void BattlefieldWG::UpdateVehicleCountWG()
+{
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A));
+}
+
+void BattlefieldWG::UpdateTenacity()
+{
+ TeamId team = TEAM_NEUTRAL;
+ uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size();
+ uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size();
+ int32 newStack = 0;
+
+ if (alliancePlayers && hordePlayers)
+ {
+ if (alliancePlayers < hordePlayers)
+ newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance
+ else if (alliancePlayers > hordePlayers)
+ newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde
+ }
+
+ if (newStack == int32(m_tenacityStack))
+ return;
+
+ if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
+ team = TEAM_ALLIANCE;
+ else if (newStack >= 0) // old buff was on horde
+ team = TEAM_HORDE;
+
+ m_tenacityStack = newStack;
+ // Remove old buff
+ if (team != TEAM_NEUTRAL)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->getLevel() >= m_MinLevel)
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
+ }
+
+ // Apply new buff
+ if (newStack)
+ {
+ team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
+
+ if (newStack < 0)
+ newStack = -newStack;
+ if (newStack > 20)
+ newStack = 20;
+
+ uint32 buff_honor = SPELL_GREATEST_HONOR;
+ if (newStack < 15)
+ buff_honor = SPELL_GREATER_HONOR;
+ if (newStack < 10)
+ buff_honor = SPELL_GREAT_HONOR;
+ if (newStack < 5)
+ buff_honor = 0;
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SetAuraStack(SPELL_TENACITY, player, newStack);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
+
+ if (buff_honor != 0)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, buff_honor, true);
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->CastSpell(creature, buff_honor, true);
+ }
+ }
+}
+
+WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield)
+{
+ m_Bf = battlefield;
+ m_team = teamInControl;
+}
+
+void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
+{
+ m_Workshop->GiveControlTo(m_team, false);
+}
+
+BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield)
+{
+ m_Bf = battlefield;
+}
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
new file mode 100644
index 00000000000..be062704b52
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -0,0 +1,1768 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_WG_
+#define BATTLEFIELD_WG_
+
+#include "ObjectAccessor.h"
+#include "WorldPacket.h"
+#include "World.h"
+#include "Group.h"
+#include "GroupMgr.h"
+#include "Battlefield.h"
+
+uint32 const VehNumWorldState[2] = { 3680, 3490 };
+uint32 const MaxVehNumWorldState[2] = { 3681, 3491 };
+uint32 const ClockWorldState[2] = { 3781, 4354 };
+uint32 const WintergraspFaction[3] = { 1, 2, 35 };
+float const WintergraspStalkerPos[4] = { 0, 0, 0, 0 };
+
+class BattlefieldWG;
+class WintergraspCapturePoint;
+
+struct BfWGGameObjectBuilding;
+struct WGWorkshop;
+
+typedef std::set<GameObject*> GameObjectSet;
+typedef std::set<BfWGGameObjectBuilding*> GameObjectBuilding;
+typedef std::set<WGWorkshop*> Workshop;
+typedef std::set<Group*> GroupSet;
+//typedef std::set<WintergraspCapturePoint *> CapturePointSet; unused ?
+
+enum WintergraspSpells
+{
+ // Wartime auras
+ SPELL_RECRUIT = 37795,
+ SPELL_CORPORAL = 33280,
+ SPELL_LIEUTENANT = 55629,
+ SPELL_TENACITY = 58549,
+ SPELL_TENACITY_VEHICLE = 59911,
+ SPELL_TOWER_CONTROL = 62064,
+ SPELL_SPIRITUAL_IMMUNITY = 58729,
+ SPELL_GREAT_HONOR = 58555,
+ SPELL_GREATER_HONOR = 58556,
+ SPELL_GREATEST_HONOR = 58557,
+ SPELL_ALLIANCE_FLAG = 14268,
+ SPELL_HORDE_FLAG = 14267,
+ SPELL_GRAB_PASSENGER = 61178,
+
+ // Reward spells
+ SPELL_VICTORY_REWARD = 56902,
+ SPELL_DEFEAT_REWARD = 58494,
+ SPELL_DAMAGED_TOWER = 59135,
+ SPELL_DESTROYED_TOWER = 59136,
+ SPELL_DAMAGED_BUILDING = 59201,
+ SPELL_INTACT_BUILDING = 59203,
+
+ SPELL_TELEPORT_BRIDGE = 59096,
+ SPELL_TELEPORT_FORTRESS = 60035,
+
+ SPELL_TELEPORT_DALARAN = 53360,
+ SPELL_VICTORY_AURA = 60044,
+
+ // Other spells
+ SPELL_WINTERGRASP_WATER = 36444,
+ SPELL_ESSENCE_OF_WINTERGRASP = 58045,
+ SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730,
+
+ // Phasing spells
+ SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618, // ADDS PHASE 16
+ SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617, // ADDS PHASE 32
+
+ SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773, // ADDS PHASE 64
+ SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774, // ADDS PHASE 128
+};
+
+enum WintergraspData
+{
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_MAX,
+};
+
+enum WintergraspAchievements
+{
+ ACHIEVEMENTS_WIN_WG = 1717,
+ ACHIEVEMENTS_WIN_WG_100 = 1718, // todo
+ ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo
+ ACHIEVEMENTS_WG_TOWER_DESTROY = 1727,
+ ACHIEVEMENTS_DESTRUCTION_DERBY_A = 1737, // todo
+ ACHIEVEMENTS_WG_TOWER_CANNON_KILL = 1751, // todo
+ ACHIEVEMENTS_WG_MASTER_A = 1752, // todo
+ ACHIEVEMENTS_WIN_WG_TIMER_10 = 1755,
+ ACHIEVEMENTS_STONE_KEEPER_50 = 2085, // todo
+ ACHIEVEMENTS_STONE_KEEPER_100 = 2086, // todo
+ ACHIEVEMENTS_STONE_KEEPER_250 = 2087, // todo
+ ACHIEVEMENTS_STONE_KEEPER_500 = 2088, // todo
+ ACHIEVEMENTS_STONE_KEEPER_1000 = 2089, // todo
+ ACHIEVEMENTS_WG_RANGER = 2199, // todo
+ ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo
+ ACHIEVEMENTS_WG_MASTER_H = 2776, // todo
+};
+
+enum WintergraspWorldStates
+{
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491,
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A = 3680,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A = 3681,
+ BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801,
+ BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802,
+ BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803,
+ BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710,
+};
+
+enum WintergraspAreaIds
+{
+ AREA_WINTERGRASP_FORTRESS = 4575,
+ AREA_THE_SUNKEN_RING = 4538,
+ AREA_THE_BROKEN_TEMPLATE = 4539,
+ AREA_WESTPARK_WORKSHOP = 4611,
+ AREA_EASTPARK_WORKSHOP = 4612,
+ AREA_WINTERGRASP = 4197,
+ AREA_THE_CHILLED_QUAGMIRE = 4589,
+};
+
+/*#########################
+ *####### Graveyards ######
+ *#########################*/
+
+class BfGraveyardWG : public BfGraveyard
+{
+ public:
+ BfGraveyardWG(BattlefieldWG* Bf);
+
+ void SetTextId(uint32 textid) { m_GossipTextId = textid; }
+ uint32 GetTextId() { return m_GossipTextId; }
+ protected:
+ uint32 m_GossipTextId;
+};
+
+enum WGGraveyardId
+{
+ BATTLEFIELD_WG_GY_WORKSHOP_NE,
+ BATTLEFIELD_WG_GY_WORKSHOP_NW,
+ BATTLEFIELD_WG_GY_WORKSHOP_SE,
+ BATTLEFIELD_WG_GY_WORKSHOP_SW,
+ BATTLEFIELD_WG_GY_KEEP,
+ BATTLEFIELD_WG_GY_HORDE,
+ BATTLEFIELD_WG_GY_ALLIANCE,
+ BATTLEFIELD_WG_GRAVEYARD_MAX,
+};
+
+enum WGGossipText
+{
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506,
+};
+
+enum WintergraspNpcs
+{
+ BATTLEFIELD_WG_NPC_GUARD_H = 30739,
+ BATTLEFIELD_WG_NPC_GUARD_A = 30740,
+ BATTLEFIELD_WG_NPC_STALKER = 15214,
+
+ BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102,
+ BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101, // <MASTER HEXXER>
+ BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151,
+ BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106,
+ BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053,
+ BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107,
+
+ BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052,
+ BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051, // <ENCHANTRESS>
+ BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153,
+ BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
+ BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
+ BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
+
+ NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
+ NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
+ NPC_TOWER_CANNON = 28366,
+
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
+ NPC_WINTERGRASP_CATAPULT = 27881,
+ NPC_WINTERGRASP_DEMOLISHER = 28094,
+ NPC_WINTERGRASP_TOWER_CANNON = 28366,
+};
+
+struct BfWGCoordGY
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 gyid;
+ uint8 type;
+ uint32 textid; // for gossip menu
+ TeamId startcontrol;
+};
+
+uint32 const WGQuest[2][6] =
+{
+ { 13186, 13181, 13222, 13538, 13177, 13179 },
+ { 13185, 13183, 13223, 13539, 13178, 13180 },
+};
+// 7 in sql, 7 in header
+BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
+{
+ { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
+ { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
+ { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
+ { 4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, BATTLEFIELD_WG_GY_WORKSHOP_SW, BATTLEFIELD_WG_GOSSIPTEXT_GY_SW, TEAM_NEUTRAL },
+ { 5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP, TEAM_NEUTRAL },
+ { 5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE, TEAM_HORDE },
+ { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE },
+};
+
+/* ######################### *
+ * WintergraspCapturePoint *
+ * ######################### */
+
+class WintergraspCapturePoint : public BfCapturePoint
+{
+ public:
+ WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
+
+ void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
+
+ void ChangeTeam(TeamId oldteam);
+ TeamId GetTeam() const { return m_team; }
+
+ protected:
+ WGWorkshop* m_Workshop;
+};
+
+/* ######################### *
+ * WinterGrasp Battlefield *
+ * ######################### */
+
+class BattlefieldWG : public Battlefield
+{
+ public:
+ /**
+ * \brief Called when the battle start
+ * - Spawn relic and turret
+ * - Rebuild tower and wall
+ * - Invite player to war
+ */
+ void OnBattleStart();
+
+ /**
+ * \brief Called when battle end
+ * - Remove relic and turret
+ * - Change banner/npc in keep if it needed
+ * - Saving battlestate
+ * - Reward honor/mark to player
+ * - Remove vehicle
+ * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
+ */
+ void OnBattleEnd(bool endByTimer);
+
+ /**
+ * \brief Called when grouping starts (15 minutes before battlestart)
+ * - Invite all player in zone to join queue
+ */
+ void OnStartGrouping();
+
+ /**
+ * \brief Called when player accept invite to join battle
+ * - Update aura
+ * - Teleport if it needed
+ * - Update worldstate
+ * - Update tenacity
+ * \param player: Player who accepted invite
+ */
+ void OnPlayerJoinWar(Player* player);
+
+ /**
+ * \brief Called when player left the battle
+ * - Update player aura
+ * \param player : Player who left the battle
+ */
+ void OnPlayerLeaveWar(Player* player);
+
+ /**
+ * \brief Called when player left the WG zone
+ * \param player : Player who left the zone
+ */
+ void OnPlayerLeaveZone(Player* player);
+
+ /**
+ * \brief Called when player enters in WG zone
+ * - Update aura
+ * - Update worldstate
+ * \param player : Player who enters the zone
+ */
+ void OnPlayerEnterZone(Player* player);
+
+ /**
+ * \brief Called for update battlefield data
+ * - Save battle timer in database every minutes
+ * - Update imunity aura from graveyard
+ * \param diff : time elapsed since the last call (in ms)
+ */
+ bool Update(uint32 diff);
+
+ /**
+ * \brief Called when a creature is created
+ * - Update vehicle count
+ */
+ void OnCreatureCreate(Creature* creature);
+
+ /**
+ * \brief Called when a creature is removed
+ * - Update vehicle count
+ */
+ void OnCreatureRemove(Creature* creature);
+
+ /**
+ * \brief Called when a gameobject is created
+ */
+ void OnGameObjectCreate(GameObject* go);
+
+ /**
+ * \brief Called when a wall/tower is broken
+ * - Update quest
+ */
+ void BrokenWallOrTower(TeamId team);
+
+ /**
+ * \brief Called when a tower is damaged
+ * - Update tower count (for reward calcul)
+ */
+ void UpdateDamagedTowerCount(TeamId team);
+
+ /**
+ * \brief Called when tower is broken
+ * - Update tower buff
+ * - check if three south tower is down for remove 10 minutes to wg
+ */
+ void UpdatedDestroyedTowerCount(TeamId team);
+
+ void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
+
+ void RemoveAurasFromPlayer(Player* player);
+
+ /**
+ * \brief Called when battlefield is setup, at server start
+ */
+ bool SetupBattlefield();
+
+ /// Return pointer to relic object
+ GameObject* GetRelic() { return m_titansRelic; }
+
+ /// Define relic object
+ void SetRelic(GameObject* relic) { m_titansRelic = relic; }
+
+ /// Check if players can interact with the relic (Only if the last door has been broken)
+ bool CanInteractWithRelic() { return m_isRelicInteractible; }
+
+ /// Define if player can interact with the relic
+ void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
+
+ void UpdateVehicleCountWG();
+ void UpdateCounterVehicle(bool init);
+
+ WorldPacket BuildInitWorldStates();
+ void SendInitWorldStatesTo(Player* player);
+ void SendInitWorldStatesToAll();
+
+ void HandleKill(Player* killer, Unit* victim);
+ void OnUnitDeath(Unit* unit);
+ void PromotePlayer(Player* killer);
+
+ void UpdateTenacity();
+ void ProcessEvent(WorldObject *obj, uint32 eventId);
+
+ bool FindAndRemoveVehicleFromList(Unit* vehicle);
+
+ // returns the graveyardId in the specified area.
+ uint8 GetSpiritGraveyardId(uint32 areaId);
+
+ uint32 GetData(uint32 data);
+ protected:
+ bool m_isRelicInteractible;
+
+ Workshop WorkshopsList;
+
+ GameObjectSet DefenderPortalList;
+ GameObjectSet m_KeepGameObject[2];
+ GameObjectBuilding BuildingsInZone;
+
+ GuidSet m_vehicles[2];
+ GuidSet CanonList;
+ GuidSet KeepCreature[2];
+ GuidSet OutsideCreature[2];
+
+ uint32 m_tenacityStack;
+ uint32 m_saveTimer;
+
+ GameObject* m_titansRelic;
+};
+
+uint32 const NORTHREND_WINTERGRASP = 4197;
+uint8 const WG_MAX_OBJ = 32;
+uint8 const WG_KEEPGAMEOBJECT_MAX = 44;
+uint8 const WG_MAX_TURRET = 15;
+uint8 const WG_MAX_KEEP_NPC = 39;
+uint8 const WG_MAX_OUTSIDE_NPC = 14;
+uint8 const WG_OUTSIDE_ALLIANCE_NPC = 7;
+uint8 const WG_MAX_TELEPORTER = 12;
+
+enum WintergraspGameObjectBuildingType
+{
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR,
+ BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC,
+ BATTLEFIELD_WG_OBJECTTYPE_WALL,
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST,
+ BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER,
+ BATTLEFIELD_WG_OBJECTTYPE_TOWER,
+};
+
+enum WintergraspGameObjectState
+{
+ BATTLEFIELD_WG_OBJECTSTATE_NONE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY,
+};
+
+enum WintergraspWorkshopIds
+{
+ BATTLEFIELD_WG_WORKSHOP_NE,
+ BATTLEFIELD_WG_WORKSHOP_NW,
+ BATTLEFIELD_WG_WORKSHOP_SE,
+ BATTLEFIELD_WG_WORKSHOP_SW,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_WEST,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_EAST,
+};
+
+enum WintergraspWorldstates
+{
+ WORLDSTATE_WORKSHOP_NE = 3701,
+ WORLDSTATE_WORKSHOP_NW = 3700,
+ WORLDSTATE_WORKSHOP_SE = 3703,
+ WORLDSTATE_WORKSHOP_SW = 3702,
+ WORLDSTATE_WORKSHOP_K_W = 3698,
+ WORLDSTATE_WORKSHOP_K_E = 3699
+};
+
+enum WintergraspTeamControl
+{
+ BATTLEFIELD_WG_TEAM_ALLIANCE,
+ BATTLEFIELD_WG_TEAM_HORDE,
+ BATTLEFIELD_WG_TEAM_NEUTRAL,
+};
+
+// TODO: Handle this with creature_text ?
+enum WintergraspText
+{
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW = 12054,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_ATTACK = 12051,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_TAKEN = 12050,
+ BATTLEFIELD_WG_TEXT_ALLIANCE = 12057,
+ BATTLEFIELD_WG_TEXT_HORDE = 12056,
+ BATTLEFIELD_WG_TEXT_WILL_START = 12058,
+ BATTLEFIELD_WG_TEXT_START = 12067,
+ BATTLEFIELD_WG_TEXT_FIRSTRANK = 12059,
+ BATTLEFIELD_WG_TEXT_SECONDRANK = 12060,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE = 12062,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW = 12064,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE = 12061,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW = 12063,
+ BATTLEFIELD_WG_TEXT_TOWER_DAMAGE = 12065,
+ BATTLEFIELD_WG_TEXT_TOWER_DESTROY = 12066,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_S = 12069,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_E = 12070,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071,
+ BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068,
+ BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072,
+};
+
+enum WintergraspGameObject
+{
+ GO_WINTERGRASP_FACTORY_BANNER_NE = 190475,
+ GO_WINTERGRASP_FACTORY_BANNER_NW = 190487,
+ GO_WINTERGRASP_FACTORY_BANNER_SE = 194959,
+ GO_WINTERGRASP_FACTORY_BANNER_SW = 194962,
+
+ GO_WINTERGRASP_TITAN_S_RELIC = 192829,
+
+ GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221,
+ GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373,
+ GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377,
+ GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378,
+
+ GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356,
+ GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357,
+ GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358,
+};
+
+struct WintergraspObjectPositionData
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 entryHorde;
+ uint32 entryAlliance;
+};
+
+// *****************************************************
+// ************ Destructible (Wall,Tower..) ************
+// *****************************************************
+
+struct WintergraspBuildingSpawnData
+{
+ uint32 entry;
+ uint32 WorldState;
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 type;
+ uint32 nameId;
+};
+
+const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] =
+{
+ // Wall (Not spawned in db)
+ // Entry WS X Y Z O type NameID
+ { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191796, 3772, 5384.45f, 2771.84f, 410.27f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191799, 3762, 5371.44f, 2630.61f, 408.816f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191800, 3766, 5301.84f, 2909.09f, 409.866f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191801, 3770, 5301.06f, 2771.41f, 409.901f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191802, 3751, 5280.2f, 2995.58f, 408.825f, 1.61443f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191803, 3752, 5279.14f, 2956.02f, 408.604f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191804, 3767, 5278.69f, 2882.51f, 409.539f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191806, 3769, 5279.5f, 2798.94f, 409.998f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191807, 3759, 5279.94f, 2724.77f, 409.945f, 1.56207f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191808, 3760, 5279.6f, 2683.79f, 409.849f, 1.55334f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191809, 3761, 5330.96f, 2630.78f, 409.283f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190369, 3753, 5256.08f, 2933.96f, 409.357f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190370, 3758, 5257.46f, 2747.33f, 409.743f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190371, 3754, 5214.96f, 2934.09f, 409.19f, -0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190372, 3757, 5215.82f, 2747.57f, 409.188f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190374, 3755, 5162.27f, 2883.04f, 410.256f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190376, 3756, 5163.72f, 2799.84f, 409.227f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // Tower of keep (Not spawned in db)
+ { 190221, 3711, 5281.15f, 3044.59f, 407.843f, 3.11539f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW },
+ { 190373, 3713, 5163.76f, 2932.23f, 409.19f, 3.12412f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW },
+ { 190377, 3714, 5166.4f, 2748.37f, 409.188f, -1.5708f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE },
+ { 190378, 3712, 5281.19f, 2632.48f, 409.099f, -1.58825f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE },
+
+ // Wall (with passage) (Not spawned in db)
+ { 191797, 3765, 5343.29f, 2908.86f, 409.576f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191798, 3771, 5342.72f, 2771.39f, 409.625f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191805, 3768, 5279.13f, 2840.8f, 409.783f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // South tower (Not spawned in db)
+ { 190356, 3704, 4557.17f, 3623.94f, 395.883f, 1.67552f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_W },
+ { 190357, 3705, 4398.17f, 2822.5f, 405.627f, -3.12412f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_S },
+ { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E },
+
+ // Door of forteress (Not spawned in db)
+ { 190375, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 },
+
+ // Last door (Not spawned in db)
+ { 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 },
+};
+
+
+// *********************************************************
+// **********Keep Element(GameObject,Creature)**************
+// *********************************************************
+
+// Keep gameobject
+// 192488 : 10 in sql, 19 in header
+// 192501 : 12 in sql, 17 in header
+// 192416 : 1 in sql, 33 in header
+// 192374 : 1 in sql, 1 in header
+// 192375 : 1 in sql, 1 in header
+// 192336 : 1 in sql, 1 in header
+// 192255 : 1 in sql, 1 in header
+// 192269 : 1 in sql, 7 in header
+// 192254 : 1 in sql, 1 in header
+// 192349 : 1 in sql, 1 in header
+// 192366 : 1 in sql, 3 in header
+// 192367 : 1 in sql, 1 in header
+// 192364 : 1 in sql, 1 in header
+// 192370 : 1 in sql, 1 in header
+// 192369 : 1 in sql, 1 in header
+// 192368 : 1 in sql, 1 in header
+// 192362 : 1 in sql, 1 in header
+// 192363 : 1 in sql, 1 in header
+// 192379 : 1 in sql, 1 in header
+// 192378 : 1 in sql, 1 in header
+// 192355 : 1 in sql, 1 in header
+// 192354 : 1 in sql, 1 in header
+// 192358 : 1 in sql, 1 in header
+// 192359 : 1 in sql, 1 in header
+// 192338 : 1 in sql, 1 in header
+// 192339 : 1 in sql, 1 in header
+// 192284 : 1 in sql, 1 in header
+// 192285 : 1 in sql, 1 in header
+// 192371 : 1 in sql, 1 in header
+// 192372 : 1 in sql, 1 in header
+// 192373 : 1 in sql, 1 in header
+// 192360 : 1 in sql, 1 in header
+// 192361 : 1 in sql, 1 in header
+// 192356 : 1 in sql, 1 in header
+// 192352 : 1 in sql, 1 in header
+// 192353 : 1 in sql, 1 in header
+// 192357 : 1 in sql, 1 in header
+// 192350 : 1 in sql, 1 in header
+// 192351 : 1 in sql, 1 in header
+const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] =
+{
+ { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower
+ { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect
+ { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect
+ { 5163.129883f, 2952.590088f, 433.502991f, 1.535890f, 192488, 192501 }, // Flag on tower
+ { 5145.109863f, 2935.000000f, 433.385986f, 3.141590f, 192488, 192501 }, // Flag on tower
+ { 5158.810059f, 2883.129883f, 431.618011f, 3.141590f, 192488, 192416 }, // Flag on wall
+ { 5154.490234f, 2862.149902f, 445.011993f, 3.141590f, 192336, 192416 }, // Flag on Wall Intersect
+ { 5154.520020f, 2853.310059f, 409.183014f, 3.141590f, 192255, 192269 }, // Flag on the floor
+ { 5154.459961f, 2828.939941f, 409.188995f, 3.141590f, 192254, 192269 }, // Flag on the floor
+ { 5155.310059f, 2820.739990f, 444.979004f, -3.13286f, 192349, 192416 }, // Flag on wall intersect
+ { 5160.339844f, 2798.610107f, 430.769012f, 3.141590f, 192488, 192416 }, // Flag on wall
+ { 5146.040039f, 2747.209961f, 433.584015f, 3.071770f, 192488, 192501 }, // Flag on tower
+ { 5163.779785f, 2729.679932f, 433.394012f, -1.58825f, 192488, 192501 }, // Flag on tower
+ { 5236.270020f, 2739.459961f, 444.992004f, -1.59698f, 192366, 192416 }, // Flag on wall intersect
+ { 5271.799805f, 2704.870117f, 445.183014f, -3.13286f, 192367, 192416 }, // Flag on wall intersect
+ { 5260.819824f, 2631.800049f, 433.324005f, 3.054330f, 192488, 192501 }, // Flag on tower
+ { 5278.379883f, 2613.830078f, 433.408997f, -1.58825f, 192488, 192501 }, // Flag on tower
+ { 5350.879883f, 2622.719971f, 444.686005f, -1.57080f, 192364, 192416 }, // Flag on wall intersect
+ { 5392.270020f, 2639.739990f, 435.330994f, 1.509710f, 192370, 192416 }, // Flag on wall intersect
+ { 5350.950195f, 2640.360107f, 435.407990f, 1.570800f, 192369, 192416 }, // Flag on wall intersect
+ { 5289.459961f, 2704.679932f, 435.875000f, -0.01745f, 192368, 192416 }, // Flag on wall intersect
+ { 5322.120117f, 2763.610107f, 444.973999f, -1.55334f, 192362, 192416 }, // Flag on wall intersect
+ { 5363.609863f, 2763.389893f, 445.023987f, -1.54462f, 192363, 192416 }, // Flag on wall intersect
+ { 5363.419922f, 2781.030029f, 435.763000f, 1.570800f, 192379, 192416 }, // Flag on wall intersect
+ { 5322.020020f, 2781.129883f, 435.811005f, 1.570800f, 192378, 192416 }, // Flag on wall intersect
+ { 5288.919922f, 2820.219971f, 435.721008f, 0.017452f, 192355, 192416 }, // Flag on wall intersect
+ { 5288.410156f, 2861.790039f, 435.721008f, 0.017452f, 192354, 192416 }, // Flag on wall intersect
+ { 5322.229980f, 2899.429932f, 435.808014f, -1.58825f, 192358, 192416 }, // Flag on wall intersect
+ { 5364.350098f, 2899.399902f, 435.838989f, -1.57080f, 192359, 192416 }, // Flag on wall intersect
+ { 5397.759766f, 2873.080078f, 455.460999f, 3.106650f, 192338, 192416 }, // Flag on keep
+ { 5397.390137f, 2809.330078f, 455.343994f, 3.106650f, 192339, 192416 }, // Flag on keep
+ { 5372.479980f, 2862.500000f, 409.049011f, 3.141590f, 192284, 192269 }, // Flag on floor
+ { 5371.490234f, 2820.800049f, 409.177002f, 3.141590f, 192285, 192269 }, // Flag on floor
+ { 5364.290039f, 2916.939941f, 445.330994f, 1.579520f, 192371, 192416 }, // Flag on wall intersect
+ { 5322.859863f, 2916.949951f, 445.153992f, 1.562070f, 192372, 192416 }, // Flag on wall intersect
+ { 5290.350098f, 2976.560059f, 435.221008f, 0.017452f, 192373, 192416 }, // Flag on wall intersect
+ { 5352.370117f, 3037.090088f, 435.252014f, -1.57080f, 192360, 192416 }, // Flag on wall intersect
+ { 5392.649902f, 3037.110107f, 433.713013f, -1.52716f, 192361, 192416 }, // Flag on wall intersect
+ { 5237.069824f, 2757.030029f, 435.795990f, 1.518440f, 192356, 192416 }, // Flag on wall intersect
+ { 5173.020020f, 2820.929932f, 435.720001f, 0.017452f, 192352, 192416 }, // Flag on wall intersect
+ { 5172.109863f, 2862.570068f, 435.721008f, 0.017452f, 192353, 192416 }, // Flag on wall intersect
+ { 5235.339844f, 2924.340088f, 435.040009f, -1.57080f, 192357, 192416 }, // Flag on wall intersect
+ { 5270.689941f, 2861.780029f, 445.058014f, -3.11539f, 192350, 192416 }, // Flag on wall intersect
+ { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect
+};
+
+const Position WGTurret[WG_MAX_TURRET] =
+{
+ { 5391.19f, 3060.8f, 419.616f, 1.69557f },
+ { 5266.75f, 2976.5f, 421.067f, 3.20354f },
+ { 5234.86f, 2948.8f, 420.88f, 1.61311f },
+ { 5323.05f, 2923.7f, 421.645f, 1.5817f },
+ { 5363.82f, 2923.87f, 421.709f, 1.60527f },
+ { 5264.04f, 2861.34f, 421.587f, 3.21142f },
+ { 5264.68f, 2819.78f, 421.656f, 3.15645f },
+ { 5322.16f, 2756.69f, 421.646f, 4.69978f },
+ { 5363.78f, 2756.77f, 421.629f, 4.78226f },
+ { 5236.2f, 2732.68f, 421.649f, 4.72336f },
+ { 5265.02f, 2704.63f, 421.7f, 3.12507f },
+ { 5350.87f, 2616.03f, 421.243f, 4.72729f },
+ { 5390.95f, 2615.5f, 421.126f, 4.6409f },
+ { 5148.8f, 2820.24f, 421.621f, 3.16043f },
+ { 5147.98f, 2861.93f, 421.63f, 3.18792f },
+};
+
+// Here there is all npc keeper spawn point
+const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] =
+{
+ // X Y Z O horde alliance
+ // North East
+ { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather
+ { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ // North
+ { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar
+ { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin
+ { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster
+ { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh
+ { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath
+ // X Y Z O horde alliance
+ // North West
+ { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof
+ { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort
+ { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ // South
+ { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp
+ // X Y Z O horde alliance
+ // Portal guards (from around the fortress)
+ { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard
+};
+
+const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
+{
+ { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 },
+ { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 },
+ { 4994.85f, 3660.51f, 359.150f, 2.260f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 },
+ { 5015.46f, 3677.11f, 362.970f, 6.009f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 },
+ { 5031.12f, 3663.77f, 363.500f, 3.110f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 },
+ { 5042.74f, 3675.82f, 363.060f, 3.358f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 },
+ { 5014.45f, 3640.87f, 361.390f, 3.280f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 },
+ { 5100.07f, 2168.89f, 365.779f, 1.972f, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH },
+ { 5081.70f, 2173.73f, 365.878f, 0.855f, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA },
+ { 5078.28f, 2183.70f, 365.029f, 1.466f, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH },
+ { 5088.49f, 2188.18f, 365.647f, 5.253f, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS },
+ { 5095.67f, 2193.28f, 365.924f, 4.939f, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE },
+ { 5088.61f, 2167.66f, 365.689f, 0.680f, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA },
+ { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO },
+};
+
+struct WintergraspTeleporterData
+{
+ uint32 entry;
+ float x;
+ float y;
+ float z;
+ float o;
+};
+
+const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
+{
+ // Player teleporter
+ { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f },
+ { 190763, 5268.70f, 2666.42f, 409.099f, -0.715f },
+ { 190763, 5197.05f, 2944.81f, 409.191f, 2.3387f },
+ { 190763, 5196.67f, 2737.34f, 409.189f, -2.932f },
+ { 190763, 5314.58f, 3055.85f, 408.862f, 0.5410f },
+ { 190763, 5391.28f, 2828.09f, 418.675f, -2.164f },
+ { 190763, 5153.93f, 2781.67f, 409.246f, 1.6580f },
+ { 190763, 5311.44f, 2618.93f, 409.092f, -2.373f },
+ { 190763, 5269.21f, 3013.84f, 408.828f, -1.762f },
+ { 190763, 5401.62f, 2853.66f, 418.674f, 2.6354f },
+ // Vehicle teleporter
+ { 192951, 5314.51f, 2703.69f, 408.550f, -0.890f },
+ { 192951, 5316.25f, 2977.04f, 408.539f, -0.820f },
+};
+
+// *********************************************************
+// **********Tower Element(GameObject,Creature)*************
+// *********************************************************
+
+struct WintergraspTowerData
+{
+ uint32 towerEntry; // Gameobject id of tower
+ uint8 nbObject; // Number of gameobjects spawned on this point
+ WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance)
+
+ // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage?
+ uint8 nbCreatureBottom;
+ WintergraspObjectPositionData CreatureBottom[9];
+ uint8 nbCreatureTop;
+ WintergraspObjectPositionData CreatureTop[5];
+};
+
+uint8 const WG_MAX_ATTACKTOWERS = 3;
+// 192414 : 0 in sql, 1 in header
+// 192278 : 0 in sql, 3 in header
+const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] =
+{
+ // West tower
+ {
+ 190356,
+ 6,
+ {
+ { 4559.109863f, 3606.219971f, 419.998993f, -1.483530f, 192488, 192501 }, // Flag on tower
+ { 4539.419922f, 3622.489990f, 420.033997f, -3.071770f, 192488, 192501 }, // Flag on tower
+ { 4555.259766f, 3641.649902f, 419.973999f, 1.675510f, 192488, 192501 }, // Flag on tower
+ { 4574.870117f, 3625.909912f, 420.079010f, 0.080117f, 192488, 192501 }, // Flag on tower
+ { 4433.899902f, 3534.139893f, 360.274994f, -1.850050f, 192269, 192278 }, // Flag near workshop
+ { 4572.930176f, 3475.520020f, 363.009003f, 1.42240f, 192269, 192278 } // Flag near bridge
+ },
+ 1,
+ {
+ { 4418.688477f, 3506.251709f, 358.975494f, 4.293305f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ }
+ },
+
+ // South Tower
+ {
+ 190357,
+ 5,
+ {
+ { 4416.000000f, 2822.669922f, 429.851013f, -0.017452f, 192488, 192501 }, // Flag on tower
+ { 4398.819824f, 2804.699951f, 429.791992f, -1.588250f, 192488, 192501 }, // Flag on tower
+ { 4387.620117f, 2719.570068f, 389.934998f, -1.544620f, 192366, 192414 }, // Flag near tower
+ { 4464.120117f, 2855.449951f, 406.110992f, 0.829032f, 192366, 192429 }, // Flag near tower
+ { 4526.459961f, 2810.179932f, 391.200012f, -2.993220f, 192269, 192278 }, // Flag near bridge
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 6,
+ {
+ { 4452.859863f, 2808.870117f, 402.604004f, 6.056290f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4455.899902f, 2835.958008f, 401.122559f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.649414f, 2953.792236f, 374.799957f, 0.980838f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 4362.089844f, 2811.510010f, 407.337006f, 3.193950f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.290039f, 2753.790039f, 401.015015f, 5.829400f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4421.939941f, 2773.189941f, 400.894989f, 5.707230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+
+ // East Tower
+ {
+ 190358,
+ 4,
+ {
+ { 4466.790039f, 1960.420044f, 459.144012f, 1.151920f, 192488, 192501 }, // Flag on tower
+ { 4475.350098f, 1937.030029f, 459.070007f, -0.43633f, 192488, 192501 }, // Flag on tower
+ { 4451.759766f, 1928.099976f, 459.075989f, -2.00713f, 192488, 192501 }, // Flag on tower
+ { 4442.990234f, 1951.900024f, 459.092987f, 2.740160f, 192488, 192501 }, // Flag on tower
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 5,
+ {
+ { 4501.060059f, 1990.280029f, 431.157013f, 1.029740f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4463.830078f, 2015.180054f, 430.299988f, 1.431170f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4494.580078f, 1943.760010f, 435.627014f, 6.195920f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4450.149902f, 1897.579956f, 435.045013f, 4.398230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4428.870117f, 1906.869995f, 432.648010f, 3.996800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+};
+
+struct WintergraspTowerCannonData
+{
+ uint32 towerEntry;
+ uint8 nbTowerCannonBottom;
+ Position TowerCannonBottom[5];
+ uint8 nbTurretTop;
+ Position TurretTop[5];
+};
+
+const uint8 WG_MAX_TOWER_CANNON = 7;
+
+const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] =
+{
+ {
+ 190221,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5255.88f, 3047.63f, 438.499f, 3.13677f },
+ { 5280.9f, 3071.32f, 438.499f, 1.62879f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190373,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5138.59f, 2935.16f, 439.845f, 3.11723f },
+ { 5163.06f, 2959.52f, 439.846f, 1.47258f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190377,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5163.84f, 2723.74f, 439.844f, 1.3994f },
+ { 5139.69f, 2747.4f, 439.844f, 3.17221f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190378,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5278.21f, 2607.23f, 439.755f, 4.71944f },
+ { 5255.01f, 2631.98f, 439.755f, 3.15257f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190356,
+ 2,
+ {
+ {4537.380371f, 3599.531738f, 402.886993f, 3.998462f},
+ {4581.497559f, 3604.087158f, 402.886963f, 5.651723f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ 2,
+ {
+ {4469.448242f, 1966.623779f, 465.647217f, 1.153573f},
+ {4581.895996f, 3626.438477f, 426.539062f, 0.117806f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ },
+ {
+ 190357,
+ 2,
+ {
+ { 4421.640137f, 2799.935791f, 412.630920f, 5.459298f },
+ { 4420.263184f, 2845.340332f, 412.630951f, 0.742197f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 3,
+ {
+ { 4423.430664f, 2822.762939f, 436.283142f, 6.223487f },
+ { 4397.825684f, 2847.629639f, 436.283325f, 1.579430f },
+ { 4398.814941f, 2797.266357f, 436.283051f, 4.703747f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190358,
+ 2,
+ {
+ { 4448.138184f, 1974.998779f, 441.995911f, 1.967238f },
+ { 4448.713379f, 1955.148682f, 441.995178f, 0.380733f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 4469.448242f, 1966.623779f, 465.647217f, 1.153573f },
+ { 4481.996582f, 1933.658325f, 465.647186f, 5.873029f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+};
+
+// *********************************************************
+// *****************WorkShop Data & Element*****************
+// *********************************************************
+
+uint8 const WG_MAX_WORKSHOP = 6;
+
+struct WGWorkshopData
+{
+ uint8 id;
+ uint32 worldstate;
+ uint32 text;
+};
+
+const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
+{
+ // NE
+ {BATTLEFIELD_WG_WORKSHOP_NE, WORLDSTATE_WORKSHOP_NE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE},
+ // NW
+ {BATTLEFIELD_WG_WORKSHOP_NW, WORLDSTATE_WORKSHOP_NW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW},
+ // SE
+ {BATTLEFIELD_WG_WORKSHOP_SE, WORLDSTATE_WORKSHOP_SE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE},
+ // SW
+ {BATTLEFIELD_WG_WORKSHOP_SW, WORLDSTATE_WORKSHOP_SW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW},
+ // KEEP WEST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, WORLDSTATE_WORKSHOP_K_W, NULL},
+ // KEEP EAST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, WORLDSTATE_WORKSHOP_K_E, NULL}
+};
+
+// ********************************************************************
+// * Structs using for Building,Graveyard,Workshop *
+// ********************************************************************
+// Structure for different buildings that can be destroyed during battle
+struct BfWGGameObjectBuilding
+{
+ BfWGGameObjectBuilding(BattlefieldWG* WG)
+ {
+ m_WG = WG;
+ m_Team = 0;
+ m_Build = NULL;
+ m_Type = 0;
+ m_WorldState = 0;
+ m_State = 0;
+ m_NameId = 0;
+ }
+
+ // the team that controls this point
+ uint8 m_Team;
+
+ // WG object
+ BattlefieldWG* m_WG;
+
+ // Linked gameobject
+ GameObject* m_Build;
+
+ // eWGGameObjectBuildingType
+ uint32 m_Type;
+
+ // WorldState
+ uint32 m_WorldState;
+
+ // eWGGameObjectState
+ uint32 m_State;
+
+ // Name id for warning text
+ uint32 m_NameId;
+
+ // GameObject associations
+ GameObjectSet m_GameObjectList[2];
+
+ // Creature associations
+ GuidSet m_CreatureBottomList[2];
+ GuidSet m_CreatureTopList[2];
+ GuidSet m_TowerCannonBottomList;
+ GuidSet m_TurretTopList;
+
+ void Rebuild()
+ {
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ // Rebuild gameobject
+ if (m_Build->IsDestructibleBuilding())
+ {
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+ }
+ UpdateCreatureAndGo();
+ m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
+ }
+
+ // Called when associated gameobject is damaged
+ void Damaged()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Send warning message
+ if (m_NameId) // tower damage + name
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam());
+ else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam());
+ }
+
+ // Called when associated gameobject is destroyed
+ void Destroyed()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warn players
+ if (m_NameId)
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ switch (m_Type)
+ {
+ // Inform the global wintergrasp script of the destruction of this object
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team));
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ m_WG->SetRelicInteractible(true);
+ if (m_WG->GetRelic())
+ m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found.");
+ break;
+ }
+
+ m_WG->BrokenWallOrTower(TeamId(m_Team));
+ }
+
+ void Init(GameObject* go, uint32 type, uint32 worldstate, uint32 nameid)
+ {
+ // GameObject associated to object
+ m_Build = go;
+
+ // Type of building (WALL/TOWER/DOOR)
+ m_Type = type;
+
+ // WorldState for client (icon on map)
+ m_WorldState = worldstate;
+
+ // NameId for Warning text
+ m_NameId = nameid;
+
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ m_State = sWorld->getWorldState(m_WorldState);
+ if (m_Build)
+ {
+ switch (m_State)
+ {
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
+ break;
+ }
+ }
+
+ int32 towerid = -1;
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ towerid = 0;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ towerid = 1;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ towerid = 2;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ towerid = 3;
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ towerid = 4;
+ break;
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ towerid = 5;
+ break;
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ towerid = 6;
+ break;
+ }
+
+ if (towerid > 3) // Attacker towers
+ {
+ // Spawn associate gameobjects
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++)
+ {
+ WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i];
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_HORDE].insert(go);
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_ALLIANCE].insert(go);
+ }
+
+ // Spawn associate npc bottom
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawn associate npc top
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+ }
+
+ if (towerid >= 0)
+ {
+ // Spawn Turret bottom
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++)
+ {
+ Position turretPos;
+ TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos);
+ if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE))
+ {
+ m_TowerCannonBottomList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+
+ // Spawn Turret top
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++)
+ {
+ Position towerCannonPos;
+ TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
+ if (Creature *turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0)))
+ {
+ m_TurretTopList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+ UpdateCreatureAndGo();
+ }
+ }
+
+ void UpdateCreatureAndGo()
+ {
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, true);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, true);
+
+ for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ void UpdateTurretAttack(bool disable)
+ {
+ for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (m_Build)
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (m_Build->GetEntry())
+ {
+ case 190221:
+ case 190373:
+ case 190377:
+ case 190378:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case 190356:
+ case 190357:
+ case 190358:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (m_Build)
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (m_Build->GetEntry())
+ {
+ case 190221:
+ case 190373:
+ case 190377:
+ case 190378:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case 190356:
+ case 190357:
+ case 190358:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+struct WGWorkshop
+{
+ // pointer to the battlefield that the workshop belongs to
+ BattlefieldWG* bf;
+ // id of the workshop, useful to retrieve data of the WorkshopsData array
+ uint8 workshopId;
+ // team that controls the node
+ uint8 teamControl;
+ // for worldstate
+ uint32 state;
+
+ WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId)
+ {
+ ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
+
+ bf = _bf;
+ workshopId = _workshopId;
+ }
+
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player to inform a faction attack to a workshop
+ // alliance / horde attacking a workshop
+ bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Updating worldstate
+ state = team == BATTLEFIELD_WG_TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text+1);
+
+ // Found associate graveyard and update it
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (bf->GetGraveyardById(workshopId))
+ bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE);
+
+ teamControl = team;
+ break;
+ }
+ }
+
+ if (!init)
+ bf->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl));
+ else
+ GiveControlTo(bf->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state);
+ }
+};
+
+// Structure for the 6 workshop
+struct WintergraspWorkshopData
+{
+ BattlefieldWG* m_WG; // Pointer to wintergrasp
+ GameObject* m_Build;
+ uint32 m_Type;
+ uint32 m_State; // For worldstate
+ uint32 m_WorldState;
+ uint32 m_TeamControl; // Team witch control the workshop
+ GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
+ GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
+ uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
+
+ WintergraspWorkshopData(BattlefieldWG* WG)
+ {
+ m_WG = WG;
+ m_Build = NULL;
+ m_Type = 0;
+ m_State = 0;
+ m_WorldState = 0;
+ m_TeamControl = 0;
+ m_NameId = 0;
+ }
+
+ // Spawning associate creature and store them
+ void AddCreature(WintergraspObjectPositionData obj)
+ {
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
+ m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
+
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
+ m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawning Associate gameobject and store them
+ void AddGameObject(WintergraspObjectPositionData obj)
+ {
+ if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject);
+ if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject);
+ }
+
+ // Init method, setup variable
+ void Init(uint32 worldstate, uint32 type, uint32 nameid)
+ {
+ m_WorldState = worldstate;
+ m_Type = type;
+ m_NameId = nameid;
+ }
+
+ // Called on change faction in CapturePoint class
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player for inform a faction attack a workshop
+ // alliance / horde attacking workshop
+ m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ {
+ // Show Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
+
+ // Hide Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ // Show Alliance gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide Horde gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+
+ // Updating worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ // Found associate graveyard and update it
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE);
+
+ m_TeamControl = team;
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Show Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
+
+ // Hide Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ // Hide Alliance gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Show Horde gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Update worlstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - horde
+ m_WG->SendWarningToAllInZone(m_NameId + 1);
+
+ // Update graveyard control
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE);
+
+ m_TeamControl = team;
+ break;
+ }
+ }
+ if (!init)
+ m_WG->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl));
+ else
+ GiveControlTo(m_WG->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+#endif
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 73e24e5a3c3..61b15bdd182 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -87,7 +87,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin
// Add captain as member
AddMember(CaptainGuid);
- sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
+ sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
return true;
}
@@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
- sLog->outError("Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
return false;
}
@@ -184,7 +184,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
- sLog->outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
return true;
}
@@ -250,8 +250,8 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
// Delete member if character information is missing
if (newMember.Name.empty())
{
- sLog->outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
- this->DelMember(newMember.Guid, true);
+ sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
+ DelMember(newMember.Guid, true);
continue;
}
@@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
- sLog->outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
+ sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
@@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : "";
uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;
- sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
}
}
@@ -321,7 +321,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
// delete all info regarding this team
for (uint32 i = 0; i < ARENA_TEAM_END; ++i)
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
- sLog->outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
// Only used for single member deletion, for arena team disband we use a single query for more efficiency
@@ -343,10 +343,10 @@ void ArenaTeam::Disband(WorldSession* session)
// Broadcast update
if (session)
{
- BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
+ BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName().c_str(), GetName(), "");
if (Player* player = session->GetPlayer())
- sLog->outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
// Update database
@@ -507,7 +507,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
data << str1 << str2 << str3;
break;
default:
- sLog->outError("Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
+ sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
return;
}
@@ -529,7 +529,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
default:
break;
}
- sLog->outError("FATAL: Unknown arena team type %u for some arena team", type);
+ sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type);
return 0xFF;
}
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index 1c24dfc061d..55de445345b 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -81,7 +81,7 @@ uint32 ArenaTeamMgr::GenerateArenaTeamId()
{
if (NextArenaTeamId >= 0xFFFFFFFE)
{
- sLog->outError("Arena team ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena team ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return NextArenaTeamId++;
@@ -101,8 +101,7 @@ void ArenaTeamMgr::LoadArenaTeams()
if (!result)
{
- sLog->outString(">> Loaded 0 arena teams. DB table `arena_team` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
return;
}
@@ -132,8 +131,7 @@ void ArenaTeamMgr::LoadArenaTeams()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ArenaTeamMgr::DistributeArenaPoints()
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index d6bfde021e7..eb5f3459edf 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -144,6 +144,7 @@ Battleground::Battleground()
m_Winner = 2;
m_StartTime = 0;
m_ResetStatTimer = 0;
+ m_ValidStartPositionTimer = 0;
m_Events = 0;
m_IsRated = false;
m_BuffChange = false;
@@ -177,6 +178,8 @@ Battleground::Battleground()
m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0;
m_ArenaTeamIds[BG_TEAM_HORDE] = 0;
+ m_StartMaxDist = 0.0f;
+
m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0;
m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0;
@@ -291,6 +294,7 @@ void Battleground::Update(uint32 diff)
// Update start time and reset stats timer
m_StartTime += diff;
m_ResetStatTimer += diff;
+ m_ValidStartPositionTimer += diff;
PostUpdateImpl(diff);
}
@@ -422,7 +426,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
// *********************************************************
ModifyStartDelayTime(diff);
- if (m_ResetStatTimer <= 5000)
+ if (m_ResetStatTimer > 5000)
{
m_ResetStatTimer = 0;
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
@@ -436,7 +440,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
if (!FindBgMap())
{
- sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
EndNow();
return;
}
@@ -453,19 +457,19 @@ inline void Battleground::_ProcessJoin(uint32 diff)
// First start warning - 2 or 1 minute
SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
- // After 1 minute or 30 seconds, warning is signalled
+ // After 1 minute or 30 seconds, warning is signaled
else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2))
{
m_Events |= BG_STARTING_EVENT_2;
SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
- // After 30 or 15 seconds, warning is signalled
+ // After 30 or 15 seconds, warning is signaled
else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3))
{
m_Events |= BG_STARTING_EVENT_3;
SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
- // Delay expired (atfer 2 or 1 minute)
+ // Delay expired (after 2 or 1 minute)
else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4))
{
m_Events |= BG_STARTING_EVENT_4;
@@ -526,6 +530,33 @@ inline void Battleground::_ProcessJoin(uint32 diff)
sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
}
}
+
+ // Find if the player left our start zone; if so, teleport it back
+ if (m_ValidStartPositionTimer > 1000)
+ {
+ m_ValidStartPositionTimer = 0;
+ float maxDist = GetStartMaxDist();
+ if (maxDist > 0.0f)
+ {
+ for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
+ {
+ if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
+ {
+ float x, y, z, o;
+ uint32 team = plr->GetBGTeam();
+ GetTeamStartLoc(team, x, y, z, o);
+
+ float dist = plr->GetDistance(x, y, z);
+
+ if (dist >= maxDist)
+ {
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId());
+ plr->TeleportTo(GetMapId(), x, y, z, o);
+ }
+ }
+ }
+ }
+ }
}
inline void Battleground::_ProcessLeave(uint32 diff)
@@ -557,7 +588,7 @@ inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, const c
{
player = ObjectAccessor::FindPlayer(guid);
if (!player)
- sLog->outError("Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
context, GUID_LOPART(guid), m_MapId, m_InstanceID);
}
return player;
@@ -740,17 +771,17 @@ void Battleground::EndBattleground(uint32 winner)
winner_matchmaker_rating = GetArenaMatchmakerRating(winner);
winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change);
loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change);
- sLog->outArena("match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
+ sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change);
SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change);
SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change);
SetArenaTeamRatingChangeForTeam(winner, winner_change);
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
- sLog->outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- sLog->outArena("Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
}
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
@@ -819,9 +850,8 @@ void Battleground::EndBattleground(uint32 winner)
if (team == winner)
{
// update achievement BEFORE personal rating update
- ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID());
- if (member)
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, 1);
+ uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot());
+ player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change);
}
@@ -1025,7 +1055,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
if (Transport)
player->TeleportToBGEntryPoint();
- sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", player->GetName());
+ sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Removed player %s from Battleground.", player->GetName());
}
//battleground object will be deleted next Battleground::Update() call
@@ -1045,7 +1075,7 @@ void Battleground::Reset()
m_Events = 0;
if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
- sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!",
m_InvitedAlliance, m_InvitedHorde, m_MapId, m_InstanceID);
m_InvitedAlliance = 0;
@@ -1073,7 +1103,7 @@ void Battleground::StartBattleground()
// and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes
sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this);
if (m_IsRated)
- sLog->outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
void Battleground::AddPlayer(Player* player)
@@ -1164,7 +1194,7 @@ void Battleground::AddPlayer(Player* player)
AddOrSetPlayerToCorrectBgGroup(player, team);
// Log
- sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", player->GetName());
+ sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Player %s joined the battle.", player->GetName());
}
// this method adds player to his team's bg group, or sets his correct group if player is already in bg group
@@ -1183,7 +1213,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
if (group->IsMember(playerGuid))
{
uint8 subgroup = group->GetMemberGroup(playerGuid);
- player->SetBattlegroundRaid(group, subgroup);
+ player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
}
else
{
@@ -1362,7 +1392,7 @@ void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value,
itr->second->HealingDone += value;
break;
default:
- sLog->outError("Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
type, m_MapId, m_InstanceID);
break;
}
@@ -1411,9 +1441,9 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
{
- sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_SQL, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
- sLog->outError("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete go;
return false;
@@ -1464,7 +1494,7 @@ void Battleground::DoorClose(uint32 type)
}
}
else
- sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
}
@@ -1476,7 +1506,7 @@ void Battleground::DoorOpen(uint32 type)
obj->SetGoState(GO_STATE_ACTIVE);
}
else
- sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
}
@@ -1484,7 +1514,7 @@ GameObject* Battleground::GetBGObject(uint32 type)
{
GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]);
if (!obj)
- sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
return obj;
}
@@ -1493,7 +1523,7 @@ Creature* Battleground::GetBGCreature(uint32 type)
{
Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]);
if (!creature)
- sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
return creature;
}
@@ -1526,7 +1556,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
Creature* creature = new Creature;
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
{
- sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete creature;
return NULL;
@@ -1537,7 +1567,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
- sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete creature;
return NULL;
@@ -1572,7 +1602,7 @@ bool Battleground::DelCreature(uint32 type)
return true;
}
- sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
BgCreatures[type] = 0;
return false;
@@ -1590,7 +1620,7 @@ bool Battleground::DelObject(uint32 type)
BgObjects[type] = 0;
return true;
}
- sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
BgObjects[type] = 0;
return false;
@@ -1616,7 +1646,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
//creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
return true;
}
- sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
type, entry, m_MapId, m_InstanceID);
EndNow();
return false;
@@ -1715,7 +1745,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid)
index--;
if (index < 0)
{
- sLog->outError("Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!",
GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID);
return;
}
@@ -1739,15 +1769,19 @@ void Battleground::HandleTriggerBuff(uint64 go_guid)
SpawnBGObject(index, BUFF_RESPAWN_TIME);
}
-void Battleground::HandleKillPlayer(Player* player, Player* killer)
+void Battleground::HandleKillPlayer(Player* victim, Player* killer)
{
// Keep in mind that for arena this will have to be changed a bit
// Add +1 deaths
- UpdatePlayerScore(player, SCORE_DEATHS, 1);
+ UpdatePlayerScore(victim, SCORE_DEATHS, 1);
// Add +1 kills to group and +1 killing_blows to killer
if (killer)
{
+ // Don't reward credit for killing ourselves, like fall damage of hellfire (warlock)
+ if (killer == victim)
+ return;
+
UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1);
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1);
@@ -1757,7 +1791,7 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer)
if (!creditedPlayer || creditedPlayer == killer)
continue;
- if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(player))
+ if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(victim))
UpdatePlayerScore(creditedPlayer, SCORE_HONORABLE_KILLS, 1);
}
}
@@ -1765,8 +1799,8 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer)
if (!isArena())
{
// To be able to remove insignia -- ONLY IN Battlegrounds
- player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
- RewardXPAtKill(killer, player);
+ victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
+ RewardXPAtKill(killer, victim);
}
}
@@ -1835,7 +1869,7 @@ int32 Battleground::GetObjectType(uint64 guid)
for (uint32 i = 0; i < BgObjects.size(); ++i)
if (BgObjects[i] == guid)
return i;
- sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
GUID_LOPART(guid), m_MapId, m_InstanceID);
return -1;
}
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 32f6ebc92de..01dfbb23033 100755
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -443,6 +443,8 @@ class Battleground
Z = m_TeamStartLocZ[idx];
O = m_TeamStartLocO[idx];
}
+ void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
+ float GetStartMaxDist() const { return m_StartMaxDist; }
// Packet Transfer
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
@@ -617,6 +619,7 @@ class Battleground
uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
uint32 m_StartTime;
uint32 m_ResetStatTimer;
+ uint32 m_ValidStartPositionTimer;
int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
uint32 m_LastResurrectTime;
BattlegroundBracketId m_BracketId;
@@ -698,6 +701,7 @@ class Battleground
float m_TeamStartLocY[BG_TEAMS_COUNT];
float m_TeamStartLocZ[BG_TEAMS_COUNT];
float m_TeamStartLocO[BG_TEAMS_COUNT];
+ float m_StartMaxDist;
uint32 ScriptId;
};
#endif
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index e1b99cbdcb9..0b107983379 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -55,7 +55,7 @@ BattlegroundMgr::BattlegroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTe
{
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
m_Battlegrounds[i].clear();
- m_NextRatingDiscardUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
+ m_NextRatedArenaUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER);
m_Testing=false;
}
@@ -143,10 +143,10 @@ void BattlegroundMgr::Update(uint32 diff)
}
// if rating difference counts, maybe force-update queues
- if (sWorld->getIntConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER))
+ if (sWorld->getIntConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER))
{
// it's time to force update
- if (m_NextRatingDiscardUpdate < diff)
+ if (m_NextRatedArenaUpdate < diff)
{
// forced update for rated arenas (scan all, but skipped non rated)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr: UPDATING ARENA QUEUES");
@@ -156,10 +156,10 @@ void BattlegroundMgr::Update(uint32 diff)
BATTLEGROUND_AA, BattlegroundBracketId(bracket),
BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId(qtype)), true, 0);
- m_NextRatingDiscardUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
+ m_NextRatedArenaUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER);
}
else
- m_NextRatingDiscardUpdate -= diff;
+ m_NextRatedArenaUpdate -= diff;
}
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
@@ -226,7 +226,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
*data << uint8(uiFrame);
break;
default:
- sLog->outError("Unknown BG status!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Unknown BG status!");
break;
}
}
@@ -281,7 +281,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
itr2 = itr++;
if (!bg->IsPlayerInBattleground(itr2->first))
{
- sLog->outError("Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true));
continue;
}
@@ -391,7 +391,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
// should never happen
if (++scoreCount >= bg->GetMaxPlayers() && itr != bg->GetPlayerScoresEnd())
{
- sLog->outError("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers());
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers());
break;
}
}
@@ -508,7 +508,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
if (!bg_template)
{
- sLog->outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
return NULL;
}
bool isRandom = false;
@@ -550,7 +550,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
bg_template = GetBattlegroundTemplate(bgTypeId);
if (!bg_template)
{
- sLog->outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
return NULL;
}
}
@@ -660,6 +660,7 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
bg->SetName(data.BattlegroundName);
bg->SetTeamStartLoc(ALLIANCE, data.Team1StartLocX, data.Team1StartLocY, data.Team1StartLocZ, data.Team1StartLocO);
bg->SetTeamStartLoc(HORDE, data.Team2StartLocX, data.Team2StartLocY, data.Team2StartLocZ, data.Team2StartLocO);
+ bg->SetStartMaxDist(data.StartMaxDist);
bg->SetLevelRange(data.LevelMin, data.LevelMax);
bg->SetScriptId(data.scriptId);
@@ -677,13 +678,12 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
uint8 selectionWeight;
BattlemasterListEntry const* bl;
- // 0 1 2 3 4 5 6 7 8 9 10
- QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, Weight, ScriptName FROM battleground_template");
+ // 0 1 2 3 4 5 6 7 8 9 10 11
+ QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
return;
}
@@ -701,7 +701,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
if (!bl)
{
- sLog->outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
continue;
}
@@ -712,17 +712,20 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
data.MaxPlayersPerTeam = fields[2].GetUInt16();
data.LevelMin = fields[3].GetUInt8();
data.LevelMax = fields[4].GetUInt8();
- //check values from DB
- if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
+
+ // check values from DB
+ if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
{
- data.MinPlayersPerTeam = 0; // by default now expected strong full bg requirement
- data.MaxPlayersPerTeam = 40;
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
+ data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
+ continue;
}
+
if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax)
{
- //TO-DO: FIX ME
- data.LevelMin = 0;//bl->minlvl;
- data.LevelMax = 80;//bl->maxlvl;
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
+ data.bgTypeId, data.LevelMin, data.LevelMax);
+ continue;
}
startId = fields[5].GetUInt32();
@@ -742,7 +745,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
- sLog->outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
continue;
}
@@ -763,12 +766,14 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
- sLog->outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
continue;
}
- selectionWeight = fields[9].GetUInt8();
- data.scriptId = sObjectMgr->GetScriptId(fields[10].GetCString());
+ data.StartMaxDist = fields[9].GetFloat();
+
+ selectionWeight = fields[10].GetUInt8();
+ data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString());
data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()];
data.MapID = bl->mapid[0];
@@ -786,8 +791,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
@@ -884,12 +888,12 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt
team = player->GetTeam();
bg->GetTeamStartLoc(team, x, y, z, O);
- sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O);
+ sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O);
player->TeleportTo(mapid, x, y, z, O);
}
else
{
- sLog->outError("player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
}
}
@@ -1071,8 +1075,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
if (!result)
{
- sLog->outString(">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
return;
}
@@ -1088,7 +1091,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
uint32 bgTypeId = fields[1].GetUInt32();
if (!sBattlemasterListStore.LookupEntry(bgTypeId))
{
- sLog->outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
+ sLog->outError(LOG_FILTER_SQL, "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
continue;
}
@@ -1096,8 +1099,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
@@ -1131,4 +1133,4 @@ BattlegroundTypeId BattlegroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
{
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
-} \ No newline at end of file
+}
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index 88559d07993..10a49408c06 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -50,6 +50,7 @@ struct CreateBattlegroundData
float Team2StartLocY;
float Team2StartLocZ;
float Team2StartLocO;
+ float StartMaxDist;
uint32 scriptId;
};
@@ -140,7 +141,7 @@ class BattlegroundMgr
BattlegroundSelectionWeightMap m_BGSelectionWeights;
std::vector<uint64> m_QueueUpdateScheduler;
std::set<uint32> m_ClientBattlegroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client
- uint32 m_NextRatingDiscardUpdate;
+ uint32 m_NextRatedArenaUpdate;
time_t m_NextAutoDistributionTime;
uint32 m_AutoDistributionTimeChecker;
bool m_ArenaTesting;
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 6f4264c0faf..85d41977d13 100755
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -294,7 +294,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
itr = m_QueuedPlayers.find(guid);
if (itr == m_QueuedPlayers.end())
{
- sLog->outError("BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
return;
}
@@ -328,7 +328,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
//player can't be in queue without group, but just in case
if (bracket_id == -1)
{
- sLog->outError("BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
return;
}
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
@@ -780,14 +780,14 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
if (!bg_template)
{
- sLog->outError("Battleground: Update: bg template not found for %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg template not found for %u", bgTypeId);
return;
}
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg_template->GetMapId(), bracket_id);
if (!bracketEntry)
{
- sLog->outError("Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id);
return;
}
@@ -838,7 +838,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, 0, false);
if (!bg2)
{
- sLog->outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
}
//invite those selection pools
@@ -864,7 +864,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, false);
if (!bg2)
{
- sLog->outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
}
@@ -962,7 +962,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true);
if (!arena)
{
- sLog->outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
return;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 52d2cdefd65..8b2543f20ff 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -238,7 +238,7 @@ void BattlegroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4021: // Unk2
//break;
default:
- //sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ //sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
//Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -290,7 +290,7 @@ int32 BattlegroundAB::_GetNodeNameId(uint8 node)
case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL;
case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE;
default:
- ASSERT(0);
+ ASSERT(false);
}
return 0;
}
@@ -356,7 +356,7 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node)
void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
{
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
- sLog->outError("Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
@@ -561,7 +561,7 @@ bool BattlegroundAB::SetupBattleground()
|| !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
)
{
- sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
}
@@ -569,7 +569,7 @@ bool BattlegroundAB::SetupBattleground()
|| !AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY)
)
{
- sLog->outErrorDb("BatteGroundAB: Failed to spawn door object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn door object Battleground not created!");
return false;
}
//buffs
@@ -579,7 +579,7 @@ bool BattlegroundAB::SetupBattleground()
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
)
- sLog->outErrorDb("BatteGroundAB: Failed to spawn buff object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!");
}
return true;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index d2cbab2be54..96fa899a746 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -93,7 +93,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
if (!m_CaptainAlive[0])
{
- sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
}
m_CaptainAlive[0]=false;
@@ -112,7 +112,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
if (!m_CaptainAlive[1])
{
- sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
}
m_CaptainAlive[1]=false;
@@ -480,7 +480,7 @@ void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team
{
if (!player)
{
- sLog->outError("bg_AV no player at remove");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "bg_AV no player at remove");
return;
}
//TODO search more buffs
@@ -588,7 +588,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else
- sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
//spawn destroyed aura
for (uint8 i=0; i <= 9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
@@ -753,7 +753,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
if (BgCreatures[node])
DelCreature(node);
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
- sLog->outError("AV: couldn't spawn spiritguide at node %i", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "AV: couldn't spawn spiritguide at node %i", node);
}
for (uint8 i=0; i<4; i++)
@@ -811,7 +811,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
return BG_AV_Nodes(object - 29);
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE)
return BG_AV_NODES_SNOWFALL_GRAVE;
- sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :(");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: ERROR! GetPlace got a wrong object :(");
ASSERT(false);
return BG_AV_Nodes(0);
}
@@ -849,7 +849,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
}
else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM)
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
- sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
ASSERT(false);
return 0;
}
@@ -903,7 +903,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "player defends point object: %i node: %i", object, node);
if (m_Nodes[node].PrevOwner != team)
{
- sLog->outError("BG_AV: player defends point which doesn't belong to his team %i", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: player defends point which doesn't belong to his team %i", node);
return;
}
@@ -1124,7 +1124,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used
if (state == POINT_ASSAULTED)
return 3;
}
- sLog->outError("BG_AV: should update a strange worldstate state:%i team:%i", state, team);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: should update a strange worldstate state:%i team:%i", state, team);
return 5; //this will crash the game, but i want to know if something is wrong here
}
@@ -1203,7 +1203,7 @@ bool BattlegroundAV::SetupBattleground()
// horde gates
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
{
- sLog->outErrorDb("BatteGroundAV: Failed to spawn some object Battleground not created!1");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1");
return false;
}
@@ -1221,7 +1221,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!2");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2");
return false;
}
}
@@ -1236,7 +1236,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!3");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3");
return false;
}
}
@@ -1249,7 +1249,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!4");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4");
return false;
}
}
@@ -1257,7 +1257,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
return false;
}
}
@@ -1271,7 +1271,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
return false;
}
}
@@ -1279,7 +1279,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
return false;
}
}
@@ -1289,7 +1289,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
return false;
}
}
@@ -1297,14 +1297,14 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
return false;
}
}
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
@@ -1314,7 +1314,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
return false;
}
}
@@ -1402,7 +1402,7 @@ const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
case BG_AV_NODES_FROSTWOLF_WTOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_FROST_W);
case BG_AV_NODES_FROSTWOLF_HUT: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_FROST_HUT);
default:
- sLog->outError("tried to get name for node %u", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "tried to get name for node %u", node);
break;
}
@@ -1413,22 +1413,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
{
if (m_Nodes[node].TotalOwner == team)
{
- sLog->outCrash("Assaulting team is TotalOwner of node");
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node");
ASSERT (false);
}
if (m_Nodes[node].Owner == team)
{
- sLog->outCrash("Assaulting team is owner of node");
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node");
ASSERT (false);
}
if (m_Nodes[node].State == POINT_DESTROYED)
{
- sLog->outCrash("Destroyed node is being assaulted");
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted");
ASSERT (false);
}
if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists
{
- sLog->outCrash("Assault on an not assaulted node with total owner");
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner");
ASSERT (false);
}
//the timer gets another time, if the previous owner was 0 == Neutral
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index c7eddbb67a9..78cf6b9863f 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
@@ -89,7 +89,7 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killer player not found");
return;
}
@@ -122,7 +122,7 @@ void BattlegroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger)
//buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2];
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -154,7 +154,7 @@ bool BattlegroundBE::SetupBattleground()
|| !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|| !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
{
- sLog->outErrorDb("BatteGroundBE: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundBE: Failed to spawn some object!");
return false;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
index 8a11edf85e6..20eba2a7f67 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -86,11 +86,8 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION);
setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING);
}
- else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and perform knockback
+ else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and start knockback timer
{
- if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[BG_DS_NPC_WATERFALL_KNOCKBACK]))
- waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
-
if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
gob->SetGoState(GO_STATE_READY);
@@ -174,7 +171,7 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("BattlegroundDS: Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundDS: Killer player not found");
return;
}
@@ -203,7 +200,7 @@ void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger)
setPipeKnockBackCount(0);
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -243,7 +240,7 @@ bool BattlegroundDS::SetupBattleground()
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY)
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY))
{
- sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundDS: Failed to spawn some object!");
return false;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index 12ed91fc922..aaf08ba1313 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -66,9 +66,9 @@ enum BattlegroundDSData
{ // These values are NOT blizzlike... need the correct data!
BG_DS_WATERFALL_TIMER_MIN = 30000,
BG_DS_WATERFALL_TIMER_MAX = 60000,
- BG_DS_WATERFALL_WARNING_DURATION = 7000,
- BG_DS_WATERFALL_DURATION = 10000,
- BG_DS_WATERFALL_KNOCKBACK_TIMER = 500,
+ BG_DS_WATERFALL_WARNING_DURATION = 5000,
+ BG_DS_WATERFALL_DURATION = 30000,
+ BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500,
BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000,
BG_DS_PIPE_KNOCKBACK_DELAY = 3000,
@@ -118,7 +118,7 @@ class BattlegroundDS : public Battleground
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
uint32 getWaterFallTimer() { return _waterfallTimer; };
void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
- uint32 getWaterFallKnockbackTimer() { return _waterfallTimer; };
+ uint32 getWaterFallKnockbackTimer() { return _waterfallKnockbackTimer; };
void setWaterFallKnockbackTimer(uint32 timer) { _waterfallKnockbackTimer = timer; };
uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; };
void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; };
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 8269a04a383..9bab15d9b5e 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -153,7 +153,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!player)
{
- sLog->outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
++j;
continue;
}
@@ -193,7 +193,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
if (!player)
{
- sLog->outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
@@ -411,7 +411,7 @@ void BattlegroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 5866:
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -474,7 +474,7 @@ bool BattlegroundEY::SetupBattleground()
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY)
)
{
- sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn some object Battleground not created!");
return false;
}
@@ -484,28 +484,28 @@ bool BattlegroundEY::SetupBattleground()
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
if (!at)
{
- sLog->outError("BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
continue;
}
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
)
- sLog->outError("BattlegroundEY: Cannot spawn buff");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Cannot spawn buff");
}
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
- sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
- sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
return false;
}
@@ -570,7 +570,7 @@ void BattlegroundEY::RespawnFlagAfterDrop()
if (obj)
obj->Delete();
else
- sLog->outError("BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID()));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID()));
SetDroppedFlagGUID(0);
}
@@ -742,7 +742,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
- sLog->outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
// SpawnBGCreature(Point, RESPAWN_IMMEDIATELY);
@@ -894,7 +894,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player)
if (!entry)
{
- sLog->outError("BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!");
return NULL;
}
@@ -911,7 +911,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player)
{
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
if (!entry)
- sLog->outError("BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId);
else
{
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index f3d0f5520f0..90571dfb758 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -57,7 +57,8 @@ BattlegroundIC::BattlegroundIC()
BattlegroundIC::~BattlegroundIC()
{
-
+ delete gunshipHorde;
+ delete gunshipAlliance;
}
void BattlegroundIC::HandlePlayerResurrect(Player* player)
@@ -275,7 +276,7 @@ void BattlegroundIC::StartingEventOpenDoors()
BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y,
BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o,
0, 0, 0, 0, RESPAWN_ONE_DAY))
- sLog->outError("Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
}
}
@@ -372,7 +373,7 @@ bool BattlegroundIC::SetupBattleground()
BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o,
0, 0, 0, 0, RESPAWN_ONE_DAY))
{
- sLog->outError("Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
return false;
}
}
@@ -384,7 +385,7 @@ bool BattlegroundIC::SetupBattleground()
BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o,
RESPAWN_ONE_DAY))
{
- sLog->outError("Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
return false;
}
}
@@ -394,7 +395,7 @@ bool BattlegroundIC::SetupBattleground()
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], HORDE))
{
- sLog->outError("Isle of Conquest: Failed to spawn initial spirit guide!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn initial spirit guide!");
return false;
}
@@ -403,7 +404,7 @@ bool BattlegroundIC::SetupBattleground()
if (!gunshipAlliance || !gunshipHorde)
{
- sLog->outError("Isle of Conquest: There was an error creating gunships!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error creating gunships!");
return false;
}
@@ -615,7 +616,7 @@ uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool r
return nodePoint->last_entry;
// we should never be here...
- sLog->outError("Isle Of Conquest: Unexpected return in GetNextBanner function");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle Of Conquest: Unexpected return in GetNextBanner function");
return 0;
}
@@ -639,7 +640,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1],
BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3],
(nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE)))
- sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
}
switch (nodePoint->gameobject_type)
@@ -658,7 +659,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
0, 0, 0, 0, RESPAWN_ONE_DAY);
}
- //sLog->outError("BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
+ //sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap());
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
@@ -837,6 +838,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
{
case GO_HORDE_GATE_1:
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
+ break;
case GO_HORDE_GATE_2:
case GO_ALLIANCE_GATE_1:
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
@@ -907,7 +909,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
if (!goinfo)
{
- sLog->outErrorDb("Transport ID: %u will not be loaded, gameobject_template missing", goEntry);
+ sLog->outError(LOG_FILTER_SQL, "Transport ID: %u will not be loaded, gameobject_template missing", goEntry);
delete t;
return NULL;
}
@@ -917,7 +919,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
// skip transports with empty waypoints list
{
- sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
+ sLog->outError(LOG_FILTER_SQL, "Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
delete t;
return NULL;
}
@@ -930,7 +932,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
float o = 1;
// creates the Gameobject
- if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 100, 0))
+ if (!t->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), goEntry, mapid, x, y, z, o, 255, 0))
{
delete t;
return NULL;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 0974c96a991..f39b1ba5540 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
@@ -86,7 +86,7 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("BattlegroundNA: Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundNA: Killer player not found");
return;
}
@@ -115,7 +115,7 @@ void BattlegroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4537: // buff trigger?
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -147,7 +147,7 @@ bool BattlegroundNA::SetupBattleground()
|| !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|| !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
{
- sLog->outErrorDb("BatteGroundNA: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundNA: Failed to spawn some object!");
return false;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index 6a626217a4e..7fa9980a77c 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
@@ -86,7 +86,7 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killer player not found");
return;
}
@@ -116,7 +116,7 @@ void BattlegroundRL::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4697: // buff trigger?
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -146,7 +146,7 @@ bool BattlegroundRL::SetupBattleground()
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|| !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
{
- sLog->outErrorDb("BatteGroundRL: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundRL: Failed to spawn some object!");
return false;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
index 6869a899305..769df5445c7 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
@@ -130,7 +130,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("BattlegroundRV: Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundRV: Killer player not found");
return;
}
@@ -162,7 +162,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 5474:
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -214,7 +214,7 @@ bool BattlegroundRV::SetupBattleground()
)
{
- sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundRV: Failed to spawn some object!");
return false;
}
return true;
@@ -245,6 +245,6 @@ void BattlegroundRV::TogglePillarCollision()
gob->SendUpdateToPlayer(player);
}
}
-
+
SetPillarCollision(!apply);
} \ No newline at end of file
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 6d784488aad..58f7cabc72d 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -56,6 +56,8 @@ void BattlegroundSA::Reset()
GateStatus[i] = BG_SA_GATE_OK;
ShipsStarted = false;
gateDestroyed = false;
+ _notEvenAScratch[BG_TEAM_ALLIANCE] = true;
+ _notEvenAScratch[BG_TEAM_HORDE] = true;
Status = BG_SA_WARMUP;
}
@@ -160,7 +162,7 @@ bool BattlegroundSA::ResetObjs()
if (!sg)
{
- sLog->outError("SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
return false;
}
@@ -173,7 +175,7 @@ bool BattlegroundSA::ResetObjs()
{
GraveyardStatus[i] = ((Attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE);
if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE)? ALLIANCE : HORDE)))
- sLog->outError("SOTA: couldn't spawn GY: %u", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "SOTA: couldn't spawn GY: %u", i);
}
}
@@ -534,16 +536,16 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
if (eventType == go->GetGOInfo()->building.damagedEvent)
{
- uint32 i = GetGateIDFromDestroyEventID(eventType);
+ uint32 i = getGateIdFromDamagedOrDestroyEventId(eventType);
GateStatus[i] = BG_SA_GATE_DAMAGED;
- uint32 uws = GetWorldStateFromGateID(i);
+ uint32 uws = getWorldStateFromGateId(i);
if (uws)
UpdateWorldState(uws, GateStatus[i]);
}
if (eventType == go->GetGOInfo()->building.destroyedEvent)
{
- if (go->GetGOInfo()->building.destroyedEvent == 19837)
+ if (go->GetGOInfo()->building.destroyedEvent == BG_SA_EVENT_ANCIENT_GATE_DESTROYED)
SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED);
else
SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str());
@@ -553,13 +555,13 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name.c_str());
}
-void BattlegroundSA::HandleKillUnit(Creature* unit, Player* killer)
+void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
{
- if (!unit)
- return;
-
- if (unit->GetEntry() == NPC_DEMOLISHER_SA)
+ if (creature->GetEntry() == NPC_DEMOLISHER_SA)
+ {
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
+ _notEvenAScratch[Attackers] = false;
+ }
}
/*
@@ -603,7 +605,7 @@ void BattlegroundSA::DemolisherStartState(bool start)
void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
{
- uint32 i = GetGateIDFromDestroyEventID(go->GetGOInfo()->building.destroyedEvent);
+ uint32 i = getGateIdFromDamagedOrDestroyEventId(go->GetGOInfo()->building.destroyedEvent);
if (!GateStatus[i])
return;
@@ -612,7 +614,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
if (g->GetGOValue()->Building.Health == 0)
{
GateStatus[i] = BG_SA_GATE_DESTROYED;
- uint32 uws = GetWorldStateFromGateID(i);
+ uint32 uws = getWorldStateFromGateId(i);
if (uws)
UpdateWorldState(uws, GateStatus[i]);
bool rewardHonor = true;
@@ -720,8 +722,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
DelCreature(BG_SA_MAXNPC + i);
GraveyardStatus[i] = Source->GetTeamId();
- WorldSafeLocsEntry const* sg = NULL;
- sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
+ WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
+ if (!sg)
+ {
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
+ return;
+ }
+
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE));
uint32 npc = 0;
uint32 flag = 0;
@@ -781,7 +788,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
SendWarningToAll(LANG_BG_SA_H_GY_SOUTH);
break;
default:
- ASSERT(0);
+ ASSERT(false);
break;
};
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 76a772ff978..fd11cb2c5ea 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -30,8 +30,8 @@ class BattlegroundSAScore : public BattlegroundScore
uint8 gates_destroyed;
};
-#define BG_SA_FLAG_AMOUNT 3
-#define BG_SA_DEMOLISHER_AMOUNT 4
+#define BG_SA_FLAG_AMOUNT 3
+#define BG_SA_DEMOLISHER_AMOUNT 4
enum BG_SA_Status
{
@@ -45,45 +45,66 @@ enum BG_SA_Status
enum BG_SA_GateState
{
- BG_SA_GATE_OK = 1,
- BG_SA_GATE_DAMAGED = 2,
- BG_SA_GATE_DESTROYED = 3
+ BG_SA_GATE_OK = 1,
+ BG_SA_GATE_DAMAGED = 2,
+ BG_SA_GATE_DESTROYED = 3
+};
+
+enum BG_SA_EventIdGate
+{
+ BG_SA_EVENT_BLUE_GATE_DAMAGED = 19040,
+ BG_SA_EVENT_BLUE_GATE_DESTROYED = 19045,
+
+ BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041,
+ BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046,
+
+ BG_SA_EVENT_RED_GATE_DAMAGED = 19042,
+ BG_SA_EVENT_RED_GATE_DESTROYED = 19047,
+
+ BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19043,
+ BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19048,
+
+ BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19044,
+ BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19049,
+
+ BG_SA_EVENT_ANCIENT_GATE_DAMAGED = 19836,
+ BG_SA_EVENT_ANCIENT_GATE_DESTROYED = 19837
};
enum BG_SA_Timers
{
- BG_SA_BOAT_START = 60*IN_MILLISECONDS,
- BG_SA_WARMUPLENGTH = 120*IN_MILLISECONDS,
- BG_SA_ROUNDLENGTH = 600*IN_MILLISECONDS
+ BG_SA_BOAT_START = 60 * IN_MILLISECONDS,
+ BG_SA_WARMUPLENGTH = 120 * IN_MILLISECONDS,
+ BG_SA_ROUNDLENGTH = 600 * IN_MILLISECONDS
};
enum BG_SA_WorldStates
{
- BG_SA_TIMER_MINS = 3559,
- BG_SA_TIMER_SEC_TENS = 3560,
- BG_SA_TIMER_SEC_DECS = 3561,
- BG_SA_ALLY_ATTACKS = 4352,
- BG_SA_HORDE_ATTACKS = 4353,
- BG_SA_PURPLE_GATEWS = 3614,
- BG_SA_RED_GATEWS = 3617,
- BG_SA_BLUE_GATEWS = 3620,
- BG_SA_GREEN_GATEWS = 3623,
- BG_SA_YELLOW_GATEWS = 3638,
- BG_SA_ANCIENT_GATEWS = 3849,
- BG_SA_LEFT_GY_ALLIANCE = 3635,
- BG_SA_RIGHT_GY_ALLIANCE = 3636,
- BG_SA_CENTER_GY_ALLIANCE = 3637,
- BG_SA_RIGHT_ATT_TOKEN_ALL = 3627,
- BG_SA_LEFT_ATT_TOKEN_ALL = 3626,
- BG_SA_LEFT_ATT_TOKEN_HRD = 3629,
- BG_SA_RIGHT_ATT_TOKEN_HRD = 3628,
- BG_SA_HORDE_DEFENCE_TOKEN = 3631,
- BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630,
- BG_SA_RIGHT_GY_HORDE = 3632,
- BG_SA_LEFT_GY_HORDE = 3633,
- BG_SA_CENTER_GY_HORDE = 3634,
- BG_SA_BONUS_TIMER = 0xdf3,
- BG_SA_ENABLE_TIMER = 3564,
+ BG_SA_TIMER_MINS = 3559,
+ BG_SA_TIMER_SEC_TENS = 3560,
+ BG_SA_TIMER_SEC_DECS = 3561,
+ BG_SA_ALLY_ATTACKS = 4352,
+ BG_SA_HORDE_ATTACKS = 4353,
+ BG_SA_PURPLE_GATEWS = 3614,
+ BG_SA_RED_GATEWS = 3617,
+ BG_SA_BLUE_GATEWS = 3620,
+ BG_SA_GREEN_GATEWS = 3623,
+ BG_SA_YELLOW_GATEWS = 3638,
+ BG_SA_ANCIENT_GATEWS = 3849,
+ BG_SA_LEFT_GY_ALLIANCE = 3635,
+ BG_SA_RIGHT_GY_ALLIANCE = 3636,
+ BG_SA_CENTER_GY_ALLIANCE = 3637,
+ BG_SA_RIGHT_ATT_TOKEN_ALL = 3627,
+ BG_SA_LEFT_ATT_TOKEN_ALL = 3626,
+ BG_SA_LEFT_ATT_TOKEN_HRD = 3629,
+ BG_SA_RIGHT_ATT_TOKEN_HRD = 3628,
+ BG_SA_HORDE_DEFENCE_TOKEN = 3631,
+ BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630,
+ BG_SA_RIGHT_GY_HORDE = 3632,
+ BG_SA_LEFT_GY_HORDE = 3633,
+ BG_SA_CENTER_GY_HORDE = 3634,
+ BG_SA_BONUS_TIMER = 0xdf3,
+ BG_SA_ENABLE_TIMER = 3564,
};
enum npc
@@ -122,14 +143,14 @@ enum BG_SA_NPCs
enum BG_SA_Boat
{
- BG_SA_BOAT_ONE_A =193182,
- BG_SA_BOAT_TWO_H =193183,
- BG_SA_BOAT_ONE_H =193184,
- BG_SA_BOAT_TWO_A =193185,
+ BG_SA_BOAT_ONE_A = 193182,
+ BG_SA_BOAT_TWO_H = 193183,
+ BG_SA_BOAT_ONE_H = 193184,
+ BG_SA_BOAT_TWO_A = 193185,
};
-const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] =
- {
+uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] =
+{
NPC_ANTI_PERSONNAL_CANNON,
NPC_ANTI_PERSONNAL_CANNON,
NPC_ANTI_PERSONNAL_CANNON,
@@ -140,25 +161,25 @@ const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] =
NPC_ANTI_PERSONNAL_CANNON,
NPC_ANTI_PERSONNAL_CANNON,
NPC_ANTI_PERSONNAL_CANNON,
- //4 beach demolishers
+ // 4 beach demolishers
NPC_DEMOLISHER_SA,
NPC_DEMOLISHER_SA,
NPC_DEMOLISHER_SA,
NPC_DEMOLISHER_SA,
- //Triggers
+ // Triggers
23472,
23472,
23472,
23472,
23472,
- //Used Demolisher Salesman
+ // Used Demolisher Salesman
NPC_RIGGER_SPARKLIGHT,
NPC_GORGRIL_RIGSPARK
- };
+};
-const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] =
+float const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] =
{
- //Cannons
+ // Cannons
{ 1436.429f, 110.05f, 41.407f, 5.4f },
{ 1404.9023f, 84.758f, 41.183f, 5.46f },
{ 1068.693f, -86.951f, 93.81f, 0.02f },
@@ -169,21 +190,21 @@ const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] =
{ 1249.634f, -224.189f, 66.72f, 0.635f },
{ 1236.213f, 92.287f, 64.965f, 5.751f },
{ 1215.11f, 57.772f, 64.739f, 5.78f },
- //Demolishers
+ // Demolishers
{ 1611.597656f, -117.270073f, 8.719355f, 2.513274f},
{ 1575.562500f, -158.421875f, 5.024450f, 2.129302f},
{ 1618.047729f, 61.424641f, 7.248210f, 3.979351f},
{ 1575.103149f, 98.873344f, 2.830360f, 3.752458f},
- //trigger
+ // Triggers
{ 1453.49f, -250.453f, 30.896f, 4.2883f},
{ 1377.05f, 97.036f, 30.8605f, 2.46539f},
{ 1186.05f, 58.8048f, 56.5491f, 2.75992f},
{ 1042.83f, -72.839f, 84.8145f, 3.58615f},
{ 1233.62f, -250.49f, 55.4036f, 3.7016f},
- //Npcs
+ // Npcs
{ 1348.644165f, -298.786469f, 31.080130f, 1.710423f},
{ 1358.191040f, 195.527786f, 31.018187f, 4.171337f},
- //Demolishers2
+ // Demolishers 2
{ 1371.055786f, -317.071136f, 35.007359f, 1.947460f},
{ 1424.034912f, -260.195190f, 31.084425f, 2.820013f},
{ 1353.139893f, 223.745438f, 35.265411f, 4.343684f},
@@ -221,7 +242,7 @@ enum BG_SA_Objects
BG_SA_MAXOBJ = BG_SA_BOMB+68
};
-const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
+float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
{
{ 1411.57f, 108.163f, 28.692f, 5.441f },
{ 1055.452f, -108.1f, 82.134f, 0.034f },
@@ -230,30 +251,30 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
{ 1214.681f, 81.21f, 53.413f, 5.745f },
{ 878.555f, -108.2f, 117.845f, 0.0f },
{ 836.5f, -108.8f, 120.219f, 0.0f },
- //Ships
+ // Ships
{ 2679.696777f, -826.891235f, 3.712860f, 5.78367f}, //rot2 1 rot3 0.0002f
{ 2574.003662f, 981.261475f, 2.603424f, 0.807696f},
- //Sigils
+ // Sigils
{ 1414.054f, 106.72f, 41.442f, 5.441f },
{ 1060.63f, -107.8f, 94.7f, 0.034f },
{ 1433.383f, -216.4f, 43.642f, 0.9736f },
{ 1230.75f, -210.724f, 67.611f, 0.5023f },
{ 1217.8f, 79.532f, 66.58f, 5.745f },
- //Flagpoles
+ // Flagpoles
{ 1215.114258f, -65.711861f, 70.084267f, -3.124123f},
{1338.863892f, -153.336533f, 30.895121f, -2.530723f},
{1309.124268f, 9.410645f, 30.893402f, -1.623156f},
- //Flags
+ // Flags
{ 1215.108032f, -65.715767f, 70.084267f, -3.124123f},
{ 1338.859253f, -153.327316f, 30.895077f, -2.530723f},
{ 1309.192017f, 9.416233f, 30.893402f, 1.518436f},
- //Portal
+ // Portal
{1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue
{1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green
{1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow
{1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple
{1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red
- //Bombs
+ // Bombs
{1333.45f, 211.354f, 31.0538f, 5.03666f},
{1334.29f, 209.582f, 31.0532f, 1.28088f},
{1332.72f, 210.049f, 31.0532f, 1.28088f},
@@ -337,7 +358,7 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
* to get horde ones.
*/
-const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] =
+uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] =
{
190722,
190727,
@@ -367,7 +388,7 @@ const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] =
190753
};
-const uint32 BG_SA_Factions[2] =
+uint32 const BG_SA_Factions[2] =
{
1732,
1735,
@@ -392,13 +413,13 @@ const uint32 BG_SA_GYEntries[BG_SA_MAX_GY] =
1348,
};
-const float BG_SA_GYOrientation[BG_SA_MAX_GY] =
+float const BG_SA_GYOrientation[BG_SA_MAX_GY] =
{
6.202f,
- 1.926f, //right capturable GY
- 3.917f, //left capturable GY
- 3.104f, //center, capturable
- 6.148f, //defender last GY
+ 1.926f, // right capturable GY
+ 3.917f, // left capturable GY
+ 3.104f, // center, capturable
+ 6.148f, // defender last GY
};
struct BG_SA_RoundScore
@@ -435,7 +456,7 @@ class BattlegroundSA : public Battleground
/// Called when a player deal damage to building (door)
virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
/// Called when a player kill a unit in bg
- virtual void HandleKillUnit(Creature* unit, Player* killer);
+ virtual void HandleKillUnit(Creature* creature, Player* killer);
/// Return the nearest graveyard where player can respawn
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/// Called when a player click on flag (graveyard flag)
@@ -443,34 +464,60 @@ class BattlegroundSA : public Battleground
/// Called when a player use a gamobject (relic)
virtual void EventPlayerUsedGO(Player* Source, GameObject* object);
/// Return gate id, relative to bg data, according to gameobject id
- uint32 GetGateIDFromDestroyEventID(uint32 id)
+ uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id)
{
- uint32 i = 0;
switch (id)
{
- case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed
- case 19045: i = BG_SA_BLUE_GATE; break; //blue gate
- case 19047: i = BG_SA_RED_GATE; break; //red gate
- case 19048: i = BG_SA_PURPLE_GATE; break; //purple gate
- case 19049: i = BG_SA_YELLOW_GATE; break; //yellow gate
- case 19837: i = BG_SA_ANCIENT_GATE; break; //ancient gate
+ // Green gate
+ case BG_SA_EVENT_GREEN_GATE_DAMAGED:
+ case BG_SA_EVENT_GREEN_GATE_DESTROYED:
+ return BG_SA_GREEN_GATE;
+ // Blue gate
+ case BG_SA_EVENT_BLUE_GATE_DAMAGED:
+ case BG_SA_EVENT_BLUE_GATE_DESTROYED:
+ return BG_SA_BLUE_GATE;
+ // Red gate
+ case BG_SA_EVENT_RED_GATE_DAMAGED:
+ case BG_SA_EVENT_RED_GATE_DESTROYED:
+ return BG_SA_RED_GATE;
+ // Purple gate
+ case BG_SA_EVENT_PURPLE_GATE_DAMAGED:
+ case BG_SA_EVENT_PURPLE_GATE_DESTROYED:
+ return BG_SA_PURPLE_GATE;
+ // Yellow gate
+ case BG_SA_EVENT_YELLOW_GATE_DAMAGED:
+ case BG_SA_EVENT_YELLOW_GATE_DESTROYED:
+ return BG_SA_YELLOW_GATE;
+ // Ancient gate
+ case BG_SA_EVENT_ANCIENT_GATE_DAMAGED:
+ case BG_SA_EVENT_ANCIENT_GATE_DESTROYED:
+ return BG_SA_ANCIENT_GATE;
+ default:
+ break;
}
- return i;
+ return 0;
}
/// Return worldstate id, according to door id
- uint32 GetWorldStateFromGateID(uint32 id)
+ uint32 getWorldStateFromGateId(uint32 id)
{
- uint32 uws = 0;
switch (id)
{
- case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break;
- case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break;
- case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break;
- case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break;
- case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break;
- case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break;
+ case BG_SA_GREEN_GATE:
+ return BG_SA_GREEN_GATEWS;
+ case BG_SA_YELLOW_GATE:
+ return BG_SA_YELLOW_GATEWS;
+ case BG_SA_BLUE_GATE:
+ return BG_SA_BLUE_GATEWS;
+ case BG_SA_RED_GATE:
+ return BG_SA_RED_GATEWS;
+ case BG_SA_PURPLE_GATE:
+ return BG_SA_PURPLE_GATEWS;
+ case BG_SA_ANCIENT_GATE:
+ return BG_SA_ANCIENT_GATEWS;
+ default:
+ break;
}
- return uws;
+ return 0;
}
/// Called on battleground ending
@@ -484,9 +531,12 @@ class BattlegroundSA : public Battleground
/// Update score board
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
- // Achievement Defense of the Ancients
+ // Achievement: Defense of the Ancients
bool gateDestroyed;
+ // Achievement: Not Even a Scratch
+ bool notEvenAScratch(uint32 team) const { return _notEvenAScratch[GetTeamIndexByTeamId(team)]; }
+
/// Id of attacker team
TeamId Attackers;
@@ -568,5 +618,7 @@ class BattlegroundSA : public Battleground
bool InitSecondRound;
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
+ // Achievement: Not Even a Scratch
+ bool _notEvenAScratch[BG_TEAMS_COUNT];
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 5a60e371204..ededaf15bb5 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -187,7 +187,12 @@ void BattlegroundWS::StartingEventOpenDoors()
for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
- // players joining later are not egible
+ SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY);
+ SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY);
+
+ // players joining later are not eligibles
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE);
}
@@ -246,7 +251,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)))
obj->Delete();
else
- sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
SetDroppedFlagGUID(0, team);
_bothFlagsKept = false;
@@ -471,7 +476,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
}
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
- if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
+ if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
{
if (Source->GetTeam() == ALLIANCE)
{
@@ -505,7 +510,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
}
//Horde flag on ground(not in base) (returned or picked up again)
- if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
+ if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
{
if (Source->GetTeam() == HORDE)
{
@@ -552,7 +557,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
if (!player)
{
- sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0);
this->RespawnFlag(ALLIANCE, false);
}
@@ -563,7 +568,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
if (!player)
{
- sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0);
this->RespawnFlag(HORDE, false);
}
@@ -632,7 +637,7 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4629: // unk4
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
@@ -667,21 +672,21 @@ bool BattlegroundWS::SetupBattleground()
|| !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY)
)
{
- sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
- sLog->outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
- sLog->outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!");
return false;
}
@@ -695,28 +700,40 @@ void BattlegroundWS::Reset()
//call parent's class reset
Battleground::Reset();
- m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
- m_FlagKeepers[BG_TEAM_HORDE] = 0;
+ m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
+ m_FlagKeepers[BG_TEAM_HORDE] = 0;
+
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
- m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
- bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
- m_ReputationCapture = (isBGWeekend) ? 45 : 35;
- m_HonorWinKills = (isBGWeekend) ? 3 : 1;
- m_HonorEndKills = (isBGWeekend) ? 4 : 2;
- // For WorldState
- _minutesElapsed = 0;
- _lastFlagCaptureTeam = 0;
-
- /* Spirit nodes is static at this BG and then not required deleting at BG reset.
- if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
- DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
- if (BgCreatures[WS_SPIRIT_MAIN_HORDE])
- DelCreature(WS_SPIRIT_MAIN_HORDE);
- */
+ m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
+
+ _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
+ _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
+
+ m_TeamScores[BG_TEAM_ALLIANCE] = 0;
+ m_TeamScores[BG_TEAM_HORDE] = 0;
+
+ if (sBattlegroundMgr->IsBGWeekend(GetTypeID()))
+ {
+ m_ReputationCapture = 45;
+ m_HonorWinKills = 3;
+ m_HonorEndKills = 4;
+ }
+ else
+ {
+ m_ReputationCapture = 35;
+ m_HonorWinKills = 1;
+ m_HonorEndKills = 2;
+ }
+ _minutesElapsed = 0;
+ _lastFlagCaptureTeam = 0;
+ _bothFlagsKept = false;
+ _flagDebuffState = 0;
+ _flagSpellForceTimer = 0;
+ _lastFlagCaptureTeam = 0;
+ _flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsDropTimer[BG_TEAM_HORDE] = 0;
+ _flagsTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsTimer[BG_TEAM_HORDE] = 0;
}
void BattlegroundWS::EndBattleground(uint32 winner)
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index 9ff2109e8f3..0f8bec7f0e5 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -17,6 +17,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
+file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
@@ -68,6 +69,7 @@ set(game_STAT_SRCS
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
+ ${sources_Battlefield}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
@@ -138,12 +140,13 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Calendar
${CMAKE_CURRENT_SOURCE_DIR}/Chat
${CMAKE_CURRENT_SOURCE_DIR}/Chat/Channels
- ${CMAKE_CURRENT_SOURCE_DIR}/Chat/Commands
${CMAKE_CURRENT_SOURCE_DIR}/Combat
${CMAKE_CURRENT_SOURCE_DIR}/Conditions
${CMAKE_CURRENT_SOURCE_DIR}/DataStores
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index cef68891890..80de42c0ce2 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -95,21 +95,21 @@ CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid)
CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
{
- CalendarInviteMap::iterator it = _invites.find(inviteId);
- if (it != _invites.end())
- return &(it->second);
+ CalendarInviteMap::iterator itr = _invites.find(inviteId);
+ if (itr != _invites.end())
+ return &(itr->second);
- sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
return NULL;
}
CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
{
- CalendarEventMap::iterator it = _events.find(eventId);
- if (it != _events.end())
- return &(it->second);
+ CalendarEventMap::iterator itr = _events.find(eventId);
+ if (itr != _events.end())
+ return &(itr->second);
- sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
return NULL;
}
@@ -149,7 +149,7 @@ void CalendarMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u calendar events", count);
+ sLog->outInfo(LOG_FILTER_CALENDAR, ">> Loaded %u calendar events", count);
count = 0;
// 0 1 2 3 4 5 6 7
@@ -176,7 +176,7 @@ void CalendarMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u calendar Invites", count);
+ sLog->outInfo(LOG_FILTER_CALENDAR, ">> Loaded %u calendar Invites", count);
*/
}
@@ -316,11 +316,6 @@ void CalendarMgr::AddAction(CalendarAction const& action)
if (!calendarEvent)
return;
- CalendarInviteIdList const& inviteIds = calendarEvent->GetInviteIdList();
- for (CalendarInviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it)
- if (uint64 invitee = RemoveInvite(*it))
- SendCalendarEventRemovedAlert(invitee, *calendarEvent);
-
RemoveEvent(eventId);
break;
}
@@ -447,7 +442,7 @@ bool CalendarMgr::AddEvent(CalendarEvent const& newEvent)
uint64 eventId = newEvent.GetEventId();
if (_events.find(eventId) != _events.end())
{
- sLog->outError("CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId);
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId);
return false;
}
@@ -460,12 +455,10 @@ bool CalendarMgr::RemoveEvent(uint64 eventId)
CalendarEventMap::iterator itr = _events.find(eventId);
if (itr == _events.end())
{
- sLog->outError("CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId);
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId);
return false;
}
- _events.erase(itr);
-
bool val = true;
CalendarInviteIdList const& invites = itr->second.GetInviteIdList();
@@ -474,8 +467,13 @@ bool CalendarMgr::RemoveEvent(uint64 eventId)
CalendarInvite* invite = GetInvite(*itrInvites);
if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId))
val = false;
+
+ if (uint64 invitee = RemoveInvite(*itrInvites))
+ SendCalendarEventRemovedAlert(invitee, itr->second);
}
+ _events.erase(itr);
+
return val;
}
@@ -496,13 +494,13 @@ bool CalendarMgr::AddInvite(CalendarInvite const& newInvite)
uint64 inviteId = newInvite.GetInviteId();
if (!inviteId)
{
- sLog->outError("CalendarMgr::AddInvite: Cant add Invite 0");
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::AddInvite: Cant add Invite 0");
return false;
}
if (_invites.find(inviteId) != _invites.end())
{
- sLog->outError("CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId);
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId);
return false;
}
@@ -518,7 +516,7 @@ uint64 CalendarMgr::RemoveInvite(uint64 inviteId)
CalendarInviteMap::iterator itr = _invites.find(inviteId);
if (itr == _invites.end())
{
- sLog->outError("CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId);
+ sLog->outError(LOG_FILTER_CALENDAR, "CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId);
return 0;
}
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 92cf4d750a8..c3845f16826 100755
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -36,20 +36,19 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
- if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
+ if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
m_flags |= CHANNEL_FLAG_TRADE;
- if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
+ if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
m_flags |= CHANNEL_FLAG_CITY;
- if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
+ if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
m_flags |= CHANNEL_FLAG_LFG;
else // for all other channels
m_flags |= CHANNEL_FLAG_NOT_LFG;
}
else // it's custom channel
{
- channel_id = 0;
m_flags |= CHANNEL_FLAG_CUSTOM;
// If storing custom channels in the db is enabled either load or save the channel
diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h
index ac030ffb73f..887e53f49a5 100755
--- a/src/server/game/Chat/Channels/ChannelMgr.h
+++ b/src/server/game/Chat/Channels/ChannelMgr.h
@@ -49,4 +49,3 @@ class HordeChannelMgr : public ChannelMgr {};
ChannelMgr* channelMgr(uint32 team);
#endif
-
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 7a4c17d1c5e..b5bad419c98 100755
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -38,13 +38,6 @@
bool ChatHandler::load_command_table = true;
-// wrapper for old-style handlers
-template<bool (ChatHandler::*F)(const char*)>
-bool OldHandler(ChatHandler* chatHandler, const char* args)
-{
- return (chatHandler->*F)(args);
-}
-
// get number of commands in table
static size_t getCommandTableSize(const ChatCommand* commands)
{
@@ -67,357 +60,6 @@ static size_t appendCommandTable(ChatCommand* target, const ChatCommand* source)
ChatCommand* ChatHandler::getCommandTable()
{
- static ChatCommand banCommandTable[] =
- {
- { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanAccountCommand>, "", NULL },
- { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanCharacterCommand>, "", NULL },
- { "playeraccount", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanAccountByCharCommand>, "", NULL },
- { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanIPCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand baninfoCommandTable[] =
- {
- { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanInfoAccountCommand>, "", NULL },
- { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanInfoCharacterCommand>, "", NULL },
- { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanInfoIPCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand banlistCommandTable[] =
- {
- { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanListAccountCommand>, "", NULL },
- { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanListCharacterCommand>, "", NULL },
- { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleBanListIPCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand castCommandTable[] =
- {
- { "back", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastBackCommand>, "", NULL },
- { "dist", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastDistCommand>, "", NULL },
- { "self", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastSelfCommand>, "", NULL },
- { "target", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastTargetCommand>, "", NULL },
- { "dest", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastDestCommand>, "", NULL },
- { "", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCastCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand characterDeletedCommandTable[] =
- {
- { "delete", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterDeletedDeleteCommand>, "", NULL },
- { "list", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleCharacterDeletedListCommand>, "", NULL },
- { "restore", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleCharacterDeletedRestoreCommand>, "", NULL },
- { "old", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterDeletedOldCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand characterCommandTable[] =
- {
- { "customize", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterCustomizeCommand>, "", NULL },
- { "changefaction", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterChangeFactionCommand>, "", NULL },
- { "changerace", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterChangeRaceCommand>, "", NULL },
- { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable},
- { "erase", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleCharacterEraseCommand>, "", NULL },
- { "level", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleCharacterLevelCommand>, "", NULL },
- { "rename", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterRenameCommand>, "", NULL },
- { "reputation", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterReputationCommand>, "", NULL },
- { "titles", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCharacterTitlesCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand channelSetCommandTable[] =
- {
- { "ownership", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChannelSetOwnership>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand channelCommandTable[] =
- {
- { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand groupCommandTable[] =
- {
- { "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL },
- { "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL },
- { "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand guildCommandTable[] =
- {
- { "create", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildCreateCommand>, "", NULL },
- { "delete", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildDeleteCommand>, "", NULL },
- { "invite", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildInviteCommand>, "", NULL },
- { "uninvite", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildUninviteCommand>, "", NULL },
- { "rank", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGuildRankCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand instanceCommandTable[] =
- {
- { "listbinds", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleInstanceListBindsCommand>, "", NULL },
- { "unbind", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleInstanceUnbindCommand>, "", NULL },
- { "stats", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleInstanceStatsCommand>, "", NULL },
- { "savedata", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleInstanceSaveDataCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand listCommandTable[] =
- {
- { "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListCreatureCommand>, "", NULL },
- { "item", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListItemCommand>, "", NULL },
- { "object", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListObjectCommand>, "", NULL },
- { "auras", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleListAurasCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand lookupPlayerCommandTable[] =
- {
- { "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL },
- { "account", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerAccountCommand>, "", NULL },
- { "email", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerEmailCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand lookupCommandTable[] =
- {
- { "area", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleLookupAreaCommand>, "", NULL },
- { "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupCreatureCommand>, "", NULL },
- { "event", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupEventCommand>, "", NULL },
- { "faction", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupFactionCommand>, "", NULL },
- { "item", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupItemCommand>, "", NULL },
- { "itemset", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupItemSetCommand>, "", NULL },
- { "object", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupObjectCommand>, "", NULL },
- { "quest", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupQuestCommand>, "", NULL },
- { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable },
- { "skill", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupSkillCommand>, "", NULL },
- { "spell", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupSpellCommand>, "", NULL },
- { "taxinode", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupTaxiNodeCommand>, "", NULL },
- { "tele", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleLookupTeleCommand>, "", NULL },
- { "title", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupTitleCommand>, "", NULL },
- { "map", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleLookupMapCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand petCommandTable[] =
- {
- { "create", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleCreatePetCommand>, "", NULL },
- { "learn", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePetLearnCommand>, "", NULL },
- { "unlearn", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePetUnlearnCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand pdumpCommandTable[] =
- {
- { "load", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpLoadCommand>, "", NULL },
- { "write", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpWriteCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand resetCommandTable[] =
- {
- { "achievements", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetAchievementsCommand>, "", NULL },
- { "honor", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetHonorCommand>, "", NULL },
- { "level", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetLevelCommand>, "", NULL },
- { "spells", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetSpellsCommand>, "", NULL },
- { "stats", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetStatsCommand>, "", NULL },
- { "talents", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetTalentsCommand>, "", NULL },
- { "all", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleResetAllCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand sendCommandTable[] =
- {
- { "items", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendItemsCommand>, "", NULL },
- { "mail", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSendMailCommand>, "", NULL },
- { "message", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendMessageCommand>, "", NULL },
- { "money", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendMoneyCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand serverIdleRestartCommandTable[] =
- {
- { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL },
- { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerIdleRestartCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand serverIdleShutdownCommandTable[] =
- {
- { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL },
- { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerIdleShutDownCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand serverRestartCommandTable[] =
- {
- { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL },
- { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerRestartCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand serverShutdownCommandTable[] =
- {
- { "cancel", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCancelCommand>, "", NULL },
- { "" , SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerShutDownCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand serverSetCommandTable[] =
- {
- { "difftime", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerSetDiffTimeCommand>, "", NULL },
- { "loglevel", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerSetLogLevelCommand>, "", NULL },
- { "logfilelevel", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerSetLogFileLevelCommand>, "", NULL },
- { "motd", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerSetMotdCommand>, "", NULL },
- { "closed", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerSetClosedCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand serverCommandTable[] =
- {
- { "corpses", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleServerCorpsesCommand>, "", NULL },
- { "exit", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerExitCommand>, "", NULL },
- { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable },
- { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable },
- { "info", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerInfoCommand>, "", NULL },
- { "motd", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerMotdCommand>, "", NULL },
- { "plimit", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerPLimitCommand>, "", NULL },
- { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable },
- { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable },
- { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable },
- { "togglequerylog", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerToggleQueryLogging>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand unbanCommandTable[] =
- {
- { "account", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanAccountCommand>, "", NULL },
- { "character", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanCharacterCommand>, "", NULL },
- { "playeraccount", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanAccountByCharCommand>, "", NULL },
- { "ip", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleUnBanIPCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand ticketResponseCommandTable[] =
- {
- { "append", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendCommand>, "", NULL },
- { "appendln", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendLnCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand ticketCommandTable[] =
- {
- { "list", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListCommand>, "", NULL },
- { "onlinelist", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListOnlineCommand>, "", NULL },
- { "viewname", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketGetByNameCommand>, "", NULL },
- { "viewid", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketGetByIdCommand>, "", NULL },
- { "close", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCloseByIdCommand>, "", NULL },
- { "closedlist", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListClosedCommand>, "", NULL },
- { "escalatedlist", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketListEscalatedCommand>, "", NULL },
- { "delete", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleGMTicketDeleteByIdCommand>, "", NULL },
- { "reset", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleGMTicketResetCommand>, "", NULL },
- { "assign", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketAssignToCommand>, "", NULL },
- { "unassign", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketUnAssignCommand>, "", NULL },
- { "comment", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCommentCommand>, "", NULL },
- { "togglesystem", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleToggleGMTicketSystem>, "", NULL },
- { "escalate", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketEscalateCommand>, "", NULL },
- { "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable },
- { "complete", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCompleteCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand commandTable[] =
- {
- { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable},
- { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },
- { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
- { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
- { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
- { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
- { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
- { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable },
- { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
- { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
-
- { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
-
- { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
- { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
-
- { "aura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAuraCommand>, "", NULL },
- { "unaura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnAuraCommand>, "", NULL },
- { "nameannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleNameAnnounceCommand>, "", NULL },
- { "gmnameannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMNameAnnounceCommand>, "", NULL },
- { "announce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleAnnounceCommand>, "", NULL },
- { "gmannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMAnnounceCommand>, "", NULL },
- { "notify", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleNotifyCommand>, "", NULL },
- { "gmnotify", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMNotifyCommand>, "", NULL },
- { "appear", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleAppearCommand>, "", NULL },
- { "summon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleSummonCommand>, "", NULL },
- { "groupsummon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGroupSummonCommand>, "", NULL },
- { "commands", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleCommandsCommand>, "", NULL },
- { "demorph", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleDeMorphCommand>, "", NULL },
- { "die", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDieCommand>, "", NULL },
- { "revive", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleReviveCommand>, "", NULL },
- { "dismount", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleDismountCommand>, "", NULL },
- { "guid", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleGUIDCommand>, "", NULL },
- { "help", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleHelpCommand>, "", NULL },
- { "itemmove", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleItemMoveCommand>, "", NULL },
- { "cooldown", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCooldownCommand>, "", NULL },
- { "unlearn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnLearnCommand>, "", NULL },
- { "distance", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGetDistanceCommand>, "", NULL },
- { "recall", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleRecallCommand>, "", NULL },
- { "save", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleSaveCommand>, "", NULL },
- { "saveall", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSaveAllCommand>, "", NULL },
- { "kick", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleKickPlayerCommand>, "", NULL },
- { "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable },
- { "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable },
- { "baninfo", SEC_ADMINISTRATOR, false, NULL, "", baninfoCommandTable },
- { "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable },
- { "start", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleStartCommand>, "", NULL },
- { "taxicheat", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleTaxiCheatCommand>, "", NULL },
- { "linkgrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLinkGraveCommand>, "", NULL },
- { "neargrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleNearGraveCommand>, "", NULL },
- { "explorecheat", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleExploreCheatCommand>, "", NULL },
- { "hover", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHoverCommand>, "", NULL },
- { "levelup", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLevelUpCommand>, "", NULL },
- { "showarea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleShowAreaCommand>, "", NULL },
- { "hidearea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHideAreaCommand>, "", NULL },
- { "additem", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAddItemCommand>, "", NULL },
- { "additemset", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAddItemSetCommand>, "", NULL },
- { "bank", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBankCommand>, "", NULL },
- { "wchange", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChangeWeather>, "", NULL },
- { "maxskill", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMaxSkillCommand>, "", NULL },
- { "setskill", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleSetSkillCommand>, "", NULL },
- { "whispers", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleWhispersCommand>, "", NULL },
- { "pinfo", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandlePInfoCommand>, "", NULL },
- { "respawn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleRespawnCommand>, "", NULL },
- { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
- { "mute", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleMuteCommand>, "", NULL },
- { "unmute", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleUnmuteCommand>, "", NULL },
- { "movegens", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMovegensCommand>, "", NULL },
- { "cometome", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleComeToMeCommand>, "", NULL },
- { "damage", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDamageCommand>, "", NULL },
- { "combatstop", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCombatStopCommand>, "", NULL },
- { "flusharenapoints", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleFlushArenaPointsCommand>, "", NULL },
- { "repairitems", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleRepairitemsCommand>, "", NULL },
- { "waterwalk", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleWaterwalkCommand>, "", NULL },
-
- { "freeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleFreezeCommand>, "", NULL },
- { "unfreeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleUnFreezeCommand>, "", NULL },
- { "listfreeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleListFreezeCommand>, "", NULL },
-
- { "possess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandlePossessCommand>, "", NULL },
- { "unpossess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnPossessCommand>, "", NULL },
- { "bindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBindSightCommand>, "", NULL },
- { "unbindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnbindSightCommand>, "", NULL },
- { "playall", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePlayAllCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
// cache for commands, needed because some commands are loaded dynamically through ScriptMgr
// cache is never freed and will show as a memory leak in diagnostic tools
// can't use vector as vector storage is implementation-dependent, eg, there can be alignment gaps between elements
@@ -429,25 +71,23 @@ ChatCommand* ChatHandler::getCommandTable()
{
// count total number of top-level commands
- size_t total = getCommandTableSize(commandTable);
+ size_t total = 0;
std::vector<ChatCommand*> const& dynamic = sScriptMgr->GetChatCommands();
for (std::vector<ChatCommand*>::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it)
total += getCommandTableSize(*it);
total += 1; // ending zero
// cache top-level commands
+ size_t added = 0;
commandTableCache = (ChatCommand*)malloc(sizeof(ChatCommand) * total);
memset(commandTableCache, 0, sizeof(ChatCommand) * total);
ACE_ASSERT(commandTableCache);
- size_t added = appendCommandTable(commandTableCache, commandTable);
for (std::vector<ChatCommand*>::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it)
added += appendCommandTable(commandTableCache + added, *it);
}
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS);
-
PreparedQueryResult result = WorldDatabase.Query(stmt);
-
if (result)
{
do
@@ -457,7 +97,8 @@ ChatCommand* ChatHandler::getCommandTable()
SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt8(), fields[2].GetString(), name);
- } while (result->NextRow());
+ }
+ while (result->NextRow());
}
}
@@ -760,12 +401,12 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text,
// expected subcommand by full name DB content
else if (*text)
{
- sLog->outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
return false;
}
if (table[i].SecurityLevel != security)
- sLog->outDetail("Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security);
table[i].SecurityLevel = security;
table[i].Help = help;
@@ -776,9 +417,9 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text,
if (!cmd.empty())
{
if (table == getCommandTable())
- sLog->outErrorDb("Table `command` have not existed command '%s', skip.", cmd.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Table `command` have not existed command '%s', skip.", cmd.c_str());
else
- sLog->outErrorDb("Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
}
return false;
@@ -1335,7 +976,7 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text)
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
char* cId = extractKeyFromLink(text, "Htele");
if (!cId)
- return false;
+ return NULL;
// id case (explicit or from shift link)
if (cId[0] >= '0' || cId[0] >= '9')
@@ -1507,7 +1148,7 @@ char* ChatHandler::extractQuotedArg(char* args)
{
char* space = strtok(args, "\"");
if (!space)
- return false;
+ return NULL;
return strtok(NULL, "\"");
}
}
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 0a39eb43ddb..269ebdd1d2f 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -119,264 +119,19 @@ class ChatHandler
GameObject* GetNearbyGameObject();
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
- bool HasSentErrorMessage() const { return sentErrorMessage;}
- void SetSentErrorMessage(bool val){ sentErrorMessage = val;};
- static bool LoadCommandTable() { return load_command_table;}
- static void SetLoadCommandTable(bool val){ load_command_table = val;};
+ bool HasSentErrorMessage() const { return sentErrorMessage; }
+ void SetSentErrorMessage(bool val){ sentErrorMessage = val; }
+ static bool LoadCommandTable() { return load_command_table; }
+ static void SetLoadCommandTable(bool val) { load_command_table = val; }
+ bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd);
- bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
- bool HandleNameAnnounceCommand(const char* args);
- bool HandleGMNameAnnounceCommand(const char* args);
- bool HandleGMAnnounceCommand(const char* args);
- bool HandleGMNotifyCommand(const char* args);
-
- bool HandleBanAccountCommand(const char* args);
- bool HandleBanAccountByCharCommand(const char* args);
- bool HandleBanCharacterCommand(const char* args);
- bool HandleBanIPCommand(const char* args);
- bool HandleBanInfoAccountCommand(const char* args);
- bool HandleBanInfoCharacterCommand(const char* args);
- bool HandleBanInfoIPCommand(const char* args);
- bool HandleBanListAccountCommand(const char* args);
- bool HandleBanListCharacterCommand(const char* args);
- bool HandleBanListIPCommand(const char* args);
-
- bool HandleCastCommand(const char *args);
- bool HandleCastBackCommand(const char *args);
- bool HandleCastDistCommand(const char *args);
- bool HandleCastSelfCommand(const char *args);
- bool HandleCastTargetCommand(const char *args);
- bool HandleCastDestCommand(const char *args);
-
- bool HandleCharacterCustomizeCommand(const char* args);
- bool HandleCharacterChangeFactionCommand(const char* args);
- bool HandleCharacterChangeRaceCommand(const char * args);
- bool HandleCharacterDeletedDeleteCommand(const char* args);
- bool HandleCharacterDeletedListCommand(const char* args);
- bool HandleCharacterDeletedRestoreCommand(const char* args);
- bool HandleCharacterDeletedOldCommand(const char* args);
- bool HandleCharacterEraseCommand(const char* args);
- bool HandleCharacterLevelCommand(const char* args);
- bool HandleCharacterRenameCommand(const char* args);
- bool HandleCharacterReputationCommand(const char* args);
- bool HandleCharacterTitlesCommand(const char* args);
-
- bool HandleChannelSetOwnership(const char *args);
-
- bool HandlePossessCommand(const char* args);
- bool HandleUnPossessCommand(const char* args);
- bool HandleBindSightCommand(const char* args);
- bool HandleUnbindSightCommand(const char* args);
-
- bool HandleGuildCreateCommand(const char* args);
- bool HandleGuildInviteCommand(const char* args);
- bool HandleGuildUninviteCommand(const char* args);
- bool HandleGuildRankCommand(const char* args);
- bool HandleGuildDeleteCommand(const char* args);
-
- bool HandleInstanceListBindsCommand(const char* args);
- bool HandleInstanceUnbindCommand(const char* args);
- bool HandleInstanceStatsCommand(const char* args);
- bool HandleInstanceSaveDataCommand(const char * args);
-
- bool HandleListAurasCommand(const char * args);
- bool HandleListCreatureCommand(const char* args);
- bool HandleListItemCommand(const char* args);
- bool HandleListObjectCommand(const char* args);
-
- bool HandleLookupAreaCommand(const char* args);
- bool HandleLookupCreatureCommand(const char* args);
- bool HandleLookupEventCommand(const char* args);
- bool HandleLookupFactionCommand(const char * args);
- bool HandleLookupItemCommand(const char * args);
- bool HandleLookupItemSetCommand(const char * args);
- bool HandleLookupObjectCommand(const char* args);
- bool HandleLookupPlayerIpCommand(const char* args);
- bool HandleLookupPlayerAccountCommand(const char* args);
- bool HandleLookupPlayerEmailCommand(const char* args);
- bool HandleLookupQuestCommand(const char* args);
- bool HandleLookupSkillCommand(const char* args);
- bool HandleLookupSpellCommand(const char* args);
- bool HandleLookupTaxiNodeCommand(const char * args);
- bool HandleLookupTeleCommand(const char * args);
- bool HandleLookupMapCommand(const char* args);
- bool HandleLookupTitleCommand(const char * args);
-
- bool HandlePDumpLoadCommand(const char *args);
- bool HandlePDumpWriteCommand(const char *args);
-
- bool HandleResetAchievementsCommand(const char * args);
- bool HandleResetAllCommand(const char * args);
- bool HandleResetHonorCommand(const char * args);
- bool HandleResetLevelCommand(const char * args);
- bool HandleResetSpellsCommand(const char* args);
- bool HandleResetStatsCommand(const char * args);
- bool HandleResetTalentsCommand(const char* args);
-
- bool HandleSendItemsCommand(const char* args);
- bool HandleSendMailCommand(const char* args);
- bool HandleSendMessageCommand(const char * args);
- bool HandleSendMoneyCommand(const char* args);
-
- bool HandleServerCorpsesCommand(const char* args);
- bool HandleServerExitCommand(const char* args);
- bool HandleServerIdleRestartCommand(const char* args);
- bool HandleServerIdleShutDownCommand(const char* args);
- bool HandleServerInfoCommand(const char* args);
- bool HandleServerMotdCommand(const char* args);
- bool HandleServerPLimitCommand(const char* args);
- bool HandleServerRestartCommand(const char* args);
- bool HandleServerSetLogLevelCommand(const char* args);
- bool HandleServerSetMotdCommand(const char* args);
- bool HandleServerShutDownCommand(const char* args);
- bool HandleServerShutDownCancelCommand(const char* args);
- bool HandleServerSetClosedCommand(const char* args);
- bool HandleServerToggleQueryLogging(const char* args);
-
- bool HandleServerSetLogFileLevelCommand(const char* args);
- bool HandleServerSetDiffTimeCommand(const char* args);
-
- bool HandleUnBanAccountCommand(const char* args);
- bool HandleUnBanAccountByCharCommand(const char* args);
- bool HandleUnBanCharacterCommand(const char* args);
- bool HandleUnBanIPCommand(const char* args);
-
- bool HandleHelpCommand(const char* args);
- bool HandleCommandsCommand(const char* args);
- bool HandleStartCommand(const char* args);
- bool HandleDismountCommand(const char* args);
- bool HandleSaveCommand(const char* args);
-
- bool HandleSummonCommand(const char* args);
- bool HandleAppearCommand(const char* args);
- bool HandleGroupSummonCommand(const char* args);
- bool HandleRecallCommand(const char* args);
- bool HandleAnnounceCommand(const char* args);
- bool HandleNotifyCommand(const char* args);
- bool HandleTaxiCheatCommand(const char* args);
- bool HandleWhispersCommand(const char* args);
-
- bool HandleGUIDCommand(const char* args);
- bool HandleItemMoveCommand(const char* args);
- bool HandleDeMorphCommand(const char* args);
- bool HandlePInfoCommand(const char* args);
- bool HandleMuteCommand(const char* args);
- bool HandleUnmuteCommand(const char* args);
- bool HandleMovegensCommand(const char* args);
- bool HandleFreezeCommand(const char *args);
- bool HandleUnFreezeCommand(const char *args);
- bool HandleListFreezeCommand(const char* args);
-
- bool HandleCooldownCommand(const char* args);
- bool HandleUnLearnCommand(const char* args);
- bool HandleGetDistanceCommand(const char* args);
- bool HandleDieCommand(const char* args);
- bool HandleDamageCommand(const char *args);
- bool HandleReviveCommand(const char* args);
- bool HandleAuraCommand(const char* args);
- bool HandleUnAuraCommand(const char* args);
- bool HandleLinkGraveCommand(const char* args);
- bool HandleNearGraveCommand(const char* args);
- bool HandleActivateObjectCommand(const char* args);
- bool HandleSpawnTransportCommand(const char* args);
- bool HandleExploreCheatCommand(const char* args);
- bool HandleHoverCommand(const char* args);
- bool HandleWaterwalkCommand(const char* args);
- bool HandleLevelUpCommand(const char* args);
- bool HandleShowAreaCommand(const char* args);
- bool HandleHideAreaCommand(const char* args);
- bool HandleAddItemCommand(const char* args);
- bool HandleAddItemSetCommand(const char* args);
- bool HandlePetUnlearnCommand(const char* args);
- bool HandlePetLearnCommand(const char* args);
- bool HandleCreatePetCommand(const char* args);
-
- bool HandleGroupLeaderCommand(const char* args);
- bool HandleGroupDisbandCommand(const char* args);
- bool HandleGroupRemoveCommand(const char* args);
-
- bool HandleBankCommand(const char* args);
- bool HandleChangeWeather(const char* args);
- bool HandleKickPlayerCommand(const char * args);
-
- // GM ticket command handlers
- bool HandleGMTicketListCommand(const char* args);
- bool HandleGMTicketListOnlineCommand(const char* args);
- bool HandleGMTicketListClosedCommand(const char* args);
- bool HandleGMTicketListEscalatedCommand(const char* args);
- bool HandleGMTicketGetByIdCommand(const char* args);
- bool HandleGMTicketGetByNameCommand(const char* args);
- bool HandleGMTicketCloseByIdCommand(const char* args);
- bool HandleGMTicketAssignToCommand(const char* args);
- bool HandleGMTicketUnAssignCommand(const char* args);
- bool HandleGMTicketCommentCommand(const char* args);
- bool HandleGMTicketDeleteByIdCommand(const char* args);
- bool HandleGMTicketResetCommand(const char* /* args */);
- bool HandleGMTicketReloadCommand(const char*);
- bool HandleToggleGMTicketSystem(const char* args);
- bool HandleGMTicketEscalateCommand(const char* args);
- bool HandleGMTicketCompleteCommand(const char* args);
- bool HandleGMTicketResponseAppendCommand(const char* args);
- bool HandleGMTicketResponseAppendLnCommand(const char* args);
-
- bool HandleMaxSkillCommand(const char* args);
- bool HandleSetSkillCommand(const char* args);
- bool HandleRespawnCommand(const char* args);
- bool HandleComeToMeCommand(const char *args);
- bool HandleCombatStopCommand(const char *args);
-
- /*bool HandleCharDeleteCommand(const char *args);
- bool HandleSendMessageCommand(const char * args);*/
-
- bool HandleFlushArenaPointsCommand(const char *args);
- bool HandlePlayAllCommand(const char* args);
- bool HandleRepairitemsCommand(const char* args);
-
- bool HandleTempGameObjectCommand(const char* args);
-
- //! Development Commands
-
- /*bool HandleQuestAdd(const char * args);
- bool HandleQuestRemove(const char * args);
- bool HandleQuestComplete(const char * args);*/
-
- //bool HandleSet32Bit(const char* args);
- bool HandleSaveAllCommand(const char* args);
-
- // Utility methods for commands
- bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit);
- bool HandleBanListHelper(PreparedQueryResult result);
- bool HandleBanHelper(BanMode mode, char const* args);
- bool HandleBanInfoHelper(uint32 accountid, char const* accountname);
- bool HandleUnBanHelper(BanMode mode, char const* args);
- void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel);
- void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id);
-
- // Stores informations about a deleted character
- struct DeletedInfo
- {
- uint32 lowguid; ///< the low GUID from the character
- std::string name; ///< the character name
- uint32 accountId; ///< the account id
- std::string accountName; ///< the account name
- time_t deleteDate; ///< the date at which the character has been deleted
- };
-
- typedef std::list<DeletedInfo> DeletedInfoList;
- bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString = "");
- std::string GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end);
- void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList);
- void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo);
-
private:
- bool _HandleGMTicketResponseAppendCommand(const char* args, bool newLine);
-
WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
// common global flag
diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp
deleted file mode 100755
index b2ac090c313..00000000000
--- a/src/server/game/Chat/Commands/Level0.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "World.h"
-#include "Player.h"
-#include "Chat.h"
-#include "ObjectAccessor.h"
-#include "Language.h"
-#include "AccountMgr.h"
-#include "SystemConfig.h"
-#include "revision.h"
-#include "Util.h"
-
-bool ChatHandler::HandleHelpCommand(const char* args)
-{
- char* cmd = strtok((char*)args, " ");
- if (!cmd)
- {
- ShowHelpForCommand(getCommandTable(), "help");
- ShowHelpForCommand(getCommandTable(), "");
- }
- else
- {
- if (!ShowHelpForCommand(getCommandTable(), cmd))
- SendSysMessage(LANG_NO_HELP_CMD);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
-{
- ShowHelpForCommand(getCommandTable(), "");
- return true;
-}
-
-bool ChatHandler::HandleStartCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- if (player->isInFlight())
- {
- SendSysMessage(LANG_YOU_IN_FLIGHT);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isInCombat())
- {
- SendSysMessage(LANG_YOU_IN_COMBAT);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
- {
- // if player is dead and stuck, send ghost to graveyard
- player->RepopAtGraveyard();
- return true;
- }
-
- // cast spell Stuck
- player->CastSpell(player, 7355, false);
- return true;
-}
-
-bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
-{
- uint32 playersNum = sWorld->GetPlayerCount();
- uint32 maxPlayersNum = sWorld->GetMaxPlayerCount();
- uint32 activeClientsNum = sWorld->GetActiveSessionCount();
- uint32 queuedClientsNum = sWorld->GetQueuedSessionCount();
- uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount();
- uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount();
- std::string uptime = secsToTimeString(sWorld->GetUptime());
- uint32 updateTime = sWorld->GetUpdateTime();
-
- SendSysMessage(_FULLVERSION);
- PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum);
- PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
- PSendSysMessage(LANG_UPTIME, uptime.c_str());
- PSendSysMessage(LANG_UPDATE_DIFF, updateTime);
- //! Can't use sWorld->ShutdownMsg here in case of console command
- if (sWorld->IsShuttingDown())
- PSendSysMessage(LANG_SHUTDOWN_TIMELEFT, secsToTimeString(sWorld->GetShutDownTimeLeft()).c_str());
-
- return true;
-}
-
-bool ChatHandler::HandleDismountCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- //If player is not mounted, so go out :)
- if (!player->IsMounted())
- {
- SendSysMessage(LANG_CHAR_NON_MOUNTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isInFlight())
- {
- SendSysMessage(LANG_YOU_IN_FLIGHT);
- SetSentErrorMessage(true);
- return false;
- }
-
- player->Dismount();
- player->RemoveAurasByType(SPELL_AURA_MOUNTED);
- return true;
-}
-
-bool ChatHandler::HandleSaveCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- // save GM account without delay and output message
- if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
- {
- if (Player* target = getSelectedPlayer())
- target->SaveToDB();
- else
- player->SaveToDB();
- SendSysMessage(LANG_PLAYER_SAVED);
- return true;
- }
-
- // save if the player has last been saved over 20 seconds ago
- uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
- if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
- player->SaveToDB();
-
- return true;
-}
-
-/// Display the 'Message of the day' for the realm
-bool ChatHandler::HandleServerMotdCommand(const char* /*args*/)
-{
- PSendSysMessage(LANG_MOTD_CURRENT, sWorld->GetMotd());
- return true;
-}
-
diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp
deleted file mode 100755
index a10a78a35ff..00000000000
--- a/src/server/game/Chat/Commands/Level1.cpp
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "TicketMgr.h"
-#include "Player.h"
-#include "AccountMgr.h"
-#include "Opcodes.h"
-#include "Chat.h"
-#include "Log.h"
-#include "MapManager.h"
-#include "ObjectAccessor.h"
-#include "Language.h"
-#include "CellImpl.h"
-#include "InstanceSaveMgr.h"
-#include "Util.h"
-#include "Group.h"
-
-#ifdef _DEBUG_VMAPS
-#include "VMapFactory.h"
-#endif
-
-bool ChatHandler::HandleNameAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string name("Console");
- if (WorldSession* session = GetSession())
- name = session->GetPlayer()->GetName();
-
- sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args);
- return true;
-}
-
-bool ChatHandler::HandleGMNameAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string name("Console");
- if (WorldSession* session = GetSession())
- name = session->GetPlayer()->GetName();
-
- sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args);
- return true;
-}
-
-// global announce
-bool ChatHandler::HandleAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char buff[2048];
- sprintf(buff, GetTrinityString(LANG_SYSTEMMESSAGE), args);
- sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
- return true;
-}
-
-// announce to logged in GMs
-bool ChatHandler::HandleGMAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- sWorld->SendGMText(LANG_GM_BROADCAST, args);
- return true;
-}
-
-//notification player at the screen
-bool ChatHandler::HandleNotifyCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string str = GetTrinityString(LANG_GLOBAL_NOTIFY);
- str += args;
-
- WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
- data << str;
- sWorld->SendGlobalMessage(&data);
-
- return true;
-}
-
-//notification GM at the screen
-bool ChatHandler::HandleGMNotifyCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string str = GetTrinityString(LANG_GM_NOTIFY);
- str += args;
-
- WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
- data << str;
- sWorld->SendGlobalGMMessage(&data);
-
- return true;
-}
-
-//Summon Player
-bool ChatHandler::HandleSummonCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- Player* _player = m_session->GetPlayer();
- if (target == _player || target_guid == _player->GetGUID())
- {
- PSendSysMessage(LANG_CANT_TELEPORT_SELF);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- std::string nameLink = playerLink(target_name);
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- if (target->IsBeingTeleported())
- {
- PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- Map* map = m_session->GetPlayer()->GetMap();
-
- if (map->IsBattlegroundOrArena())
- {
- // only allow if gm mode is on
- if (!_player->isGameMaster())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- // if both players are in different bgs
- else if (target->GetBattlegroundId() && m_session->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
- target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
-
- // all's well, set bg id
- // when porting out from the bg, it will be reset to 0
- target->SetBattlegroundId(m_session->GetPlayer()->GetBattlegroundId(), m_session->GetPlayer()->GetBattlegroundTypeId());
- // remember current position as entry point for return at bg end teleportation
- if (!target->GetMap()->IsBattlegroundOrArena())
- target->SetBattlegroundEntryPoint();
- }
- else if (map->IsDungeon())
- {
- Map* cMap = target->GetMap();
-
- if (cMap->Instanceable() && cMap->GetInstanceId() != map->GetInstanceId())
- target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
-
- // we are in instance, and can summon only player in our group with us as lead
- if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() ||
- (target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
- (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))
- // the last check is a bit excessive, but let it be, just in case
- {
- PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
- if (needReportToTarget(target))
- ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, playerLink(_player->GetName()).c_str());
-
- // stop flight if need
- if (target->isInFlight())
- {
- target->GetMotionMaster()->MovementExpired();
- target->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- target->SaveRecallPosition();
-
- // before GM
- float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
- target->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
- target->SetPhaseMask(m_session->GetPlayer()->GetPhaseMask(), true);
- }
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, target_guid))
- return false;
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), GetTrinityString(LANG_OFFLINE));
-
- // in point where GM stay
- Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(),
- m_session->GetPlayer()->GetPositionX(),
- m_session->GetPlayer()->GetPositionY(),
- m_session->GetPlayer()->GetPositionZ(),
- m_session->GetPlayer()->GetOrientation(),
- m_session->GetPlayer()->GetZoneId(),
- target_guid);
- }
-
- return true;
-}
-
-//Teleport to Player
-bool ChatHandler::HandleAppearCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- Player* _player = m_session->GetPlayer();
- if (target == _player || target_guid == _player->GetGUID())
- {
- SendSysMessage(LANG_CANT_TELEPORT_SELF);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- std::string chrNameLink = playerLink(target_name);
-
- Map* cMap = target->GetMap();
- if (cMap->IsBattlegroundOrArena())
- {
- // only allow if gm mode is on
- if (!_player->isGameMaster())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- // if both players are in different bgs
- else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
- _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
-
- // all's well, set bg id
- // when porting out from the bg, it will be reset to 0
- _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
- // remember current position as entry point for return at bg end teleportation
- if (!_player->GetMap()->IsBattlegroundOrArena())
- _player->SetBattlegroundEntryPoint();
- }
- else if (cMap->IsDungeon())
- {
- // we have to go to instance, and can go to player only if:
- // 1) we are in his group (either as leader or as member)
- // 2) we are not bound to any group and have GM mode on
- if (_player->GetGroup())
- {
- // we are in group, we can go only if we are in the player group
- if (_player->GetGroup() != target->GetGroup())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- // we are not in group, let's verify our GM mode
- if (!_player->isGameMaster())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- // if the player or the player's group is bound to another instance
- // the player will not be bound to another one
- InstancePlayerBind* pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid()));
- if (!pBind)
- {
- Group* group = _player->GetGroup();
- // if no bind exists, create a solo bind
- InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
- if (!gBind)
- if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
- _player->BindToInstance(save, !save->CanReset());
- }
-
- if (cMap->IsRaid())
- _player->SetRaidDifficulty(target->GetRaidDifficulty());
- else
- _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
- }
-
- PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
-
- // stop flight if need
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- // to point to see at target with same orientation
- float x, y, z;
- target->GetContactPoint(_player, x, y, z);
-
- _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
- _player->SetPhaseMask(target->GetPhaseMask(), true);
- }
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, target_guid))
- return false;
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
-
- // to point where player stay (if loaded)
- float x, y, z, o;
- uint32 map;
- bool in_flight;
- if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, target_guid))
- return false;
-
- // stop flight if need
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- _player->TeleportTo(map, x, y, z, _player->GetOrientation());
- }
-
- return true;
-}
-
-// Teleport player to last position
-bool ChatHandler::HandleRecallCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- if (target->IsBeingTeleported())
- {
- PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(target).c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- // stop flight if need
- if (target->isInFlight())
- {
- target->GetMotionMaster()->MovementExpired();
- target->CleanupAfterTaxiFlight();
- }
-
- target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
- return true;
-}
-
-//Enable On\OFF all taxi paths
-bool ChatHandler::HandleTaxiCheatCommand(const char* args)
-{
- if (!*args)
- {
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string argstr = (char*)args;
-
- Player* chr = getSelectedPlayer();
-
- if (!chr)
- chr = m_session->GetPlayer();
- else if (HasLowerSecurity(chr, 0)) // check online security
- return false;
-
- if (argstr == "on")
- {
- chr->SetTaxiCheater(true);
- PSendSysMessage(LANG_YOU_GIVE_TAXIS, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetNameLink().c_str());
- return true;
- }
-
- if (argstr == "off")
- {
- chr->SetTaxiCheater(false);
- PSendSysMessage(LANG_YOU_REMOVE_TAXIS, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetNameLink().c_str());
-
- return true;
- }
-
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
-}
-
-bool ChatHandler::HandleLookupAreaCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr (namepart, wnamepart))
- return false;
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // converting string that we try to find to lower case
- wstrToLower (wnamepart);
-
- // Search in AreaTable.dbc
- for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
- {
- AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
- if (areaEntry)
- {
- int loc = GetSessionDbcLocale();
- std::string name = areaEntry->area_name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo (name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = areaEntry->area_name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo (name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send area in "id - [name]" format
- std::ostringstream ss;
- if (m_session)
- ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[loc]<< "]|h|r";
- else
- ss << areaEntry->ID << " - " << name << ' ' << localeNames[loc];
-
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOAREAFOUND);
-
- return true;
-}
-
-//Find tele in game_tele order by name
-bool ChatHandler::HandleLookupTeleCommand(const char * args)
-{
- if (!*args)
- {
- SendSysMessage(LANG_COMMAND_TELE_PARAMETER);
- SetSentErrorMessage(true);
- return false;
- }
-
- char const* str = strtok((char*)args, " ");
- if (!str)
- return false;
-
- std::string namepart = str;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- std::ostringstream reply;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
- bool limitReached = false;
-
- GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
- for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
- {
- GameTele const* tele = &itr->second;
-
- if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
- continue;
-
- if (maxResults && count++ == maxResults)
- {
- limitReached = true;
- break;
- }
-
- if (m_session)
- reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
- else
- reply << " " << itr->first << ' ' << tele->name << "\n";
- }
-
- if (reply.str().empty())
- SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
- else
- PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
-
- if (limitReached)
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
-
- return true;
-}
-
-//Enable\Dissable accept whispers (for GM)
-bool ChatHandler::HandleWhispersCommand(const char* args)
-{
- if (!*args)
- {
- PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF));
- return true;
- }
-
- std::string argstr = (char*)args;
- // whisper on
- if (argstr == "on")
- {
- m_session->GetPlayer()->SetAcceptWhispers(true);
- SendSysMessage(LANG_COMMAND_WHISPERON);
- return true;
- }
-
- // whisper off
- if (argstr == "off")
- {
- // Remove all players from the Gamemaster's whisper whitelist
- m_session->GetPlayer()->ClearWhisperWhiteList();
- m_session->GetPlayer()->SetAcceptWhispers(false);
- SendSysMessage(LANG_COMMAND_WHISPEROFF);
- return true;
- }
-
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
-}
-
-//Save all players in the world
-bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
-{
- sObjectAccessor->SaveAllPlayers();
- SendSysMessage(LANG_PLAYERS_SAVED);
- return true;
-}
-
-//Send mail by command
-bool ChatHandler::HandleSendMailCommand(const char* args)
-{
- // format: name "subject text" "mail text"
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- //- TODO: Fix poor design
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
- MailDraft(subject, text)
- .SendMailTo(trans, MailReceiver(target, GUID_LOPART(target_guid)), sender);
-
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = playerLink(target_name);
- PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
-}
-
-//Summon group of player
-bool ChatHandler::HandleGroupSummonCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- Group* grp = target->GetGroup();
-
- std::string nameLink = GetNameLink(target);
-
- if (!grp)
- {
- PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- Map* gmMap = m_session->GetPlayer()->GetMap();
- bool to_instance = gmMap->Instanceable();
-
- // we are in instance, and can summon only player in our group with us as lead
- if (to_instance && (
- !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
- (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID())))
- // the last check is a bit excessive, but let it be, just in case
- {
- SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
- SetSentErrorMessage(true);
- return false;
- }
-
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* player = itr->getSource();
-
- if (!player || player == m_session->GetPlayer() || !player->GetSession())
- continue;
-
- // check online security
- if (HasLowerSecurity(player, 0))
- return false;
-
- std::string plNameLink = GetNameLink(player);
-
- if (player->IsBeingTeleported() == true)
- {
- PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- if (to_instance)
- {
- Map* plMap = player->GetMap();
-
- if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
- {
- // cannot summon from instance to instance
- PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
- if (needReportToTarget(player))
- ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
-
- // stop flight if need
- if (player->isInFlight())
- {
- player->GetMotionMaster()->MovementExpired();
- player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- player->SaveRecallPosition();
-
- // before GM
- float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
- player->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
- }
-
- return true;
-}
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
deleted file mode 100755
index cc638193b5a..00000000000
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ /dev/null
@@ -1,1186 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "DBCStores.h"
-#include "ObjectMgr.h"
-#include "Player.h"
-#include "Item.h"
-#include "GameObject.h"
-#include "Opcodes.h"
-#include "Chat.h"
-#include "MapManager.h"
-#include "Language.h"
-#include "World.h"
-#include "GameEventMgr.h"
-#include "SpellMgr.h"
-#include "PoolMgr.h"
-#include "AccountMgr.h"
-#include "WaypointManager.h"
-#include "Util.h"
-#include <cctype>
-#include <iostream>
-#include <fstream>
-#include <map>
-#include "OutdoorPvPMgr.h"
-#include "Transport.h"
-#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
-#include "CreatureGroups.h"
-#include "ace/INET_Addr.h"
-
-//mute player for some times
-bool ChatHandler::HandleMuteCommand(const char* args)
-{
- char* nameStr;
- char* delayStr;
- extractOptFirstArg((char*)args, &nameStr, &delayStr);
- if (!delayStr)
- return false;
-
- char *mutereason = strtok(NULL, "\r");
- std::string mutereasonstr = "No reason";
- if (mutereason != NULL)
- mutereasonstr = mutereason;
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid);
-
- // find only player from same account if any
- if (!target)
- if (WorldSession* session = sWorld->FindSession(accountId))
- target = session->GetPlayer();
-
- uint32 notspeaktime = (uint32) atoi(delayStr);
-
- // must have strong lesser security level
- if (HasLowerSecurity (target, target_guid, true))
- return false;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
-
- if (target)
- {
- // Target is online, mute will be in effect right away.
- int64 muteTime = time(NULL) + notspeaktime * MINUTE;
- target->GetSession()->m_muteTime = muteTime;
-
- stmt->setInt64(0, muteTime);
-
- ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str());
- }
- else
- {
- // Target is offline, mute will be in effect starting from the next login.
- int32 muteTime = -int32(notspeaktime * MINUTE);
-
- stmt->setInt64(0, muteTime);
- }
-
- stmt->setUInt32(1, accountId);
-
- LoginDatabase.Execute(stmt);
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notspeaktime, mutereasonstr.c_str());
-
- return true;
-}
-
-//unmute player
-bool ChatHandler::HandleUnmuteCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid);
-
- // find only player from same account if any
- if (!target)
- if (WorldSession* session = sWorld->FindSession(accountId))
- target = session->GetPlayer();
-
- // must have strong lesser security level
- if (HasLowerSecurity (target, target_guid, true))
- return false;
-
- if (target)
- {
- if (target->CanSpeak())
- {
- SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
- SetSentErrorMessage(true);
- return false;
- }
-
- target->GetSession()->m_muteTime = 0;
- }
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
-
- stmt->setInt64(0, 0);
- stmt->setUInt32(1, accountId);
-
- LoginDatabase.Execute(stmt);
-
- if (target)
- ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
- return true;
-}
-
-bool ChatHandler::HandleGUIDCommand(const char* /*args*/)
-{
- uint64 guid = m_session->GetPlayer()->GetSelection();
-
- if (guid == 0)
- {
- SendSysMessage(LANG_NO_SELECTION);
- SetSentErrorMessage(true);
- return false;
- }
-
- PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
- return true;
-}
-
- //move item to other slot
-bool ChatHandler::HandleItemMoveCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char* pParam1 = strtok((char*)args, " ");
- if (!pParam1)
- return false;
-
- char* pParam2 = strtok(NULL, " ");
- if (!pParam2)
- return false;
-
- uint8 srcslot = (uint8)atoi(pParam1);
- uint8 dstslot = (uint8)atoi(pParam2);
-
- if (srcslot == dstslot)
- return true;
-
- if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot, true))
- return false;
-
- if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstslot, false))
- return false;
-
- uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot);
- uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot);
-
- m_session->GetPlayer()->SwapItem(src, dst);
-
- return true;
-}
-
-//demorph player or unit
-bool ChatHandler::HandleDeMorphCommand(const char* /*args*/)
-{
- Unit* target = getSelectedUnit();
- if (!target)
- target = m_session->GetPlayer();
-
- // check online security
- else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0))
- return false;
-
- target->DeMorph();
-
- return true;
-}
-
-//kick player
-bool ChatHandler::HandleKickPlayerCommand(const char *args)
-{
- Player* target = NULL;
- std::string playerName;
- if (!extractPlayerTarget((char*)args, &target, NULL, &playerName))
- return false;
-
- if (m_session && target == m_session->GetPlayer())
- {
- SendSysMessage(LANG_COMMAND_KICKSELF);
- SetSentErrorMessage(true);
- return false;
- }
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
- sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
- else
- PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
-
- target->GetSession()->KickPlayer();
- return true;
-}
-
-//show info of player
-bool ChatHandler::HandlePInfoCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
-
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
-
- if (sObjectMgr->GetPlayerNameByGUID(parseGUID, target_name))
- {
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
- target_guid = parseGUID;
- }
- else if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- uint32 accId = 0;
- uint32 money = 0;
- uint32 total_player_time = 0;
- uint8 level = 0;
- uint32 latency = 0;
- uint8 race;
- uint8 Class;
- int64 muteTime = 0;
- int64 banTime = -1;
- uint32 mapId;
- uint32 areaId;
- uint32 phase = 0;
-
- // get additional information from Player object
- if (target)
- {
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- accId = target->GetSession()->GetAccountId();
- money = target->GetMoney();
- total_player_time = target->GetTotalPlayedTime();
- level = target->getLevel();
- latency = target->GetSession()->GetLatency();
- race = target->getRace();
- Class = target->getClass();
- muteTime = target->GetSession()->m_muteTime;
- mapId = target->GetMapId();
- areaId = target->GetAreaId();
- phase = target->GetPhaseMask();
- }
- // get additional information from DB
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, target_guid))
- return false;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
- stmt->setUInt32(0, GUID_LOPART(target_guid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- return false;
-
- Field* fields = result->Fetch();
- total_player_time = fields[0].GetUInt32();
- level = fields[1].GetUInt8();
- money = fields[2].GetUInt32();
- accId = fields[3].GetUInt32();
- race = fields[4].GetUInt8();
- Class = fields[5].GetUInt8();
- mapId = fields[6].GetUInt16();
- areaId = fields[7].GetUInt16();
- }
-
- std::string username = GetTrinityString(LANG_ERROR);
- std::string email = GetTrinityString(LANG_ERROR);
- std::string last_ip = GetTrinityString(LANG_ERROR);
- uint32 security = 0;
- std::string last_login = GetTrinityString(LANG_ERROR);
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
- stmt->setInt32(0, int32(realmID));
- stmt->setUInt32(1, accId);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- if (result)
- {
- Field* fields = result->Fetch();
- username = fields[0].GetString();
- security = fields[1].GetUInt8();
- email = fields[2].GetString();
- muteTime = fields[5].GetUInt64();
-
- if (email.empty())
- email = "-";
-
- if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
- {
- last_ip = fields[3].GetString();
- last_login = fields[4].GetString();
-
- uint32 ip = inet_addr(last_ip.c_str());
-#if TRINITY_ENDIAN == BIGENDIAN
- EndianConvertReverse(ip);
-#endif
-
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
-
- stmt->setUInt32(0, ip);
-
- PreparedQueryResult result2 = WorldDatabase.Query(stmt);
-
- if (result2)
- {
- Field* fields2 = result2->Fetch();
- last_ip.append(" (");
- last_ip.append(fields2[0].GetString());
- last_ip.append(")");
- }
- }
- else
- {
- last_ip = "-";
- last_login = "-";
- }
- }
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency);
-
- std::string bannedby = "unknown";
- std::string banreason = "";
-
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
- stmt->setUInt32(0, accId);
- PreparedQueryResult result2 = LoginDatabase.Query(stmt);
- if (!result2)
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
- stmt->setUInt32(0, GUID_LOPART(target_guid));
- result2 = CharacterDatabase.Query(stmt);
- }
-
- if (result2)
- {
- Field* fields = result2->Fetch();
- banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
- bannedby = fields[2].GetString();
- banreason = fields[3].GetString();
- }
-
- if (muteTime > 0)
- PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
-
- if (banTime >= 0)
- PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
-
- std::string race_s, Class_s;
- switch (race)
- {
- case RACE_HUMAN: race_s = "Human"; break;
- case RACE_ORC: race_s = "Orc"; break;
- case RACE_DWARF: race_s = "Dwarf"; break;
- case RACE_NIGHTELF: race_s = "Night Elf"; break;
- case RACE_UNDEAD_PLAYER: race_s = "Undead"; break;
- case RACE_TAUREN: race_s = "Tauren"; break;
- case RACE_GNOME: race_s = "Gnome"; break;
- case RACE_TROLL: race_s = "Troll"; break;
- case RACE_BLOODELF: race_s = "Blood Elf"; break;
- case RACE_DRAENEI: race_s = "Draenei"; break;
- }
- switch (Class)
- {
- case CLASS_WARRIOR: Class_s = "Warrior"; break;
- case CLASS_PALADIN: Class_s = "Paladin"; break;
- case CLASS_HUNTER: Class_s = "Hunter"; break;
- case CLASS_ROGUE: Class_s = "Rogue"; break;
- case CLASS_PRIEST: Class_s = "Priest"; break;
- case CLASS_DEATH_KNIGHT: Class_s = "Death Knight"; break;
- case CLASS_SHAMAN: Class_s = "Shaman"; break;
- case CLASS_MAGE: Class_s = "Mage"; break;
- case CLASS_WARLOCK: Class_s = "Warlock"; break;
- case CLASS_DRUID: Class_s = "Druid"; break;
- }
-
- std::string timeStr = secsToTimeString(total_player_time, true, true);
- uint32 gold = money /GOLD;
- uint32 silv = (money % GOLD) / SILVER;
- uint32 copp = (money % GOLD) % SILVER;
- PSendSysMessage(LANG_PINFO_LEVEL, race_s.c_str(), Class_s.c_str(), timeStr.c_str(), level, gold, silv, copp);
-
- // Add map, zone, subzone and phase to output
- int locale = GetSessionDbcLocale();
- std::string areaName = "<unknown>";
- std::string zoneName = "";
-
- MapEntry const* map = sMapStore.LookupEntry(mapId);
-
- AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
- if (area)
- {
- areaName = area->area_name[locale];
-
- AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
-
- if (zone)
- zoneName = zone->area_name[locale];
- }
-
- if (target)
- {
- if (!zoneName.empty())
- PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
- else
- PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
- }
- else
- PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
-
- return true;
-}
-
-//rename characters
-bool ChatHandler::HandleCharacterRenameCommand(const char* args)
-{
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- if (target)
- {
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str());
- target->SetAtLoginFlag(AT_LOGIN_RENAME);
- }
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, targetGuid))
- return false;
-
- std::string oldNameLink = playerLink(targetName);
-
- PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
- stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
-
- CharacterDatabase.Execute(stmt);
- }
-
- return true;
-}
-
-// customize characters
-bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
-{
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
- stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
-
- if (target)
- {
- PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
- target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
-
- stmt->setUInt32(1, target->GetGUIDLow());
- }
- else
- {
- std::string oldNameLink = playerLink(targetName);
-
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
-
- PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
- }
-
- CharacterDatabase.Execute(stmt);
-
- return true;
-}
-
-bool ChatHandler::HandleCharacterChangeFactionCommand(const char* args)
-{
- Player* target;
- uint64 targetGuid;
- std::string targetName;
-
- if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
- stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION));
-
- if (target)
- {
- PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
- target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
-
- stmt->setUInt32(1, target->GetGUIDLow());
- }
- else
- {
- std::string oldNameLink = playerLink(targetName);
-
- PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
-
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
- }
-
- CharacterDatabase.Execute(stmt);
-
- return true;
-}
-
-bool ChatHandler::HandleCharacterChangeRaceCommand(const char * args)
-{
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
- stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE));
-
- if (target)
- {
- // TODO : add text into database
- PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str());
- target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
-
- stmt->setUInt32(1, target->GetGUIDLow());
- }
- else
- {
- std::string oldNameLink = playerLink(targetName);
-
- // TODO : add text into database
- PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
-
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
- }
-
- CharacterDatabase.Execute(stmt);
-
- return true;
-}
-
-bool ChatHandler::HandleCharacterReputationCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- LocaleConstant loc = GetSessionDbcLocale();
-
- FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
- for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
- {
- const FactionState& faction = itr->second;
- FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID);
- char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
- ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
- std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]);
- std::ostringstream ss;
- if (m_session)
- ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
- else
- ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
-
- ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
-
- if (faction.Flags & FACTION_FLAG_VISIBLE)
- ss << GetTrinityString(LANG_FACTION_VISIBLE);
- if (faction.Flags & FACTION_FLAG_AT_WAR)
- ss << GetTrinityString(LANG_FACTION_ATWAR);
- if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
- ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
- if (faction.Flags & FACTION_FLAG_HIDDEN)
- ss << GetTrinityString(LANG_FACTION_HIDDEN);
- if (faction.Flags & FACTION_FLAG_INVISIBLE_FORCED)
- ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
- if (faction.Flags & FACTION_FLAG_INACTIVE)
- ss << GetTrinityString(LANG_FACTION_INACTIVE);
-
- SendSysMessage(ss.str().c_str());
- }
- return true;
-}
-
-bool ChatHandler::HandleLookupEventCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
- GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
-
- for (uint32 id = 0; id < events.size(); ++id)
- {
- GameEventData const& eventData = events[id];
-
- std::string descr = eventData.description;
- if (descr.empty())
- continue;
-
- if (Utf8FitTo(descr, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : "";
-
- if (m_session)
- PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
- else
- PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_NOEVENTFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleCombatStopCommand(const char* args)
-{
- Player* target = NULL;
-
- if (args && strlen(args) > 0)
- {
- target = sObjectAccessor->FindPlayerByName(args);
- if (!target)
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- if (!target)
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- target->CombatStop();
- target->getHostileRefManager().deleteReferences();
- return true;
-}
-
-bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
-{
- std::string ip;
- int32 limit;
- char* limit_str;
-
- Player *chr = getSelectedPlayer();
- if (!*args)
- {
- // NULL only if used from console
- if (!chr || chr == GetSession()->GetPlayer())
- return false;
-
- ip = chr->GetSession()->GetRemoteAddress();
- limit = -1;
- }
- else
- {
- ip = strtok ((char*)args, " ");
- limit_str = strtok (NULL, " ");
- limit = limit_str ? atoi (limit_str) : -1;
- }
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
- stmt->setString(0, ip);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- return LookupPlayerSearchCommand(result, limit);
-}
-
-bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string account = strtok ((char*)args, " ");
- char* limit_str = strtok (NULL, " ");
- int32 limit = limit_str ? atoi (limit_str) : -1;
-
- if (!AccountMgr::normalizeString (account))
- return false;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
- stmt->setString(0, account);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- return LookupPlayerSearchCommand (result, limit);
-}
-
-bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string email = strtok ((char*)args, " ");
- char* limit_str = strtok (NULL, " ");
- int32 limit = limit_str ? atoi (limit_str) : -1;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
- stmt->setString(0, email);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- return LookupPlayerSearchCommand(result, limit);
-}
-
-bool ChatHandler::LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit)
-{
- if (!result)
- {
- PSendSysMessage(LANG_NO_PLAYERS_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- int i = 0;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
- do
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- Field* fields = result->Fetch();
- uint32 acc_id = fields[0].GetUInt32();
- std::string acc_name = fields[1].GetString();
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
- stmt->setUInt32(0, acc_id);
- PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
-
- if (result2)
- {
- PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, acc_name.c_str(), acc_id);
-
- uint64 guid = 0;
- std::string name;
-
- do
- {
- Field* charfields = result2->Fetch();
- guid = charfields[0].GetUInt64();
- name = charfields[1].GetString();
-
- PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid);
- ++i;
-
- } while (result2->NextRow() && (limit == -1 || i < limit));
- }
- } while (result->NextRow());
-
- if (i == 0) // empty accounts only
- {
- PSendSysMessage(LANG_NO_PLAYERS_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-/// Triggering corpses expire check in world
-bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
-{
- sObjectAccessor->RemoveOldCorpses();
- return true;
-}
-
-bool ChatHandler::HandleRepairitemsCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- // Repair items
- target->DurabilityRepairAll(false, 0, false);
-
- PSendSysMessage(LANG_YOU_REPAIR_ITEMS, GetNameLink(target).c_str());
- if (needReportToTarget(target))
- ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetNameLink().c_str());
- return true;
-}
-
-bool ChatHandler::HandleWaterwalkCommand(const char* args)
-{
- if (!*args)
- return false;
-
- Player* player = getSelectedPlayer();
-
- if (!player)
- {
- PSendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- // check online security
- if (HasLowerSecurity(player, 0))
- return false;
-
- if (strncmp(args, "on", 3) == 0)
- player->SetMovement(MOVE_WATER_WALK); // ON
- else if (strncmp(args, "off", 4) == 0)
- player->SetMovement(MOVE_LAND_WALK); // OFF
- else
- {
- SendSysMessage(LANG_USE_BOL);
- return false;
- }
-
- PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
- if (needReportToTarget(player))
- ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetNameLink().c_str());
- return true;
-}
-
-bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
- Creature* creatureTarget = getSelectedCreature();
-
- if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
- {
- PSendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
- // Creatures with family 0 crashes the server
- if (cInfo->family == 0)
- {
- PSendSysMessage("This creature cannot be tamed. (family id: 0).");
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->GetPetGUID())
- {
- PSendSysMessage("You already have a pet");
- SetSentErrorMessage(true);
- return false;
- }
-
- // Everything looks OK, create new pet
- Pet* pet = new Pet(player, HUNTER_PET);
- if (!pet->CreateBaseAtCreature(creatureTarget))
- {
- delete pet;
- PSendSysMessage("Error 1");
- return false;
- }
-
- creatureTarget->setDeathState(JUST_DIED);
- creatureTarget->RemoveCorpse();
- creatureTarget->SetHealth(0); // just for nice GM-mode view
-
- pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
- pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
-
- if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
- {
- sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
- PSendSysMessage("Error 2");
- delete pet;
- return false;
- }
-
- // prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
-
- pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
- // this enables pet details window (Shift+P)
- pet->InitPetCreateSpells();
- pet->SetFullHealth();
-
- pet->GetMap()->AddToMap(pet->ToCreature());
-
- // visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
-
- player->SetMinion(pet, true);
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- player->PetSpellInitialize();
-
- return true;
-}
-
-bool ChatHandler::HandlePetLearnCommand(const char* args)
-{
- if (!*args)
- return false;
-
- Player* player = m_session->GetPlayer();
- Pet* pet = player->GetPet();
-
- if (!pet)
- {
- PSendSysMessage("You have no pet");
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 spellId = extractSpellIdFromLink((char*)args);
-
- if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
- return false;
-
- // Check if pet already has it
- if (pet->HasSpell(spellId))
- {
- PSendSysMessage("Pet already has spell: %u", spellId);
- SetSentErrorMessage(true);
- return false;
- }
-
- // Check if spell is valid
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
- if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
- SetSentErrorMessage(true);
- return false;
- }
-
- pet->learnSpell(spellId);
-
- PSendSysMessage("Pet has learned spell %u", spellId);
- return true;
-}
-
-bool ChatHandler::HandlePetUnlearnCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* player = m_session->GetPlayer();
- Pet* pet = player->GetPet();
-
- if (!pet)
- {
- PSendSysMessage("You have no pet");
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 spellId = extractSpellIdFromLink((char*)args);
-
- if (pet->HasSpell(spellId))
- pet->removeSpell(spellId, false);
- else
- PSendSysMessage("Pet doesn't have that spell");
-
- return true;
-}
-
-bool ChatHandler::HandleLookupTitleCommand(const char* args)
-{
- if (!*args)
- return false;
-
- // can be NULL in console call
- Player* target = getSelectedPlayer();
-
- // title name have single string arg for player name
- char const* targetName = target ? target->GetName() : "NAME";
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- uint32 counter = 0; // Counter for figure out that we found smth.
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in CharTitles.dbc
- for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
- {
- CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if (titleInfo)
- {
- int loc = GetSessionDbcLocale();
- std::string name = titleInfo->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = titleInfo->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && counter == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : "";
-
- char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
- ? GetTrinityString(LANG_ACTIVE)
- : "";
-
- char titleNameStr[80];
- snprintf(titleNameStr, 80, name.c_str(), targetName);
-
- // send title in "id (idx:idx) - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
- else
- PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);
-
- ++counter;
- }
- }
- }
- if (counter == 0) // if counter == 0 then we found nth
- SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
- return true;
-}
-
-bool ChatHandler::HandleCharacterTitlesCommand(const char* args)
-{
- if (!*args)
- return false;
-
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- LocaleConstant loc = GetSessionDbcLocale();
- char const* targetName = target->GetName();
- char const* knownStr = GetTrinityString(LANG_KNOWN);
-
- // Search in CharTitles.dbc
- for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
- {
- CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
- if (titleInfo && target->HasTitle(titleInfo))
- {
- std::string name = titleInfo->name[loc];
- if (name.empty())
- continue;
-
- char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
- ? GetTrinityString(LANG_ACTIVE)
- : "";
-
- char titleNameStr[80];
- snprintf(titleNameStr, 80, name.c_str(), targetName);
-
- // send title in "id (idx:idx) - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
- else
- PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
- }
- }
- return true;
-}
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
deleted file mode 100755
index 045d5e144a9..00000000000
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ /dev/null
@@ -1,4772 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "GuildMgr.h"
-#include "AuctionHouseMgr.h"
-#include "AccountMgr.h"
-#include "PlayerDump.h"
-#include "SpellMgr.h"
-#include "Player.h"
-#include "Opcodes.h"
-#include "GameObject.h"
-#include "Chat.h"
-#include "Log.h"
-#include "Guild.h"
-#include "ObjectAccessor.h"
-#include "MapManager.h"
-#include "Language.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "Weather.h"
-#include "PointMovementGenerator.h"
-#include "TargetedMovementGenerator.h"
-#include "SkillDiscovery.h"
-#include "SkillExtraItems.h"
-#include "SystemConfig.h"
-#include "Config.h"
-#include "Util.h"
-#include "ItemEnchantmentMgr.h"
-#include "BattlegroundMgr.h"
-#include "InstanceSaveMgr.h"
-#include "InstanceScript.h"
-#include "CreatureEventAIMgr.h"
-#include "SpellAuraEffects.h"
-#include "DBCEnums.h"
-#include "ConditionMgr.h"
-#include "DisableMgr.h"
-#include "Transport.h"
-#include "WeatherMgr.h"
-#include "ScriptMgr.h"
-#include "CreatureTextMgr.h"
-#include "SmartAI.h"
-#include "Group.h"
-#include "ChannelMgr.h"
-
-bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/)
-{
- Player* SelectedPlayer = getSelectedPlayer();
- if (!SelectedPlayer)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- // each skills that have max skill value dependent from level seted to current level max skill value
- SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
- return true;
-}
-
-bool ChatHandler::HandleSetSkillCommand(const char *args)
-{
- // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
- char* skill_p = extractKeyFromLink((char*)args, "Hskill");
- if (!skill_p)
- return false;
-
- char *level_p = strtok (NULL, " ");
- if (!level_p)
- return false;
-
- char *max_p = strtok (NULL, " ");
-
- int32 skill = atoi(skill_p);
- if (skill <= 0)
- {
- PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
- SetSentErrorMessage(true);
- return false;
- }
-
- int32 level = atol(level_p);
-
- Player* target = getSelectedPlayer();
- if (!target)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- SkillLineEntry const* sl = sSkillLineStore.LookupEntry(skill);
- if (!sl)
- {
- PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string tNameLink = GetNameLink(target);
-
- if (!target->GetSkillValue(skill))
- {
- PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[GetSessionDbcLocale()]);
- SetSentErrorMessage(true);
- return false;
- }
-
- int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill);
-
- if (level <= 0 || level > max || max <= 0)
- return false;
-
- target->SetSkill(skill, target->GetSkillStep(skill), level, max);
- PSendSysMessage(LANG_SET_SKILL, skill, sl->name[GetSessionDbcLocale()], tNameLink.c_str(), level, max);
-
- return true;
-}
-
-bool ChatHandler::HandleUnLearnCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
- uint32 spell_id = extractSpellIdFromLink((char*)args);
- if (!spell_id)
- return false;
-
- char const* allStr = strtok(NULL, " ");
- bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
-
- Player* target = getSelectedPlayer();
- if (!target)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (allRanks)
- spell_id = sSpellMgr->GetFirstSpellInChain (spell_id);
-
- if (target->HasSpell(spell_id))
- target->removeSpell(spell_id, false, !allRanks);
- else
- SendSysMessage(LANG_FORGET_SPELL);
-
- if (GetTalentSpellCost(spell_id))
- target->SendTalentsInfoData(false);
-
- return true;
-}
-
-bool ChatHandler::HandleCooldownCommand(const char *args)
-{
- Player* target = getSelectedPlayer();
- if (!target)
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string tNameLink = GetNameLink(target);
-
- if (!*args)
- {
- target->RemoveAllSpellCooldown();
- PSendSysMessage(LANG_REMOVEALL_COOLDOWN, tNameLink.c_str());
- }
- else
- {
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell_id = extractSpellIdFromLink((char*)args);
- if (!spell_id)
- return false;
-
- if (!sSpellMgr->GetSpellInfo(spell_id))
- {
- PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- target->RemoveSpellCooldown(spell_id, true);
- PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
- }
- return true;
-}
-
-bool ChatHandler::HandleAddItemCommand(const char *args)
-{
- if (!*args)
- return false;
-
- uint32 itemId = 0;
-
- if (args[0] == '[') // [name] manual form
- {
- char* citemName = strtok((char*)args, "]");
-
- if (citemName && citemName[0])
- {
- std::string itemName = citemName+1;
- WorldDatabase.EscapeString(itemName);
-
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
- stmt->setString(0, itemName);
- PreparedQueryResult result = WorldDatabase.Query(stmt);
-
- if (!result)
- {
- PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName+1);
- SetSentErrorMessage(true);
- return false;
- }
- itemId = result->Fetch()->GetUInt16();
- }
- else
- return false;
- }
- else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
- {
- char* cId = extractKeyFromLink((char*)args, "Hitem");
- if (!cId)
- return false;
- itemId = atol(cId);
- }
-
- char* ccount = strtok(NULL, " ");
-
- int32 count = 1;
-
- if (ccount)
- count = strtol(ccount, NULL, 10);
-
- if (count == 0)
- count = 1;
-
- Player* player = m_session->GetPlayer();
- Player* plTarget = getSelectedPlayer();
- if (!plTarget)
- plTarget = player;
-
- sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
-
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemId);
- if (!pProto)
- {
- PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
- SetSentErrorMessage(true);
- return false;
- }
-
- //Subtract
- if (count < 0)
- {
- plTarget->DestroyItemCount(itemId, -count, true, false);
- PSendSysMessage(LANG_REMOVEITEM, itemId, -count, GetNameLink(plTarget).c_str());
- return true;
- }
-
- //Adding items
- uint32 noSpaceForCount = 0;
-
- // check space and find places
- ItemPosCountVec dest;
- InventoryResult msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
- if (msg != EQUIP_ERR_OK) // convert to possible store amount
- count -= noSpaceForCount;
-
- if (count == 0 || dest.empty()) // can't add any
- {
- PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
- SetSentErrorMessage(true);
- return false;
- }
-
- Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
-
- // remove binding (let GM give it to another player later)
- if (player == plTarget)
- for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
- if (Item* item1 = player->GetItemByPos(itr->pos))
- item1->SetBinding(false);
-
- if (count > 0 && item)
- {
- player->SendNewItem(item, count, false, true);
- if (player != plTarget)
- plTarget->SendNewItem(item, count, true, false);
- }
-
- if (noSpaceForCount > 0)
- PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
-
- return true;
-}
-
-bool ChatHandler::HandleAddItemSetCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cId = extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
- if (!cId)
- return false;
-
- uint32 itemsetId = atol(cId);
-
- // prevent generation all items with itemset field value '0'
- if (itemsetId == 0)
- {
- PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemsetId);
- SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = m_session->GetPlayer();
- Player* playerTarget = getSelectedPlayer();
- if (!playerTarget)
- playerTarget = player;
-
- sLog->outDetail(GetTrinityString(LANG_ADDITEMSET), itemsetId);
-
- bool found = false;
- ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
- for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
- {
- if (itr->second.ItemSet == itemsetId)
- {
- found = true;
- ItemPosCountVec dest;
- InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
- if (msg == EQUIP_ERR_OK)
- {
- Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
-
- // remove binding (let GM give it to another player later)
- if (player == playerTarget)
- item->SetBinding(false);
-
- player->SendNewItem(item, 1, false, true);
- if (player != playerTarget)
- playerTarget->SendNewItem(item, 1, true, false);
- }
- else
- {
- player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
- PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
- }
- }
- }
-
- if (!found)
- {
- PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemsetId);
-
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleListItemCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cId = extractKeyFromLink((char*)args, "Hitem");
- if (!cId)
- return false;
-
- uint32 item_id = atol(cId);
- if (!item_id)
- {
- PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
- if (!itemProto)
- {
- PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* c_count = strtok(NULL, " ");
- int _count = c_count ? atol(c_count) : 10;
-
- if (_count < 0)
- return false;
- uint32 count = uint32(_count);
-
- PreparedQueryResult result;
-
- // inventory case
- uint32 inv_count = 0;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
- stmt->setUInt32(0, item_id);
- result = CharacterDatabase.Query(stmt);
-
- if (result)
- inv_count = (*result)[0].GetUInt64();
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY);
- stmt->setUInt32(0, item_id);
- stmt->setUInt32(1, count);
- result = CharacterDatabase.Query(stmt);
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 item_guid = fields[0].GetUInt32();
- uint32 item_bag = fields[1].GetUInt32();
- uint8 item_slot = fields[2].GetUInt8();
- uint32 owner_guid = fields[3].GetUInt32();
- uint32 owner_acc = fields[4].GetUInt32();
- std::string owner_name = fields[5].GetString();
-
- char const* item_pos = 0;
- if (Player::IsEquipmentPos(item_bag, item_slot))
- item_pos = "[equipped]";
- else if (Player::IsInventoryPos(item_bag, item_slot))
- item_pos = "[in inventory]";
- else if (Player::IsBankPos(item_bag, item_slot))
- item_pos = "[in bank]";
- else
- item_pos = "";
-
- PSendSysMessage(LANG_ITEMLIST_SLOT, item_guid, owner_name.c_str(), owner_guid, owner_acc, item_pos);
- }
- while (result->NextRow());
-
- uint32 res_count = uint32(result->GetRowCount());
-
- if (count > res_count)
- count -= res_count;
- else if (count)
- count = 0;
- }
-
- // mail case
- uint32 mail_count = 0;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM);
- stmt->setUInt32(0, item_id);
- result = CharacterDatabase.Query(stmt);
-
- if (result)
- mail_count = (*result)[0].GetUInt64();
-
- if (count > 0)
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY);
- stmt->setUInt32(0, item_id);
- stmt->setUInt32(1, count);
- result = CharacterDatabase.Query(stmt);
- }
- else
- result = PreparedQueryResult(NULL);
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 item_guid = fields[0].GetUInt32();
- uint32 item_s = fields[1].GetUInt32();
- uint32 item_r = fields[2].GetUInt32();
- uint32 item_s_acc = fields[3].GetUInt32();
- std::string item_s_name = fields[4].GetString();
- uint32 item_r_acc = fields[5].GetUInt32();
- std::string item_r_name = fields[6].GetString();
-
- char const* item_pos = "[in mail]";
-
- PSendSysMessage(LANG_ITEMLIST_MAIL, item_guid, item_s_name.c_str(), item_s, item_s_acc, item_r_name.c_str(), item_r, item_r_acc, item_pos);
- }
- while (result->NextRow());
-
- uint32 res_count = uint32(result->GetRowCount());
-
- if (count > res_count)
- count -= res_count;
- else if (count)
- count = 0;
- }
-
- // auction case
- uint32 auc_count = 0;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM);
- stmt->setUInt32(0, item_id);
- result = CharacterDatabase.Query(stmt);
-
- if (result)
- auc_count = (*result)[0].GetUInt64();
-
- if (count > 0)
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY);
- stmt->setUInt32(0, item_id);
- stmt->setUInt32(1, count);
- result = CharacterDatabase.Query(stmt);
- }
- else
- result = PreparedQueryResult(NULL);
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 item_guid = fields[0].GetUInt32();
- uint32 owner = fields[1].GetUInt32();
- uint32 owner_acc = fields[2].GetUInt32();
- std::string owner_name = fields[3].GetString();
-
- char const* item_pos = "[in auction]";
-
- PSendSysMessage(LANG_ITEMLIST_AUCTION, item_guid, owner_name.c_str(), owner, owner_acc, item_pos);
- }
- while (result->NextRow());
- }
-
- // guild bank case
- uint32 guild_count = 0;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM);
- stmt->setUInt32(0, item_id);
- result = CharacterDatabase.Query(stmt);
-
- if (result)
- guild_count = (*result)[0].GetUInt64();
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY);
- stmt->setUInt32(0, item_id);
- stmt->setUInt32(1, count);
- result = CharacterDatabase.Query(stmt);
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 item_guid = fields[0].GetUInt32();
- uint32 guild_guid = fields[1].GetUInt32();
- std::string guild_name = fields[2].GetString();
-
- char const* item_pos = "[in guild bank]";
-
- PSendSysMessage(LANG_ITEMLIST_GUILD, item_guid, guild_name.c_str(), guild_guid, item_pos);
- }
- while (result->NextRow());
-
- uint32 res_count = uint32(result->GetRowCount());
-
- if (count > res_count)
- count -= res_count;
- else if (count)
- count = 0;
- }
-
- if (inv_count + mail_count + auc_count + guild_count == 0)
- {
- SendSysMessage(LANG_COMMAND_NOITEMFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, item_id, inv_count + mail_count + auc_count + guild_count, inv_count, mail_count, auc_count, guild_count);
- return true;
-}
-
-bool ChatHandler::HandleListObjectCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
- char* cId = extractKeyFromLink((char*)args, "Hgameobject_entry");
- if (!cId)
- return false;
-
- uint32 go_id = atol(cId);
- if (!go_id)
- {
- PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(go_id);
- if (!gInfo)
- {
- PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* c_count = strtok(NULL, " ");
- int count = c_count ? atol(c_count) : 10;
-
- if (count < 0)
- return false;
-
- QueryResult result;
-
- uint32 obj_count = 0;
- result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id);
- if (result)
- obj_count = (*result)[0].GetUInt64();
-
- if (m_session)
- {
- Player* player = m_session->GetPlayer();
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), go_id, uint32(count));
- }
- else
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
- go_id, uint32(count));
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
- float x = fields[1].GetFloat();
- float y = fields[2].GetFloat();
- float z = fields[3].GetFloat();
- int mapid = fields[4].GetUInt16();
- uint32 entry = fields[5].GetUInt32();
-
- if (m_session)
- PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapid);
- else
- PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapid);
- } while (result->NextRow());
- }
-
- PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, go_id, obj_count);
- return true;
-}
-
-bool ChatHandler::HandleListCreatureCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
- char* cId = extractKeyFromLink((char*)args, "Hcreature_entry");
- if (!cId)
- return false;
-
- uint32 cr_id = atol(cId);
- if (!cr_id)
- {
- PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cr_id);
- if (!cInfo)
- {
- PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* c_count = strtok(NULL, " ");
- int count = c_count ? atol(c_count) : 10;
-
- if (count < 0)
- return false;
-
- QueryResult result;
-
- uint32 cr_count = 0;
- result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id);
- if (result)
- cr_count = (*result)[0].GetUInt64();
-
- if (m_session)
- {
- Player* player = m_session->GetPlayer();
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), cr_id, uint32(count));
- }
- else
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
- cr_id, uint32(count));
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
- float x = fields[1].GetFloat();
- float y = fields[2].GetFloat();
- float z = fields[3].GetFloat();
- int mapid = fields[4].GetUInt16();
-
- if (m_session)
- PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapid);
- else
- PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapid);
- } while (result->NextRow());
- }
-
- PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, cr_id, cr_count);
- return true;
-}
-
-bool ChatHandler::HandleLookupItemCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in `item_template`
- ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
- for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
- {
- int loc_idx = GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- {
- uint8 uloc_idx = uint8(loc_idx);
- if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId))
- {
- if (il->Name.size() > uloc_idx && !il->Name[uloc_idx].empty())
- {
- std::string name = il->Name[uloc_idx];
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
- else
- PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
- }
-
- std::string name = itr->second.Name1;
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
- else
- PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOITEMFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupItemSetCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in ItemSet.dbc
- for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
- {
- ItemSetEntry const* set = sItemSetStore.LookupEntry(id);
- if (set)
- {
- int loc = GetSessionDbcLocale();
- std::string name = set->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = set->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send item set in "id - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]);
- else
- PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]);
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOITEMSETFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupSkillCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // can be NULL in console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in SkillLine.dbc
- for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
- {
- SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id);
- if (skillInfo)
- {
- int loc = GetSessionDbcLocale();
- std::string name = skillInfo->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = skillInfo->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char valStr[50] = "";
- char const* knownStr = "";
- if (target && target->HasSkill(id))
- {
- knownStr = GetTrinityString(LANG_KNOWN);
- uint32 curValue = target->GetPureSkillValue(id);
- uint32 maxValue = target->GetPureMaxSkillValue(id);
- uint32 permValue = target->GetSkillPermBonusValue(id);
- uint32 tempValue = target->GetSkillTempBonusValue(id);
-
- char const* valFormat = GetTrinityString(LANG_SKILL_VALUES);
- snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue);
- }
-
- // send skill in "id - [namedlink locale]" format
- if (m_session)
- PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr);
- else
- PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr);
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOSKILLFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupSpellCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // can be NULL at console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in Spell.dbc
- for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
- {
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
- if (spellInfo)
- {
- int loc = GetSessionDbcLocale();
- std::string name = spellInfo->SpellName[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = spellInfo->SpellName[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- bool known = target && target->HasSpell(id);
- bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
-
- SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
-
- uint32 talentCost = GetTalentSpellCost(id);
-
- bool talent = (talentCost > 0);
- bool passive = spellInfo->IsPassive();
- bool active = target && target->HasAura(id);
-
- // unit32 used to prevent interpreting uint8 as char at output
- // find rank of learned spell for learning spell, or talent rank
- uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
-
- // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
- std::ostringstream ss;
- if (m_session)
- ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
- else
- ss << id << " - " << name;
-
- // include rank in link name
- if (rank)
- ss << GetTrinityString(LANG_SPELL_RANK) << rank;
-
- if (m_session)
- ss << ' ' << localeNames[loc] << "]|h|r";
- else
- ss << ' ' << localeNames[loc];
-
- if (talent)
- ss << GetTrinityString(LANG_TALENT);
- if (passive)
- ss << GetTrinityString(LANG_PASSIVE);
- if (learn)
- ss << GetTrinityString(LANG_LEARN);
- if (known)
- ss << GetTrinityString(LANG_KNOWN);
- if (active)
- ss << GetTrinityString(LANG_ACTIVE);
-
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupQuestCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // can be NULL at console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates();
- for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
- {
- Quest * qinfo = iter->second;
-
- int loc_idx = GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- {
- uint8 uloc_idx = uint8(loc_idx);
- if (QuestLocale const* il = sObjectMgr->GetQuestLocale(qinfo->GetQuestId()))
- {
- if (il->Title.size() > uloc_idx && !il->Title[uloc_idx].empty())
- {
- std::string title = il->Title[uloc_idx];
-
- if (Utf8FitTo(title, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* statusStr = "";
-
- if (target)
- {
- QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
-
- if (status == QUEST_STATUS_COMPLETE)
- {
- if (target->GetQuestRewardStatus(qinfo->GetQuestId()))
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
- else
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
- }
- else if (status == QUEST_STATUS_INCOMPLETE)
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
- }
-
- if (m_session)
- PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
- else
- PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
- }
-
- std::string title = qinfo->GetTitle();
- if (title.empty())
- continue;
-
- if (Utf8FitTo(title, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- char const* statusStr = "";
-
- if (target)
- {
- QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
-
- if (status == QUEST_STATUS_COMPLETE)
- {
- if (target->GetQuestRewardStatus(qinfo->GetQuestId()))
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
- else
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
- }
- else if (status == QUEST_STATUS_INCOMPLETE)
- statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
- }
-
- if (m_session)
- PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
- else
- PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOQUESTFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupCreatureCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr (namepart, wnamepart))
- return false;
-
- wstrToLower (wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
- for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
- {
- uint32 id = itr->second.Entry;
- uint8 localeIndex = GetSessionDbLocaleIndex();
- if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(id))
- {
- if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty())
- {
- std::string name = cl->Name[localeIndex];
-
- if (Utf8FitTo (name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
- else
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
-
- std::string name = itr->second.Name;
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
- else
- PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupObjectCommand(const char *args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
- for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
- {
- uint8 localeIndex = GetSessionDbLocaleIndex();
- if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(itr->second.entry))
- {
- if (gl->Name.size() > localeIndex && !gl->Name[localeIndex].empty())
- {
- std::string name = gl->Name[localeIndex];
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
- else
- PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
-
- if (!found)
- found = true;
-
- continue;
- }
- }
- }
-
- std::string name = itr->second.name;
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- if (m_session)
- PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
- else
- PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
-
- if (!found)
- found = true;
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
-
- return true;
-}
-
-bool ChatHandler::HandleLookupFactionCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // Can be NULL at console call
- Player* target = getSelectedPlayer();
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr (namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower (wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
- {
- FactionEntry const* factionEntry = sFactionStore.LookupEntry (id);
- if (factionEntry)
- {
- FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
-
- int loc = GetSessionDbcLocale();
- std::string name = factionEntry->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = factionEntry->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
- // or "id - [faction] [no reputation]" format
- std::ostringstream ss;
- if (m_session)
- ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[loc] << "]|h|r";
- else
- ss << id << " - " << name << ' ' << localeNames[loc];
-
- if (repState) // and then target != NULL also
- {
- uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry);
- std::string rankName = GetTrinityString(index);
-
- ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
-
- if (repState->Flags & FACTION_FLAG_VISIBLE)
- ss << GetTrinityString(LANG_FACTION_VISIBLE);
- if (repState->Flags & FACTION_FLAG_AT_WAR)
- ss << GetTrinityString(LANG_FACTION_ATWAR);
- if (repState->Flags & FACTION_FLAG_PEACE_FORCED)
- ss << GetTrinityString(LANG_FACTION_PEACE_FORCED);
- if (repState->Flags & FACTION_FLAG_HIDDEN)
- ss << GetTrinityString(LANG_FACTION_HIDDEN);
- if (repState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
- ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
- if (repState->Flags & FACTION_FLAG_INACTIVE)
- ss << GetTrinityString(LANG_FACTION_INACTIVE);
- }
- else
- ss << GetTrinityString(LANG_FACTION_NOREPUTATION);
-
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
-{
- if (!*args)
- return false;
-
- std::string namepart = args;
- std::wstring wnamepart;
-
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- // converting string that we try to find to lower case
- wstrToLower(wnamepart);
-
- bool found = false;
- uint32 count = 0;
- uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
-
- // Search in TaxiNodes.dbc
- for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
- {
- TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id);
- if (nodeEntry)
- {
- int loc = GetSessionDbcLocale();
- std::string name = nodeEntry->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
- {
- if (loc == GetSessionDbcLocale())
- continue;
-
- name = nodeEntry->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- if (maxResults && count++ == maxResults)
- {
- PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
- return true;
- }
-
- // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
- if (m_session)
- PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc],
- nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
- else
- PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
- nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
-
- if (!found)
- found = true;
- }
- }
- }
- if (!found)
- SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND);
- return true;
-}
-
-bool ChatHandler::HandleLookupMapCommand(const char *args)
-{
- if (!*args)
- return false;
-
- /*std::string namepart = args;
- std::wstring wnamepart;
-
- // converting string that we try to find to lower case
- if (!Utf8toWStr(namepart, wnamepart))
- return false;
-
- wstrToLower(wnamepart);
-
- bool found = false;
-
- // search in Map.dbc
- for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
- {
- MapEntry const* MapInfo = sMapStore.LookupEntry(id);
- if (MapInfo)
- {
- uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
-
- std::string name = MapInfo->name[loc];
- if (name.empty())
- continue;
-
- if (!Utf8FitTo(name, wnamepart))
- {
- loc = LOCALE_enUS;
- for (; loc < TOTAL_LOCALES; loc++)
- {
- if (m_session && loc == m_session->GetSessionDbcLocale())
- continue;
-
- name = MapInfo->name[loc];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wnamepart))
- break;
- }
- }
-
- if (loc < TOTAL_LOCALES)
- {
- // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
- std::ostringstream ss;
-
- if (m_session)
- ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']';
- else // console
- ss << id << " - [" << name << ']';
-
- if (MapInfo->IsContinent())
- ss << GetTrinityString(LANG_CONTINENT);
-
- switch (MapInfo->map_type)
- {
- case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break;
- case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break;
- case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break;
- }
-
- if (MapInfo->IsRaid())
- ss << GetTrinityString(LANG_RAID);
-
- if (MapInfo->SupportsHeroicMode())
- ss << GetTrinityString(LANG_HEROIC);
-
- uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
-
- std::string ResetTimeRaidStr;
- if (ResetTimeRaid)
- ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false);
-
- uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
- std::string ResetTimeHeroicStr;
- if (ResetTimeHeroic)
- ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false);
-
- if (MapInfo->IsMountAllowed())
- ss << GetTrinityString(LANG_MOUNTABLE);
-
- if (ResetTimeRaid && !ResetTimeHeroic)
- PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str());
- else if (!ResetTimeRaid && ResetTimeHeroic)
- PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str());
- else if (ResetTimeRaid && ResetTimeHeroic)
- PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str());
- else
- SendSysMessage(ss.str().c_str());
-
- if (!found)
- found = true;
- }
- }
- }
-
- if (!found)
- SendSysMessage(LANG_COMMAND_NOMAPFOUND);
- */
- return true;
-}
-
-/** \brief GM command level 3 - Create a guild.
- *
- * This command allows a GM (level 3) to create a guild.
- *
- * The "args" parameter contains the name of the guild leader
- * and then the name of the guild.
- *
- */
-bool ChatHandler::HandleGuildCreateCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // if not guild name only (in "") then player name
- Player* target;
- if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
- return false;
-
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
- if (!tailStr)
- return false;
-
- char* guildStr = extractQuotedArg(tailStr);
- if (!guildStr)
- return false;
-
- std::string guildname = guildStr;
-
- if (target->GetGuildId())
- {
- SendSysMessage(LANG_PLAYER_IN_GUILD);
- return true;
- }
-
- Guild* guild = new Guild;
- if (!guild->Create(target, guildname))
- {
- delete guild;
- SendSysMessage(LANG_GUILD_NOT_CREATED);
- SetSentErrorMessage(true);
- return false;
- }
-
- sGuildMgr->AddGuild(guild);
- return true;
-}
-
-bool ChatHandler::HandleGuildInviteCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // if not guild name only (in "") then player name
- uint64 target_guid;
- if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &target_guid))
- return false;
-
- char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
- if (!tailStr)
- return false;
-
- char* guildStr = extractQuotedArg(tailStr);
- if (!guildStr)
- return false;
-
- std::string glName = guildStr;
- Guild* targetGuild = sGuildMgr->GetGuildByName(glName);
- if (!targetGuild)
- return false;
-
- // player's guild membership checked in AddMember before add
- return targetGuild->AddMember(target_guid);
-}
-
-bool ChatHandler::HandleGuildUninviteCommand(const char *args)
-{
- Player* target;
- uint64 target_guid;
- if (!extractPlayerTarget((char*)args, &target, &target_guid))
- return false;
-
- uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid);
- if (!glId)
- return false;
-
- Guild* targetGuild = sGuildMgr->GetGuildById(glId);
- if (!targetGuild)
- return false;
-
- targetGuild->DeleteMember(target_guid, false, true);
- return true;
-}
-
-bool ChatHandler::HandleGuildRankCommand(const char *args)
-{
- char* nameStr;
- char* rankStr;
- extractOptFirstArg((char*)args, &nameStr, &rankStr);
- if (!rankStr)
- return false;
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid);
- if (!glId)
- return false;
-
- Guild* targetGuild = sGuildMgr->GetGuildById (glId);
- if (!targetGuild)
- return false;
-
- uint32 newrank = uint32 (atoi (rankStr));
- return targetGuild->ChangeMemberRank(target_guid, newrank);
-}
-
-bool ChatHandler::HandleGuildDeleteCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* guildStr = extractQuotedArg((char*)args);
- if (!guildStr)
- return false;
-
- std::string gld = guildStr;
-
- Guild* targetGuild = sGuildMgr->GetGuildByName(gld);
- if (!targetGuild)
- return false;
-
- targetGuild->Disband();
-
- return true;
-}
-
-bool ChatHandler::HandleGetDistanceCommand(const char *args)
-{
- WorldObject* obj = NULL;
-
- if (*args)
- {
- uint64 guid = extractGuidFromLink((char*)args);
- if (guid)
- obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
-
- if (!obj)
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- obj = getSelectedUnit();
-
- if (!obj)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- PSendSysMessage(LANG_DISTANCE, m_session->GetPlayer()->GetDistance(obj), m_session->GetPlayer()->GetDistance2d(obj), m_session->GetPlayer()->GetExactDist(obj), m_session->GetPlayer()->GetExactDist2d(obj));
- return true;
-}
-
-bool ChatHandler::HandleDieCommand(const char* /*args*/)
-{
- Unit* target = getSelectedUnit();
-
- if (!target || !m_session->GetPlayer()->GetSelection())
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target->GetTypeId() == TYPEID_PLAYER)
- {
- if (HasLowerSecurity((Player*)target, 0, false))
- return false;
- }
-
- if (target->isAlive())
- {
- if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
- m_session->GetPlayer()->Kill(target);
- else
- m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleDamageCommand(const char * args)
-{
- if (!*args)
- return false;
-
- Unit* target = getSelectedUnit();
-
- if (!target || !m_session->GetPlayer()->GetSelection())
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target->GetTypeId() == TYPEID_PLAYER)
- {
- if (HasLowerSecurity((Player*)target, 0, false))
- return false;
- }
-
- if (!target->isAlive())
- return true;
-
- char* damageStr = strtok((char*)args, " ");
- if (!damageStr)
- return false;
-
- int32 damage_int = atoi((char*)damageStr);
- if (damage_int <= 0)
- return true;
-
- uint32 damage = damage_int;
-
- char* schoolStr = strtok((char*)NULL, " ");
-
- // flat melee damage without resistence/etc reduction
- if (!schoolStr)
- {
- m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- if (target != m_session->GetPlayer())
- m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
- return true;
- }
-
- uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
- if (school >= MAX_SPELL_SCHOOL)
- return false;
-
- SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
-
- if (Unit::IsDamageReducedByArmor(schoolmask))
- damage = m_session->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
-
- char* spellStr = strtok((char*)NULL, " ");
-
- // melee damage by specific school
- if (!spellStr)
- {
- uint32 absorb = 0;
- uint32 resist = 0;
-
- m_session->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
-
- if (damage <= absorb + resist)
- return true;
-
- damage -= absorb + resist;
-
- m_session->GetPlayer()->DealDamageMods(target, damage, &absorb);
- m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
- m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
- return true;
- }
-
- // non-melee damage
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellid = extractSpellIdFromLink((char*)args);
- if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
- return false;
-
- m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
- return true;
-}
-
-bool ChatHandler::HandleReviveCommand(const char *args)
-{
- Player* target;
- uint64 target_guid;
- if (!extractPlayerTarget((char*)args, &target, &target_guid))
- return false;
-
- if (target)
- {
- target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
- target->SpawnCorpseBones();
- target->SaveToDB();
- }
- else
- // will resurrected at login without corpse
- sObjectAccessor->ConvertCorpseForPlayer(target_guid);
-
- return true;
-}
-
-bool ChatHandler::HandleAuraCommand(const char *args)
-{
- Unit* target = getSelectedUnit();
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellID = extractSpellIdFromLink((char*)args);
-
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID))
- Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
-
- return true;
-}
-
-bool ChatHandler::HandleUnAuraCommand(const char *args)
-{
- Unit* target = getSelectedUnit();
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string argstr = args;
- if (argstr == "all")
- {
- target->RemoveAllAuras();
- return true;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellID = extractSpellIdFromLink((char*)args);
- if (!spellID)
- return false;
-
- target->RemoveAurasDueToSpell(spellID);
-
- return true;
-}
-
-bool ChatHandler::HandleLinkGraveCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* px = strtok((char*)args, " ");
- if (!px)
- return false;
-
- uint32 g_id = (uint32)atoi(px);
-
- uint32 g_team;
-
- char* px2 = strtok(NULL, " ");
-
- if (!px2)
- g_team = 0;
- else if (strncmp(px2, "horde", 6) == 0)
- g_team = HORDE;
- else if (strncmp(px2, "alliance", 9) == 0)
- g_team = ALLIANCE;
- else
- return false;
-
- WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
-
- if (!graveyard)
- {
- PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = m_session->GetPlayer();
-
- uint32 zoneId = player->GetZoneId();
-
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
- if (!areaEntry || areaEntry->zone !=0)
- {
- PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id, zoneId);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (sObjectMgr->AddGraveYardLink(g_id, zoneId, g_team))
- PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id, zoneId);
- else
- PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId);
-
- return true;
-}
-
-bool ChatHandler::HandleNearGraveCommand(const char *args)
-{
- uint32 g_team;
-
- size_t argslen = strlen(args);
-
- if (!*args)
- g_team = 0;
- else if (strncmp((char*)args, "horde", argslen) == 0)
- g_team = HORDE;
- else if (strncmp((char*)args, "alliance", argslen) == 0)
- g_team = ALLIANCE;
- else
- return false;
-
- Player* player = m_session->GetPlayer();
- uint32 zone_id = player->GetZoneId();
-
- WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), g_team);
-
- if (graveyard)
- {
- uint32 g_id = graveyard->ID;
-
- GraveYardData const* data = sObjectMgr->FindGraveYardData(g_id, zone_id);
- if (!data)
- {
- PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, g_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- g_team = data->team;
-
- std::string team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
-
- if (g_team == 0)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (g_team == HORDE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if (g_team == ALLIANCE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
-
- PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id, team_name.c_str(), zone_id);
- }
- else
- {
- std::string team_name;
-
- if (g_team == 0)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (g_team == HORDE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if (g_team == ALLIANCE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
-
- if (g_team == ~uint32(0))
- PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
- else
- PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
- }
-
- return true;
-}
-
-bool ChatHandler::HandleExploreCheatCommand(const char *args)
-{
- if (!*args)
- return false;
-
- int flag = atoi((char*)args);
-
- Player* chr = getSelectedPlayer();
- if (chr == NULL)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (flag != 0)
- {
- PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, GetNameLink().c_str());
- }
- else
- {
- PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, GetNameLink().c_str());
- }
-
- for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
- {
- if (flag != 0)
- m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
- else
- m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleHoverCommand(const char *args)
-{
- char* px = strtok((char*)args, " ");
- uint32 flag;
- if (!px)
- flag = 1;
- else
- flag = atoi(px);
-
- m_session->GetPlayer()->SetHover(flag);
-
- if (flag)
- SendSysMessage(LANG_HOVER_ENABLED);
- else
- SendSysMessage(LANG_HOVER_DISABLED);
-
- return true;
-}
-
-void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel)
-{
- if (player)
- {
- player->GiveLevel(newLevel);
- player->InitTalentForLevel();
- player->SetUInt32Value(PLAYER_XP, 0);
-
- if (needReportToTarget(player))
- {
- if (oldLevel == newLevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str());
- else if (oldLevel < newLevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newLevel);
- else // if (oldlevel > newlevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newLevel);
- }
- }
- else
- {
- // Update level and reset XP, everything else will be updated at login
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
-
- stmt->setUInt8(0, uint8(newLevel));
- stmt->setUInt32(1, GUID_LOPART(playerGuid));
-
- CharacterDatabase.Execute(stmt);
- }
-}
-
-bool ChatHandler::HandleCharacterLevelCommand(const char *args)
-{
- char* nameStr;
- char* levelStr;
- extractOptFirstArg((char*)args, &nameStr, &levelStr);
- if (!levelStr)
- return false;
-
- // exception opt second arg: .character level $name
- if (isalpha(levelStr[0]))
- {
- nameStr = levelStr;
- levelStr = NULL; // current level will used
- }
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid);
- int32 newlevel = levelStr ? atoi(levelStr) : oldlevel;
-
- if (newlevel < 1)
- return false; // invalid level
-
- if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
- newlevel = STRONG_MAX_LEVEL;
-
- HandleCharacterLevel(target, target_guid, oldlevel, newlevel);
-
- if (!m_session || m_session->GetPlayer() != target) // including player == NULL
- {
- std::string nameLink = playerLink(target_name);
- PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleLevelUpCommand(const char *args)
-{
- char* nameStr;
- char* levelStr;
- extractOptFirstArg((char*)args, &nameStr, &levelStr);
-
- // exception opt second arg: .character level $name
- if (levelStr && isalpha(levelStr[0]))
- {
- nameStr = levelStr;
- levelStr = NULL; // current level will used
- }
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid);
- int32 addlevel = levelStr ? atoi(levelStr) : 1;
- int32 newlevel = oldlevel + addlevel;
-
- if (newlevel < 1)
- newlevel = 1;
-
- if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
- newlevel = STRONG_MAX_LEVEL;
-
- HandleCharacterLevel(target, target_guid, oldlevel, newlevel);
-
- if (!m_session || m_session->GetPlayer() != target) // including chr == NULL
- {
- std::string nameLink = playerLink(target_name);
- PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleShowAreaCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* chr = getSelectedPlayer();
- if (chr == NULL)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- int area = GetAreaFlagByAreaID(atoi((char*)args));
- int offset = area / 32;
- uint32 val = (uint32)(1 << (area % 32));
-
- if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
- {
- SendSysMessage(LANG_BAD_VALUE);
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val));
-
- SendSysMessage(LANG_EXPLORE_AREA);
- return true;
-}
-
-bool ChatHandler::HandleHideAreaCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* chr = getSelectedPlayer();
- if (chr == NULL)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- int area = GetAreaFlagByAreaID(atoi((char*)args));
- int offset = area / 32;
- uint32 val = (uint32)(1 << (area % 32));
-
- if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
- {
- SendSysMessage(LANG_BAD_VALUE);
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields ^ val));
-
- SendSysMessage(LANG_UNEXPLORE_AREA);
- return true;
-}
-
-bool ChatHandler::HandleBankCommand(const char* /*args*/)
-{
- m_session->SendShowBank(m_session->GetPlayer()->GetGUID());
-
- return true;
-}
-
-bool ChatHandler::HandleChangeWeather(const char *args)
-{
- if (!*args)
- return false;
-
- //Weather is OFF
- if (!sWorld->getBoolConfig(CONFIG_WEATHER))
- {
- SendSysMessage(LANG_WEATHER_DISABLED);
- SetSentErrorMessage(true);
- return false;
- }
-
- // *Change the weather of a cell
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
-
- if (!px || !py)
- return false;
-
- uint32 type = (uint32)atoi(px); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
- float grade = (float)atof(py); //0 to 1, sending -1 is instand good weather
-
- Player* player = m_session->GetPlayer();
- uint32 zoneid = player->GetZoneId();
-
- Weather* wth = WeatherMgr::FindWeather(zoneid);
-
- if (!wth)
- wth = WeatherMgr::AddWeather(zoneid);
- if (!wth)
- {
- SendSysMessage(LANG_NO_WEATHER);
- SetSentErrorMessage(true);
- return false;
- }
-
- wth->SetWeather(WeatherType(type), grade);
-
- return true;
-}
-
-bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- char const* talentStr = GetTrinityString(LANG_TALENT);
- char const* passiveStr = GetTrinityString(LANG_PASSIVE);
-
- Unit::AuraApplicationMap const& uAuras = unit->GetAppliedAuras();
- PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size());
- for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
- {
- bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
-
- AuraApplication const* aurApp = itr->second;
- Aura const* aura = aurApp->GetBase();
- char const* name = aura->GetSpellInfo()->SpellName[GetSessionDbcLocale()];
-
- std::ostringstream ss_name;
- ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
-
- PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (m_session ? ss_name.str().c_str() : name),
- aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
- aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
- (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
- GUID_LOPART(aura->GetCasterGUID()));
- }
- for (uint16 i = 0; i < TOTAL_AURAS; ++i)
- {
- Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i));
- if (uAuraList.empty())
- continue;
-
- PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
- for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
- {
- PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(),
- (*itr)->GetAmount());
- }
- }
- return true;
-}
-
-bool ChatHandler::HandleResetAchievementsCommand (const char * args)
-{
- Player* target;
- uint64 target_guid;
- if (!extractPlayerTarget((char*)args, &target, &target_guid))
- return false;
-
- if (target)
- target->GetAchievementMgr().Reset();
- else
- AchievementMgr::DeleteFromDB(GUID_LOPART(target_guid));
-
- return true;
-}
-
-bool ChatHandler::HandleResetHonorCommand (const char * args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- target->SetHonorPoints(0);
- target->SetUInt32Value(PLAYER_FIELD_KILLS, 0);
- target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0);
- target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
- target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);
- target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
-
- return true;
-}
-
-static bool HandleResetStatsOrLevelHelper(Player* player)
-{
- ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass());
- if (!cEntry)
- {
- sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass());
- return false;
- }
-
- uint8 powertype = cEntry->powerType;
-
- // reset m_form if no aura
- if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
- player->SetShapeshiftForm(FORM_NONE);
-
- player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
- player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH);
-
- player->setFactionForRace(player->getRace());
-
- player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powertype << 24)));
-
- // reset only if player not in some form;
- if (player->GetShapeshiftForm() == FORM_NONE)
- player->InitDisplayIds();
-
- player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
-
- player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
-
- //-1 is default value
- player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));
-
- //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000);
- return true;
-}
-
-bool ChatHandler::HandleResetLevelCommand(const char * args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- if (!HandleResetStatsOrLevelHelper(target))
- return false;
-
- uint8 oldLevel = target->getLevel();
-
- // set starting level
- uint32 start_level = target->getClass() != CLASS_DEATH_KNIGHT
- ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
- : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
-
- target->_ApplyAllLevelScaleItemMods(false);
- target->SetLevel(start_level);
- target->InitRunes();
- target->InitStatsForLevel(true);
- target->InitTaxiNodesForLevel();
- target->InitGlyphsForLevel();
- target->InitTalentForLevel();
- target->SetUInt32Value(PLAYER_XP, 0);
-
- target->_ApplyAllLevelScaleItemMods(true);
-
- // reset level for pet
- if (Pet* pet = target->GetPet())
- pet->SynchronizeLevelWithOwner();
-
- sScriptMgr->OnPlayerLevelChanged(target, oldLevel);
-
- return true;
-}
-
-bool ChatHandler::HandleResetStatsCommand(const char * args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- if (!HandleResetStatsOrLevelHelper(target))
- return false;
-
- target->InitRunes();
- target->InitStatsForLevel(true);
- target->InitTaxiNodesForLevel();
- target->InitGlyphsForLevel();
- target->InitTalentForLevel();
-
- return true;
-}
-
-bool ChatHandler::HandleResetSpellsCommand(const char* args)
-{
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- if (target)
- {
- target->resetSpells(/* bool myClassOnly */);
-
- ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS);
- if (!m_session || m_session->GetPlayer() != target)
- PSendSysMessage(LANG_RESET_SPELLS_ONLINE, GetNameLink(target).c_str());
- }
- else
- {
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
- stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
-
- CharacterDatabase.Execute(stmt);
-
- PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str());
- }
-
- return true;
-}
-
-bool ChatHandler::HandleResetTalentsCommand(const char* args)
-{
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- {
- // Try reset talents as Hunter Pet
- Creature* creature = getSelectedCreature();
- if (!*args && creature && creature->isPet())
- {
- Unit* owner = creature->GetOwner();
- if (owner && owner->GetTypeId() == TYPEID_PLAYER && creature->ToPet()->IsPermanentPetFor(owner->ToPlayer()))
- {
- creature->ToPet()->resetTalents();
- owner->ToPlayer()->SendTalentsInfoData(true);
-
- ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS);
- if (!m_session || m_session->GetPlayer() != owner->ToPlayer())
- PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, GetNameLink(owner->ToPlayer()).c_str());
- }
- return true;
- }
-
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- target->resetTalents(true);
- target->SendTalentsInfoData(false);
- ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
- if (!m_session || m_session->GetPlayer() != target)
- PSendSysMessage(LANG_RESET_TALENTS_ONLINE, GetNameLink(target).c_str());
-
- Pet* pet = target->GetPet();
- Pet::resetTalentsForAllPetsOf(target, pet);
- if (pet)
- target->SendTalentsInfoData(true);
- return true;
- }
- else if (targetGuid)
- {
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
- stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
- stmt->setUInt32(1, GUID_LOPART(targetGuid));
-
- CharacterDatabase.Execute(stmt);
-
- std::string nameLink = playerLink(targetName);
- PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
- return true;
- }
-
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
-}
-
-bool ChatHandler::HandleResetAllCommand(const char * args)
-{
- if (!*args)
- return false;
-
- std::string casename = args;
-
- AtLoginFlags atLogin;
-
- // Command specially created as single command to prevent using short case names
- if (casename == "spells")
- {
- atLogin = AT_LOGIN_RESET_SPELLS;
- sWorld->SendWorldText(LANG_RESETALL_SPELLS);
- if (!m_session)
- SendSysMessage(LANG_RESETALL_SPELLS);
- }
- else if (casename == "talents")
- {
- atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS);
- sWorld->SendWorldText(LANG_RESETALL_TALENTS);
- if (!m_session)
- SendSysMessage(LANG_RESETALL_TALENTS);
- }
- else
- {
- PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE, args);
- SetSentErrorMessage(true);
- return false;
- }
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS);
-
- stmt->setUInt16(0, uint16(atLogin));
-
- CharacterDatabase.Execute(stmt);
-
- TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
- HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers();
- for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
- itr->second->SetAtLoginFlag(atLogin);
-
- return true;
-}
-
-bool ChatHandler::HandleServerShutDownCancelCommand(const char* /*args*/)
-{
- sWorld->ShutdownCancel();
- return true;
-}
-
-bool ChatHandler::HandleServerShutDownCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* time_str = strtok ((char*) args, " ");
- char* exitcode_str = strtok (NULL, "");
-
- int32 time = atoi (time_str);
-
- ///- Prevent interpret wrong arg value as 0 secs shutdown time
- if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
- return false;
-
- if (exitcode_str)
- {
- int32 exitcode = atoi (exitcode_str);
-
- // Handle atoi() errors
- if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0'))
- return false;
-
- // Exit code should be in range of 0-125, 126-255 is used
- // in many shells for their own return codes and code > 255
- // is not supported in many others
- if (exitcode < 0 || exitcode > 125)
- return false;
-
- sWorld->ShutdownServ(time, 0, exitcode);
- }
- else
- sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE);
- return true;
-}
-
-bool ChatHandler::HandleServerRestartCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* time_str = strtok ((char*) args, " ");
- char* exitcode_str = strtok (NULL, "");
-
- int32 time = atoi (time_str);
-
- ///- Prevent interpret wrong arg value as 0 secs shutdown time
- if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
- return false;
-
- if (exitcode_str)
- {
- int32 exitcode = atoi (exitcode_str);
-
- // Handle atoi() errors
- if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0'))
- return false;
-
- // Exit code should be in range of 0-125, 126-255 is used
- // in many shells for their own return codes and code > 255
- // is not supported in many others
- if (exitcode < 0 || exitcode > 125)
- return false;
-
- sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode);
- }
- else
- sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE);
- return true;
-}
-
-bool ChatHandler::HandleServerIdleRestartCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* time_str = strtok ((char*) args, " ");
- char* exitcode_str = strtok (NULL, "");
-
- int32 time = atoi (time_str);
-
- ///- Prevent interpret wrong arg value as 0 secs shutdown time
- if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
- return false;
-
- if (exitcode_str)
- {
- int32 exitcode = atoi (exitcode_str);
-
- // Handle atoi() errors
- if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0'))
- return false;
-
- // Exit code should be in range of 0-125, 126-255 is used
- // in many shells for their own return codes and code > 255
- // is not supported in many others
- if (exitcode < 0 || exitcode > 125)
- return false;
-
- sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode);
- }
- else
- sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE);
- return true;
-}
-
-bool ChatHandler::HandleServerIdleShutDownCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* time_str = strtok ((char*) args, " ");
- char* exitcode_str = strtok (NULL, "");
-
- int32 time = atoi (time_str);
-
- ///- Prevent interpret wrong arg value as 0 secs shutdown time
- if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
- return false;
-
- if (exitcode_str)
- {
- int32 exitcode = atoi (exitcode_str);
-
- // Handle atoi() errors
- if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0'))
- return false;
-
- // Exit code should be in range of 0-125, 126-255 is used
- // in many shells for their own return codes and code > 255
- // is not supported in many others
- if (exitcode < 0 || exitcode > 125)
- return false;
-
- sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode);
- }
- else
- sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE);
- return true;
-}
-
-bool ChatHandler::HandleBanAccountCommand(const char *args)
-{
- return HandleBanHelper(BAN_ACCOUNT, args);
-}
-
-bool ChatHandler::HandleBanAccountByCharCommand(const char *args)
-{
- return HandleBanHelper(BAN_CHARACTER, args);
-}
-
-bool ChatHandler::HandleBanCharacterCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cname = strtok((char*)args, " ");
- if (!cname)
- return false;
-
- std::string name = cname;
-
- char* duration = strtok(NULL, " ");
- if (!duration || !atoi(duration))
- return false;
-
- char* reason = strtok(NULL, "");
- if (!reason)
- return false;
-
- if (!normalizePlayerName(name))
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- switch (sWorld->BanCharacter(name, duration, reason, m_session ? m_session->GetPlayerName() : ""))
- {
- case BAN_SUCCESS:
- {
- if (atoi(duration) > 0)
- PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(duration), true).c_str(), reason);
- else
- PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reason);
- break;
- }
- case BAN_NOTFOUND:
- {
- PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- default:
- break;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleBanIPCommand(const char *args)
-{
- return HandleBanHelper(BAN_IP, args);
-}
-
-bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
-{
- if (!*args)
- return false;
-
- char* cnameOrIP = strtok ((char*)args, " ");
- if (!cnameOrIP)
- return false;
-
- std::string nameOrIP = cnameOrIP;
-
- char* duration = strtok (NULL, " ");
- if (!duration || !atoi(duration))
- return false;
-
- char* reason = strtok (NULL, "");
- if (!reason)
- return false;
-
- switch (mode)
- {
- case BAN_ACCOUNT:
- if (!AccountMgr::normalizeString(nameOrIP))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- break;
- case BAN_CHARACTER:
- if (!normalizePlayerName(nameOrIP))
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
- break;
- case BAN_IP:
- if (!IsIPAddress(nameOrIP.c_str()))
- return false;
- break;
- }
-
- switch (sWorld->BanAccount(mode, nameOrIP, duration, reason, m_session ? m_session->GetPlayerName() : ""))
- {
- case BAN_SUCCESS:
- if (atoi(duration)>0)
- PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(duration), true).c_str(), reason);
- else
- PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason);
- break;
- case BAN_SYNTAX_ERROR:
- return false;
- case BAN_NOTFOUND:
- switch (mode)
- {
- default:
- PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
- break;
- case BAN_CHARACTER:
- PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
- break;
- case BAN_IP:
- PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
- break;
- }
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleUnBanAccountCommand(const char *args)
-{
- return HandleUnBanHelper(BAN_ACCOUNT, args);
-}
-
-bool ChatHandler::HandleUnBanAccountByCharCommand(const char *args)
-{
- return HandleUnBanHelper(BAN_CHARACTER, args);
-}
-
-bool ChatHandler::HandleUnBanCharacterCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cname = strtok((char*)args, " ");
- if (!cname)
- return false;
-
- std::string name = cname;
-
- if (!normalizePlayerName(name))
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!sWorld->RemoveBanCharacter(name))
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleUnBanIPCommand(const char *args)
-{
- return HandleUnBanHelper(BAN_IP, args);
-}
-
-bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args)
-{
- if (!*args)
- return false;
-
- char* cnameOrIP = strtok ((char*)args, " ");
- if (!cnameOrIP)
- return false;
-
- std::string nameOrIP = cnameOrIP;
-
- switch (mode)
- {
- case BAN_ACCOUNT:
- if (!AccountMgr::normalizeString(nameOrIP))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- break;
- case BAN_CHARACTER:
- if (!normalizePlayerName(nameOrIP))
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
- break;
- case BAN_IP:
- if (!IsIPAddress(nameOrIP.c_str()))
- return false;
- break;
- }
-
- if (sWorld->RemoveBanAccount(mode, nameOrIP))
- PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
- else
- PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
-
- return true;
-}
-
-bool ChatHandler::HandleBanInfoAccountCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cname = strtok((char*)args, "");
- if (!cname)
- return false;
-
- std::string account_name = cname;
- if (!AccountMgr::normalizeString(account_name))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 accountid = AccountMgr::GetId(account_name);
- if (!accountid)
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- return true;
- }
-
- return HandleBanInfoHelper(accountid, account_name.c_str());
-}
-
-bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* target = sObjectAccessor->FindPlayerByName(args);
- uint32 target_guid = 0;
- std::string name(args);
-
- if (!target)
- {
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
- stmt->setString(0, name);
- PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
-
- if (!resultCharacter)
- {
- PSendSysMessage(LANG_BANINFO_NOCHARACTER);
- return false;
- }
-
- target_guid = (*resultCharacter)[0].GetUInt32();
- }
- else
- target_guid = target->GetGUIDLow();
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
- stmt->setUInt32(0, target_guid);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (!result)
- {
- PSendSysMessage(LANG_CHAR_NOT_BANNED, name.c_str());
- return true;
- }
-
- PSendSysMessage(LANG_BANINFO_BANHISTORY, name.c_str());
- do
- {
- Field* fields = result->Fetch();
- time_t unbandate = time_t(fields[3].GetUInt32());
- bool active = false;
- if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbandate >= time(NULL)))
- active = true;
- bool permanent = (fields[1].GetUInt32() == uint32(0));
- std::string bantime = permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
- PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
- fields[0].GetCString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES) : GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
- }
- while (result->NextRow());
-
- return true;
-}
-
-bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
-{
- QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountid);
- if (!result)
- {
- PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname);
- return true;
- }
-
- PSendSysMessage(LANG_BANINFO_BANHISTORY, accountname);
- do
- {
- Field* fields = result->Fetch();
-
- time_t unbandate = time_t(fields[3].GetUInt64());
- bool active = false;
- if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)))
- active = true;
- bool permanent = (fields[1].GetUInt64() == (uint64)0);
- std::string bantime = permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
- PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
- fields[0].GetCString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES) : GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
- } while (result->NextRow());
-
- return true;
-}
-
-bool ChatHandler::HandleBanInfoIPCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cIP = strtok ((char*)args, "");
- if (!cIP)
- return false;
-
- if (!IsIPAddress(cIP))
- return false;
-
- std::string IP = cIP;
-
- LoginDatabase.EscapeString(IP);
- QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str());
- if (!result)
- {
- PSendSysMessage(LANG_BANINFO_NOIP);
- return true;
- }
-
- Field* fields = result->Fetch();
- bool permanent = !fields[6].GetUInt64();
- PSendSysMessage(LANG_BANINFO_IPENTRY,
- fields[0].GetCString(), fields[1].GetCString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER) : fields[2].GetCString(),
- permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString());
-
- return true;
-}
-
-bool ChatHandler::HandleBanListCharacterCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cFilter = strtok((char*)args, " ");
- if (!cFilter)
- return false;
-
- std::string filter(cFilter);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
- stmt->setString(0, filter);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (!result)
- {
- PSendSysMessage(LANG_BANLIST_NOCHARACTER);
- return true;
- }
-
- PSendSysMessage(LANG_BANLIST_MATCHINGCHARACTER);
-
- // Chat short output
- if (m_session)
- {
- do
- {
- Field* fields = result->Fetch();
- PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
- stmt2->setUInt32(0, fields[0].GetUInt32());
- PreparedQueryResult banresult = CharacterDatabase.Query(stmt2);
- if (banresult)
- PSendSysMessage("%s", (*banresult)[0].GetCString());
- }
- while (result->NextRow());
- }
- // Console wide output
- else
- {
- SendSysMessage(LANG_BANLIST_CHARACTERS);
- SendSysMessage(" =============================================================================== ");
- SendSysMessage(LANG_BANLIST_CHARACTERS_HEADER);
- do
- {
- SendSysMessage("-------------------------------------------------------------------------------");
-
- Field* fields = result->Fetch();
-
- std::string char_name = fields[1].GetString();
-
- PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
- stmt2->setUInt32(0, fields[0].GetUInt32());
- PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
- if (banInfo)
- {
- Field* banFields = banInfo->Fetch();
- do
- {
- time_t t_ban = time_t(banFields[0].GetUInt32());
- tm* aTm_ban = localtime(&t_ban);
-
- if (banFields[0].GetUInt32() == banFields[1].GetUInt32())
- {
- PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
- char_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
- banFields[2].GetCString(), banFields[3].GetCString());
- }
- else
- {
- time_t t_unban = time_t(banFields[1].GetUInt32());
- tm* aTm_unban = localtime(&t_unban);
- PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
- char_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
- aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,
- banFields[2].GetCString(), banFields[3].GetCString());
- }
- }
- while (banInfo->NextRow());
- }
- }
- while (result->NextRow());
- SendSysMessage(" =============================================================================== ");
- }
-
- return true;
-}
-
-bool ChatHandler::HandleBanListAccountCommand(const char *args)
-{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
- LoginDatabase.Execute(stmt);
-
- char* cFilter = strtok((char*)args, " ");
- std::string filter = cFilter ? cFilter : "";
-
- PreparedQueryResult result;
-
- if (filter.empty())
- {
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
-
- result = LoginDatabase.Query(stmt);
- }
- else
- {
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
-
- stmt->setString(0, filter);
-
- result = LoginDatabase.Query(stmt);
- }
-
- if (!result)
- {
- PSendSysMessage(LANG_BANLIST_NOACCOUNT);
- return true;
- }
-
- return HandleBanListHelper(result);
-}
-
-bool ChatHandler::HandleBanListHelper(PreparedQueryResult result)
-{
- PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT);
-
- // Chat short output
- if (m_session)
- {
- do
- {
- Field* fields = result->Fetch();
- uint32 accountid = fields[0].GetUInt32();
-
- QueryResult banresult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid);
- if (banresult)
- {
- Field* fields2 = banresult->Fetch();
- PSendSysMessage("%s", fields2[0].GetCString());
- }
- } while (result->NextRow());
- }
- // Console wide output
- else
- {
- SendSysMessage(LANG_BANLIST_ACCOUNTS);
- SendSysMessage(" ===============================================================================");
- SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER);
- do
- {
- SendSysMessage("-------------------------------------------------------------------------------");
- Field* fields = result->Fetch();
- uint32 account_id = fields[0].GetUInt32();
-
- std::string account_name;
-
- // "account" case, name can be get in same query
- if (result->GetFieldCount() > 1)
- account_name = fields[1].GetString();
- // "character" case, name need extract from another DB
- else
- AccountMgr::GetName (account_id, account_name);
-
- // No SQL injection. id is uint32.
- QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
- if (banInfo)
- {
- Field* fields2 = banInfo->Fetch();
- do
- {
- time_t t_ban = fields2[0].GetUInt64();
- tm* aTm_ban = localtime(&t_ban);
-
- if (fields2[0].GetUInt64() == fields2[1].GetUInt64())
- {
- PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
- account_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
- fields2[2].GetCString(), fields2[3].GetCString());
- }
- else
- {
- time_t t_unban = fields2[1].GetUInt64();
- tm* aTm_unban = localtime(&t_unban);
- PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
- account_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
- aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,
- fields2[2].GetCString(), fields2[3].GetCString());
- }
- } while (banInfo->NextRow());
- }
- }while (result->NextRow());
- SendSysMessage(" ===============================================================================");
- }
- return true;
-}
-
-bool ChatHandler::HandleBanListIPCommand(const char *args)
-{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
- LoginDatabase.Execute(stmt);
-
- char* cFilter = strtok((char*)args, " ");
- std::string filter = cFilter ? cFilter : "";
- LoginDatabase.EscapeString(filter);
-
- PreparedQueryResult result;
-
- if (filter.empty())
- {
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
-
- result = LoginDatabase.Query(stmt);
- }
- else
- {
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
-
- stmt->setString(0, filter);
-
- result = LoginDatabase.Query(stmt);
- }
-
- if (!result)
- {
- PSendSysMessage(LANG_BANLIST_NOIP);
- return true;
- }
-
- PSendSysMessage(LANG_BANLIST_MATCHINGIP);
- // Chat short output
- if (m_session)
- {
- do
- {
- Field* fields = result->Fetch();
- PSendSysMessage("%s", fields[0].GetCString());
- } while (result->NextRow());
- }
- // Console wide output
- else
- {
- SendSysMessage(LANG_BANLIST_IPS);
- SendSysMessage(" ===============================================================================");
- SendSysMessage(LANG_BANLIST_IPS_HEADER);
- do
- {
- SendSysMessage("-------------------------------------------------------------------------------");
- Field* fields = result->Fetch();
- time_t t_ban = fields[1].GetUInt64();
- tm* aTm_ban = localtime(&t_ban);
- if (fields[1].GetUInt64() == fields[2].GetUInt64())
- {
- PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
- fields[0].GetCString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
- fields[3].GetCString(), fields[4].GetCString());
- }
- else
- {
- time_t t_unban = fields[2].GetUInt64();
- tm* aTm_unban = localtime(&t_unban);
- PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
- fields[0].GetCString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
- aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,
- fields[3].GetCString(), fields[4].GetCString());
- }
- }while (result->NextRow());
- SendSysMessage(" ===============================================================================");
- }
-
- return true;
-}
-
-bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- // accept only explicitly selected target (not implicitly self targeting case)
- Unit* target = getSelectedUnit();
- if (player->GetSelection() && target)
- {
- if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
- {
- SendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target->isDead())
- target->ToCreature()->Respawn();
- return true;
- }
-
- CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
- Cell cell(p);
- cell.SetNoCreate();
-
- Trinity::RespawnDo u_do;
- Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
-
- TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
- cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
-
- return true;
-}
-
-bool ChatHandler::HandlePDumpLoadCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char * file = strtok((char*)args, " ");
- if (!file)
- return false;
-
- char * account = strtok(NULL, " ");
- if (!account)
- return false;
-
- std::string account_name = account;
- if (!AccountMgr::normalizeString(account_name))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 account_id = AccountMgr::GetId(account_name);
- if (!account_id)
- {
- account_id = atoi(account); // use original string
- if (!account_id)
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- if (!AccountMgr::GetName(account_id, account_name))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- char* guid_str = NULL;
- char* name_str = strtok(NULL, " ");
-
- std::string name;
- if (name_str)
- {
- name = name_str;
- // normalize the name if specified and check if it exists
- if (!normalizePlayerName(name))
- {
- PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS)
- {
- PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
- SetSentErrorMessage(true);
- return false;
- }
-
- guid_str = strtok(NULL, " ");
- }
-
- uint32 guid = 0;
-
- if (guid_str)
- {
- guid = atoi(guid_str);
- if (!guid)
- {
- PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
- {
- PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- switch (PlayerDumpReader().LoadDump(file, account_id, name, guid))
- {
- case DUMP_SUCCESS:
- PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
- break;
- case DUMP_FILE_OPEN_ERROR:
- PSendSysMessage(LANG_FILE_OPEN_FAIL, file);
- SetSentErrorMessage(true);
- return false;
- case DUMP_FILE_BROKEN:
- PSendSysMessage(LANG_DUMP_BROKEN, file);
- SetSentErrorMessage(true);
- return false;
- case DUMP_TOO_MANY_CHARS:
- PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account_name.c_str(), account_id);
- SetSentErrorMessage(true);
- return false;
- default:
- PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandlePDumpWriteCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* file = strtok((char*)args, " ");
- char* p2 = strtok(NULL, " ");
-
- if (!file || !p2)
- return false;
-
- uint64 guid;
- // character name can't start from number
- if (isNumeric(p2))
- guid = MAKE_NEW_GUID(atoi(p2), 0, HIGHGUID_PLAYER);
- else
- {
- std::string name = extractPlayerNameFromLink(p2);
- if (name.empty())
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- guid = sObjectMgr->GetPlayerGUIDByName(name);
- }
-
- if (!sObjectMgr->GetPlayerAccountIdByGUID(guid))
- {
- PSendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- switch (PlayerDumpWriter().WriteDump(file, uint32(guid)))
- {
- case DUMP_SUCCESS:
- PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
- break;
- case DUMP_FILE_OPEN_ERROR:
- PSendSysMessage(LANG_FILE_OPEN_FAIL, file);
- SetSentErrorMessage(true);
- return false;
- case DUMP_CHARACTER_DELETED:
- PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
- SetSentErrorMessage(true);
- return false;
- default:
- PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
-
- MotionMaster* mm = unit->GetMotionMaster();
- float x,y,z;
- mm->GetDestination(x,y,z);
-
- for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
- {
- MovementGenerator* mg = mm->GetMotionSlot(i);
- if (!mg)
- {
- SendSysMessage("Empty");
- continue;
- }
- switch (mg->GetMovementGeneratorType())
- {
- case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
- case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
- case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break;
- case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break;
- case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
- case CHASE_MOTION_TYPE:
- {
- Unit* target = NULL;
- if (unit->GetTypeId() == TYPEID_PLAYER)
- target = static_cast<ChaseMovementGenerator<Player> const*>(mg)->GetTarget();
- else
- target = static_cast<ChaseMovementGenerator<Creature> const*>(mg)->GetTarget();
-
- if (!target)
- SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
- else if (target->GetTypeId() == TYPEID_PLAYER)
- PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
- else
- PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
- break;
- }
- case FOLLOW_MOTION_TYPE:
- {
- Unit* target = NULL;
- if (unit->GetTypeId() == TYPEID_PLAYER)
- target = static_cast<FollowMovementGenerator<Player> const*>(mg)->GetTarget();
- else
- target = static_cast<FollowMovementGenerator<Creature> const*>(mg)->GetTarget();
-
- if (!target)
- SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
- else if (target->GetTypeId() == TYPEID_PLAYER)
- PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
- else
- PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
- break;
- }
- case HOME_MOTION_TYPE:
- {
- if (unit->GetTypeId() == TYPEID_UNIT)
- PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
- else
- SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
- break;
- }
- case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break;
- case POINT_MOTION_TYPE:
- {
- PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
- break;
- }
- case FLEEING_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FEAR); break;
- case DISTRACT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_DISTRACT); break;
- case EFFECT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_EFFECT); break;
- default:
- PSendSysMessage(LANG_MOVEGENS_UNKNOWN, mg->GetMovementGeneratorType());
- break;
- }
- }
- return true;
-}
-
-bool ChatHandler::HandleServerPLimitCommand(const char *args)
-{
- if (*args)
- {
- char* param = strtok((char*)args, " ");
- if (!param)
- return false;
-
- int l = strlen(param);
-
- if (strncmp(param, "player", l) == 0)
- sWorld->SetPlayerSecurityLimit(SEC_PLAYER);
- else if (strncmp(param, "moderator", l) == 0)
- sWorld->SetPlayerSecurityLimit(SEC_MODERATOR);
- else if (strncmp(param, "gamemaster", l) == 0)
- sWorld->SetPlayerSecurityLimit(SEC_GAMEMASTER);
- else if (strncmp(param, "administrator", l) == 0)
- sWorld->SetPlayerSecurityLimit(SEC_ADMINISTRATOR);
- else if (strncmp(param, "reset", l) == 0)
- {
- sWorld->SetPlayerAmountLimit(ConfigMgr::GetIntDefault("PlayerLimit", 100));
- sWorld->LoadDBAllowedSecurityLevel();
- }
- else
- {
- int val = atoi(param);
- if (val < 0)
- sWorld->SetPlayerSecurityLimit(AccountTypes(uint32(-val)));
- else
- sWorld->SetPlayerAmountLimit(uint32(val));
- }
- }
-
- uint32 pLimit = sWorld->GetPlayerAmountLimit();
- AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
- char const* secName = "";
- switch (allowedAccountType)
- {
- case SEC_PLAYER: secName = "Player"; break;
- case SEC_MODERATOR: secName = "Moderator"; break;
- case SEC_GAMEMASTER: secName = "Gamemaster"; break;
- case SEC_ADMINISTRATOR: secName = "Administrator"; break;
- default: secName = "<unknown>"; break;
- }
-
- PSendSysMessage("Player limits: amount %u, min. security level %s.", pLimit, secName);
-
- return true;
-}
-
-bool ChatHandler::HandleCastCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Unit* target = getSelectedUnit();
-
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell)
- return false;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
- if (!spellInfo)
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- m_session->GetPlayer()->CastSpell(target, spell, triggered);
-
- return true;
-}
-
-bool ChatHandler::HandleCastBackCommand(const char *args)
-{
- Creature* caster = getSelectedCreature();
-
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellMgr->GetSpellInfo(spell))
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- caster->CastSpell(m_session->GetPlayer(), spell, triggered);
-
- return true;
-}
-
-bool ChatHandler::HandleCastDistCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell)
- return false;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
- if (!spellInfo)
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
- SetSentErrorMessage(true);
- return false;
- }
-
- char *distStr = strtok(NULL, " ");
-
- float dist = 0;
-
- if (distStr)
- sscanf(distStr, "%f", &dist);
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, dist);
-
- m_session->GetPlayer()->CastSpell(x, y, z, spell, triggered);
- return true;
-}
-
-bool ChatHandler::HandleCastTargetCommand(const char *args)
-{
- Creature* caster = getSelectedCreature();
-
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!caster->getVictim())
- {
- SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellMgr->GetSpellInfo(spell))
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- caster->CastSpell(caster->getVictim(), spell, triggered);
-
- return true;
-}
-
-bool ChatHandler::HandleCastDestCommand(const char *args)
-{
- Unit* caster = getSelectedUnit();
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellMgr->GetSpellInfo(spell))
- {
- PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- char* px = strtok(NULL, " ");
- char* py = strtok(NULL, " ");
- char* pz = strtok(NULL, " ");
-
- if (!px || !py || !pz)
- return false;
-
- float x = (float)atof(px);
- float y = (float)atof(py);
- float z = (float)atof(pz);
-
- char* trig_str = strtok(NULL, " ");
- if (trig_str)
- {
- int l = strlen(trig_str);
- if (strncmp(trig_str, "triggered", l) != 0)
- return false;
- }
-
- bool triggered = (trig_str != NULL);
-
- caster->CastSpell(x, y, z, spell, triggered);
-
- return true;
-}
-
-/*
-ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
-Without this function 3rd party scripting library will get linking errors (unresolved external)
-when attempting to use the PointMovementGenerator
-*/
-bool ChatHandler::HandleComeToMeCommand(const char *args)
-{
- char* newFlagStr = strtok((char*)args, " ");
-
- if (!newFlagStr)
- return false;
-
- Creature* caster = getSelectedCreature();
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = m_session->GetPlayer();
-
- caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
- return true;
-}
-
-bool ChatHandler::HandleCastSelfCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Unit* target = getSelectedUnit();
-
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell)
- return false;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
- if (!spellInfo)
- return false;
-
- if (!SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
- SetSentErrorMessage(true);
- return false;
- }
-
- target->CastSpell(target, spell, false);
-
- return true;
-}
-
-std::string GetTimeString(uint64 time)
-{
- uint64 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE;
- std::ostringstream ss;
- if (days) ss << days << "d ";
- if (hours) ss << hours << "h ";
- ss << minute << 'm';
- return ss.str();
-}
-
-bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
-{
- Player* player = getSelectedPlayer();
- if (!player) player = m_session->GetPlayer();
- uint32 counter = 0;
- for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
- {
- Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
- for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
- {
- InstanceSave* save = itr->second.save;
- std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
- PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
- counter++;
- }
- }
- PSendSysMessage("player binds: %d", counter);
- counter = 0;
- Group* group = player->GetGroup();
- if (group)
- {
- for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
- {
- Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i));
- for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
- {
- InstanceSave* save = itr->second.save;
- std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
- PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
- counter++;
- }
- }
- }
- PSendSysMessage("group binds: %d", counter);
-
- return true;
-}
-
-bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* player = getSelectedPlayer();
- if (!player)
- player = m_session->GetPlayer();
-
- char* map = strtok((char*)args, " ");
- char* pDiff = strtok(NULL, " ");
- int8 diff = -1;
- if (pDiff)
- diff = atoi(pDiff);
- uint16 counter = 0;
- uint16 MapId = 0;
-
- if (strcmp(map, "all"))
- {
- MapId = uint16(atoi(map));
- if (!MapId)
- return false;
- }
-
- for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
- {
- Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
- for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
- {
- InstanceSave* save = itr->second.save;
- if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
- {
- std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
- PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
- player->UnbindInstance(itr, Difficulty(i));
- counter++;
- }
- else
- ++itr;
- }
- }
- PSendSysMessage("instances unbound: %d", counter);
- return true;
-}
-
-bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
-{
- PSendSysMessage("instances loaded: %d", sMapMgr->GetNumInstances());
- PSendSysMessage("players in instances: %d", sMapMgr->GetNumPlayersInInstances());
- PSendSysMessage("instance saves: %d", sInstanceSaveMgr->GetNumInstanceSaves());
- PSendSysMessage("players bound: %d", sInstanceSaveMgr->GetNumBoundPlayersTotal());
- PSendSysMessage("groups bound: %d", sInstanceSaveMgr->GetNumBoundGroupsTotal());
- return true;
-}
-
-bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- Map* map = player->GetMap();
- if (!map->IsDungeon())
- {
- PSendSysMessage("Map is not a dungeon.");
- SetSentErrorMessage(true);
- return false;
- }
-
- if (!((InstanceMap*)map)->GetInstanceScript())
- {
- PSendSysMessage("Map has no instance data.");
- SetSentErrorMessage(true);
- return false;
- }
-
- ((InstanceMap*)map)->GetInstanceScript()->SaveToDB();
- return true;
-}
-
-/// Define the 'Message of the day' for the realm
-bool ChatHandler::HandleServerSetMotdCommand(const char *args)
-{
- sWorld->SetMotd(args);
- PSendSysMessage(LANG_MOTD_NEW, args);
- return true;
-}
-
-/// Set whether we accept new clients
-bool ChatHandler::HandleServerSetClosedCommand(const char *args)
-{
- if (strncmp(args, "on", 3) == 0)
- {
- SendSysMessage(LANG_WORLD_CLOSED);
- sWorld->SetClosed(true);
- return true;
- }
- else if (strncmp(args, "off", 4) == 0)
- {
- SendSysMessage(LANG_WORLD_OPENED);
- sWorld->SetClosed(false);
- return true;
- }
-
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
-}
-
-//Send items by mail
-bool ChatHandler::HandleSendItemsCommand(const char *args)
-{
- // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
- Player* receiver;
- uint64 receiver_guid;
- std::string receiver_name;
- if (!extractPlayerTarget((char*)args, &receiver, &receiver_guid, &receiver_name))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // extract items
- typedef std::pair<uint32, uint32> ItemPair;
- typedef std::list< ItemPair > ItemPairs;
- ItemPairs items;
-
- // get all tail string
- char* tail = strtok(NULL, "");
-
- // get from tail next item str
- while (char* itemStr = strtok(tail, " "))
- {
- // and get new tail
- tail = strtok(NULL, "");
-
- // parse item str
- char* itemIdStr = strtok(itemStr, ":");
- char* itemCountStr = strtok(NULL, " ");
-
- uint32 item_id = atoi(itemIdStr);
- if (!item_id)
- return false;
-
- ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(item_id);
- if (!item_proto)
- {
- PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1;
- if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount)))
- {
- PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count, item_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- while (item_count > item_proto->GetMaxStackSize())
- {
- items.push_back(ItemPair(item_id, item_proto->GetMaxStackSize()));
- item_count -= item_proto->GetMaxStackSize();
- }
-
- items.push_back(ItemPair(item_id, item_count));
-
- if (items.size() > MAX_MAIL_ITEMS)
- {
- PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- // fill mail
- MailDraft draft(subject, text);
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
- {
- if (Item* item = Item::CreateItem(itr->first, itr->second, m_session ? m_session->GetPlayer() : 0))
- {
- item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
- draft.AddItem(item);
- }
- }
-
- draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender);
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = playerLink(receiver_name);
- PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
-}
-
-///Send money by mail
-bool ChatHandler::HandleSendMoneyCommand(const char *args)
-{
- /// format: name "subject text" "mail text" money
-
- Player* receiver;
- uint64 receiver_guid;
- std::string receiver_name;
- if (!extractPlayerTarget((char*)args, &receiver, &receiver_guid, &receiver_name))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- char* money_str = strtok(NULL, "");
- int32 money = money_str ? atoi(money_str) : 0;
- if (money <= 0)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- MailDraft(subject, text)
- .AddMoney(money)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender);
-
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = playerLink(receiver_name);
- PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
-}
-
-/// Send a message to a player in game
-bool ChatHandler::HandleSendMessageCommand(const char *args)
-{
- ///- Find the player
- Player* rPlayer;
- if (!extractPlayerTarget((char*)args, &rPlayer))
- return false;
-
- char* msg_str = strtok(NULL, "");
- if (!msg_str)
- return false;
-
- ///- Check that he is not logging out.
- if (rPlayer->GetSession()->isLogingOut())
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- ///- Send the message
- //Use SendAreaTriggerMessage for fastest delivery.
- rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg_str);
- rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
-
- //Confirmation message
- std::string nameLink = GetNameLink(rPlayer);
- PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msg_str);
- return true;
-}
-
-bool ChatHandler::HandleFlushArenaPointsCommand(const char * /*args*/)
-{
- sArenaTeamMgr->DistributeArenaPoints();
- return true;
-}
-
-bool ChatHandler::HandleChannelSetOwnership(const char *args)
-{
- if (!*args)
- return false;
- char *channel = strtok((char*)args, " ");
- char *argstr = strtok(NULL, "");
-
- if (!channel || !argstr)
- return false;
-
- Player* player = m_session->GetPlayer();
- Channel* chn = NULL;
-
- if (ChannelMgr* cMgr = channelMgr(player->GetTeam()))
- chn = cMgr->GetChannel(channel, player);
-
- if (strcmp(argstr, "on") == 0)
- {
- if (chn)
- chn->SetOwnership(true);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
- stmt->setUInt8 (0, 1);
- stmt->setString(1, channel);
- CharacterDatabase.Execute(stmt);
- PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channel);
- }
- else if (strcmp(argstr, "off") == 0)
- {
- if (chn)
- chn->SetOwnership(false);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
- stmt->setUInt8 (0, 0);
- stmt->setString(1, channel);
- CharacterDatabase.Execute(stmt);
- PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channel);
- }
- else
- return false;
-
- return true;
-}
-
-bool ChatHandler::HandlePlayAllCommand(const char *args)
-{
- if (!*args)
- return false;
-
- uint32 soundId = atoi((char*)args);
-
- if (!sSoundEntriesStore.LookupEntry(soundId))
- {
- PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
- SetSentErrorMessage(true);
- return false;
- }
-
- WorldPacket data(SMSG_PLAY_SOUND, 4);
- data << uint32(soundId) << m_session->GetPlayer()->GetGUID();
- sWorld->SendGlobalMessage(&data);
-
- PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
- return true;
-}
-
-bool ChatHandler::HandleFreezeCommand(const char *args)
-{
- std::string name;
- Player* player;
- char *TargetName = strtok((char*)args, " "); //get entered name
- if (!TargetName) //if no name entered use target
- {
- player = getSelectedPlayer();
- if (player) //prevent crash with creature as target
- {
- name = player->GetName();
- normalizePlayerName(name);
- }
- }
- else // if name entered
- {
- name = TargetName;
- normalizePlayerName(name);
- player = sObjectAccessor->FindPlayerByName(name.c_str());
- }
-
- if (!player)
- {
- SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
-
- if (player == m_session->GetPlayer())
- {
- SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
- return true;
- }
-
- //effect
- if (player && player != m_session->GetPlayer())
- {
- PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
-
- //stop combat + make player unattackable + duel stop + stop some spells
- player->setFaction(35);
- player->CombatStop();
- if (player->IsNonMeleeSpellCasted(true))
- player->InterruptNonMeleeSpells(true);
- player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
-
- //if player class = hunter || warlock remove pet if alive
- if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
- {
- if (Pet* pet = player->GetPet())
- {
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- // not let dismiss dead pet
- if (pet && pet->isAlive())
- player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
- }
- }
-
- //m_session->GetPlayer()->CastSpell(player, spellID, false);
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
- Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
-
- //save player
- player->SaveToDB();
- }
- return true;
-}
-
-bool ChatHandler::HandleUnFreezeCommand(const char *args)
-{
- std::string name;
- Player* player;
- char* targetName = strtok((char*)args, " "); // Get entered name
-
- if (targetName)
- {
- name = targetName;
- normalizePlayerName(name);
- player = sObjectAccessor->FindPlayerByName(name.c_str());
- }
- else // If no name was entered - use target
- {
- player = getSelectedPlayer();
- if (player)
- name = player->GetName();
- }
-
- if (player)
- {
- PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
-
- // Reset player faction + allow combat + allow duels
- player->setFactionForRace(player->getRace());
- player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
-
- // Remove Freeze spell (allowing movement and spells)
- player->RemoveAurasDueToSpell(9454);
-
- // Save player
- player->SaveToDB();
- }
- else
- {
- if (targetName)
- {
- // Check for offline players
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
- stmt->setString(0, name);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- {
- SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
-
- // If player found: delete his freeze aura
- Field* fields = result->Fetch();
- uint32 lowGuid = fields[0].GetUInt32();
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
- stmt->setUInt32(0, lowGuid);
- CharacterDatabase.Execute(stmt);
-
- PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
- return true;
- }
- else
- {
- SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
- }
-
- return true;
-}
-
-bool ChatHandler::HandleListFreezeCommand(const char * /*args*/)
-{
- // Get names from DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
-
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- {
- SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
- return true;
- }
- //Header of the names
- PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
-
- //Output of the results
- do
- {
- Field* fields = result->Fetch();
- std::string fplayers = fields[0].GetString();
- PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, fplayers.c_str());
- } while (result->NextRow());
-
- return true;
-}
-
-bool ChatHandler::HandleGroupLeaderCommand(const char *args)
-{
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* cname = strtok((char*)args, " ");
-
- if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
- if (group && group->GetLeaderGUID() != guid)
- {
- group->ChangeLeader(guid);
- group->SendUpdate();
- }
-
- return true;
-}
-
-bool ChatHandler::HandleGroupDisbandCommand(const char *args)
-{
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* cname = strtok((char*)args, " ");
-
- if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
- if (group)
- group->Disband();
-
- return true;
-}
-
-bool ChatHandler::HandleGroupRemoveCommand(const char *args)
-{
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* cname = strtok((char*)args, " ");
-
- if (GetPlayerGroupAndGUIDByName(cname, player, group, guid, true))
- if (group)
- group->RemoveMember(guid);
-
- return true;
-}
-
-bool ChatHandler::HandlePossessCommand(const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- return false;
-
- m_session->GetPlayer()->CastSpell(unit, 530, true);
- return true;
-}
-
-bool ChatHandler::HandleUnPossessCommand(const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- unit = m_session->GetPlayer();
-
- unit->RemoveCharmAuras();
-
- return true;
-}
-
-bool ChatHandler::HandleBindSightCommand(const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- return false;
-
- m_session->GetPlayer()->CastSpell(unit, 6277, true);
- return true;
-}
-
-bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- if (player->isPossessing())
- return false;
-
- player->StopCastingBindSight();
- return true;
-}
diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp
deleted file mode 100755
index 177899efbf0..00000000000
--- a/src/server/game/Chat/Commands/TicketCommands.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * Copyright (C) 2008-2012 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 "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "ObjectMgr.h"
-#include "TicketMgr.h"
-#include "AccountMgr.h"
-#include "Chat.h"
-#include "Player.h"
-
-bool ChatHandler::HandleGMTicketListCommand(const char* /*args*/)
-{
- sTicketMgr->ShowList(*this, false);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketListOnlineCommand(const char* /*args*/)
-{
- sTicketMgr->ShowList(*this, true);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketListClosedCommand(const char* /*args*/)
-{
- sTicketMgr->ShowClosedList(*this);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketListEscalatedCommand(const char* /*args*/)
-{
- sTicketMgr->ShowEscalatedList(*this);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket *ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetViewed();
- ticket->SaveToDB(trans);
-
- SendSysMessage(ticket->FormatMessageString(*this, true).c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string name(args);
- if (!normalizePlayerName(name))
- return false;
-
- // Detect target's GUID
- uint64 guid = 0;
- if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
- guid = player->GetGUID();
- else
- guid = sObjectMgr->GetPlayerGUIDByName(name);
-
- // Target must exist
- if (!guid)
- {
- SendSysMessage(LANG_NO_PLAYERS_FOUND);
- return true;
- }
-
- // Ticket must exist
- GmTicket *ticket = sTicketMgr->GetTicketByPlayer(guid);
- if (!ticket)
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetViewed();
- ticket->SaveToDB(trans);
-
- SendSysMessage(ticket->FormatMessageString(*this, true).c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Ticket should be assigned to the player who tries to close it.
- // Console can override though
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
- return true;
- }
-
- sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, player ? player->GetName() : "Console", NULL, NULL, NULL);
- SendGlobalGMSysMessage(msg.c_str());
-
- // Inform player, who submitted this ticket, that it is closed
- if (Player* submitter = ticket->GetPlayer())
- {
- if (submitter->IsInWorld())
- {
- WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
- data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
- submitter->GetSession()->SendPacket(&data);
- }
- }
- return true;
-}
-
-bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char* sTicketId = strtok((char*)args, " ");
- uint32 ticketId = atoi(sTicketId);
-
- char* sTarget = strtok(NULL, " ");
- if (!sTarget)
- return false;
-
- std::string target(sTarget);
- if (!normalizePlayerName(target))
- return false;
-
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Get target information
- uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
- uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
- uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccId, realmID);
-
- // Target must exist and have administrative rights
- if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
- {
- SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
- return true;
- }
-
- // If already assigned, leave
- if (ticket->IsAssignedTo(targetGuid))
- {
- PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
- return true;
- }
-
- // If assigned to different player other than current, leave
- //! Console can override though
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
- return true;
- }
-
- // Assign ticket
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
- ticket->SaveToDB(trans);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, NULL, target.c_str(), NULL, NULL);
- SendGlobalGMSysMessage(msg.c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket *ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
- // Ticket must be assigned
- if (!ticket->IsAssigned())
- {
- PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId());
- return true;
- }
-
- // Get security level of player, whom this ticket is assigned to
- uint32 security = SEC_PLAYER;
- Player* assignedPlayer = ticket->GetAssignedPlayer();
- if (assignedPlayer && assignedPlayer->IsInWorld())
- security = assignedPlayer->GetSession()->GetSecurity();
- else
- {
- uint64 guid = ticket->GetAssignedToGUID();
- uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
- security = AccountMgr::GetSecurity(accountId, realmID);
- }
-
- // Check security
- //! If no m_session present it means we're issuing this command from the console
- uint32 mySecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;
- if (security > mySecurity)
- {
- SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetUnassigned();
- ticket->SaveToDB(trans);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(),
- m_session ? m_session->GetPlayer()->GetName() : "Console", NULL);
- SendGlobalGMSysMessage(msg.c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketCommentCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char* tguid = strtok((char*)args, " ");
- uint32 ticketId = atoi(tguid);
-
- char* comment = strtok(NULL, "\n");
- if (!comment)
- return false;
-
- GmTicket *ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed())
- {
- PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Cannot comment ticket assigned to someone else
- //! Console excluded
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetComment(comment);
- ticket->SaveToDB(trans);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL);
- msg += PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment);
- SendGlobalGMSysMessage(msg.c_str());
-
- return true;
-}
-
-bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket)
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- if (!ticket->IsClosed())
- {
- SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
- return true;
- }
-
- std::string msg = ticket->FormatMessageString(*this, NULL, NULL, NULL, m_session ? m_session->GetPlayer()->GetName() : "Console");
- SendGlobalGMSysMessage(msg.c_str());
-
- sTicketMgr->RemoveTicket(ticket->GetId());
- sTicketMgr->UpdateLastChange();
-
- if (Player* player = ticket->GetPlayer())
- {
- if (player->IsInWorld())
- {
- // Force abandon ticket
- WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
- data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
- player->GetSession()->SendPacket(&data);
- }
- }
- return true;
-}
-
-bool ChatHandler::HandleGMTicketResetCommand(const char* /* args */)
-{
- if (sTicketMgr->GetOpenTicketCount() > 0)
- {
- SendSysMessage(LANG_COMMAND_TICKETPENDING);
- return true;
- }
- else
- {
- sTicketMgr->ResetTickets();
- SendSysMessage(LANG_COMMAND_TICKETRESET);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleToggleGMTicketSystem(const char* /* args */)
-{
- bool status = !sTicketMgr->GetStatus();
- sTicketMgr->SetStatus(status);
- PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketEscalateCommand(const char *args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || !ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED)
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE);
-
- if (Player* player = ticket->GetPlayer())
- if (player->IsInWorld())
- sTicketMgr->SendTicket(player->GetSession(), ticket);
-
- sTicketMgr->UpdateLastChange();
- return true;
-}
-
-bool ChatHandler::HandleGMTicketCompleteCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || !ticket->IsClosed() || ticket->IsCompleted())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- if (Player* player = ticket->GetPlayer())
- if (player->IsInWorld())
- ticket->SendResponse(player->GetSession());
-
- sTicketMgr->UpdateLastChange();
- return true;
-}
-
-inline bool ChatHandler::_HandleGMTicketResponseAppendCommand(const char* args, bool newLine)
-{
- if (!*args)
- return false;
-
- char* sTicketId = strtok((char*)args, " ");
- uint32 ticketId = atoi(sTicketId);
-
- char* response = strtok(NULL, "\n");
- if (!response)
- return false;
-
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || !ticket->IsClosed())
- {
- PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Cannot add response to ticket, assigned to someone else
- //! Console excluded
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->AppendResponse(response);
- if (newLine)
- ticket->AppendResponse("\n");
- ticket->SaveToDB(trans);
-
- return true;
-}
-
-bool ChatHandler::HandleGMTicketResponseAppendCommand(const char* args)
-{
- return _HandleGMTicketResponseAppendCommand(args, false);
-}
-
-bool ChatHandler::HandleGMTicketResponseAppendLnCommand(const char* args)
-{
- return _HandleGMTicketResponseAppendCommand(args, true);
-}
diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h
index 8a49d230161..b8991d8faf8 100755
--- a/src/server/game/Combat/HostileRefManager.h
+++ b/src/server/game/Combat/HostileRefManager.h
@@ -71,4 +71,3 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
};
//=================================================
#endif
-
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index d82e43ba83b..87853a53b6c 100755
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
return false;
// not in same map or phase
- if (!hatedUnit->IsInMap(hatingUnit))
+ if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit))
return false;
// spell not causing threat
@@ -182,6 +182,7 @@ void HostileReference::updateOnlineStatus()
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
&& !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT)
&& getTarget()->IsInMap(getSourceUnit())
+ && getTarget()->InSamePhase(getSourceUnit())
)
{
Creature* creature = getSourceUnit()->ToCreature();
@@ -193,7 +194,6 @@ void HostileReference::updateOnlineStatus()
}
else
accessible = true;
-
}
setAccessibleState(accessible);
setOnlineOfflineState(online);
@@ -353,7 +353,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
// list sorted and and we check current target, then this is best case
if (currentVictim == currentRef || currentRef->getThreat() <= 1.1f * currentVictim->getThreat())
{
- currentRef = currentVictim; // for second case
+ if (currentVictim != currentRef && attacker->canCreatureAttack(currentVictim->getTarget()))
+ currentRef = currentVictim; // for second case, if currentvictim is attackable
+
found = true;
break;
}
@@ -534,6 +536,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
setCurrentVictim(NULL);
setDirty(true);
}
+ iOwner->SendRemoveFromThreatListOpcode(hostilRef);
iThreatContainer.remove(hostilRef);
iThreatOfflineContainer.addReference(hostilRef);
}
diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h
index 39c79b8273a..de60491de89 100755
--- a/src/server/game/Combat/UnitEvents.h
+++ b/src/server/game/Combat/UnitEvents.h
@@ -77,7 +77,6 @@ class UnitBaseEvent
bool matchesTypeMask(uint32 pMask) const { return iType & pMask; }
void setType(uint32 pType) { iType = pType; }
-
};
//==============================================================
@@ -134,4 +133,3 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
//==============================================================
#endif
-
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 96f454fd3e2..7bb28556514 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "Player.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
@@ -190,7 +189,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
}
case CONDITION_OBJECT_ENTRY:
{
- if (object->GetTypeId() == ConditionValue1)
+ if (uint32(object->GetTypeId()) == ConditionValue1)
condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2);
break;
}
@@ -441,7 +440,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
uint32 Condition::GetMaxAvailableConditionTargets()
{
// returns number of targets which are available for given source type
- switch(SourceType)
+ switch (SourceType)
{
case CONDITION_SOURCE_TYPE_SPELL:
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
@@ -686,7 +685,7 @@ void ConditionMgr::LoadConditions(bool isReload)
//must clear all custom handled cases (groupped types) before reload
if (isReload)
{
- sLog->outString("Reseting Loot Conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reseting Loot Conditions...");
LootTemplates_Creature.ResetConditions();
LootTemplates_Fishing.ResetConditions();
LootTemplates_Gameobject.ResetConditions();
@@ -700,10 +699,10 @@ void ConditionMgr::LoadConditions(bool isReload)
LootTemplates_Prospecting.ResetConditions();
LootTemplates_Spell.ResetConditions();
- sLog->outString("Re-Loading `gossip_menu` Table for Conditions!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table for Conditions!");
sObjectMgr->LoadGossipMenu();
- sLog->outString("Re-Loading `gossip_menu_option` Table for Conditions!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table for Conditions!");
sObjectMgr->LoadGossipMenuItems();
sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists();
}
@@ -713,8 +712,8 @@ void ConditionMgr::LoadConditions(bool isReload)
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 conditions. DB table `conditions` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!");
+
return;
}
@@ -722,7 +721,6 @@ void ConditionMgr::LoadConditions(bool isReload)
do
{
-
Field* fields = result->Fetch();
Condition* cond = new Condition();
@@ -750,7 +748,7 @@ void ConditionMgr::LoadConditions(bool isReload)
{
if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip
{
- sLog->outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId);
+ sLog->outError(LOG_FILTER_SQL, "Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId);
delete cond;
continue;
}
@@ -761,19 +759,19 @@ void ConditionMgr::LoadConditions(bool isReload)
rowType = "reference";
//check for useless data
if (cond->ConditionTarget)
- sLog->outErrorDb("Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget);
if (cond->ConditionValue1)
- sLog->outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1);
if (cond->ConditionValue2)
- sLog->outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3);
if (cond->NegativeCondition)
- sLog->outErrorDb("Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition);
if (cond->SourceGroup && iSourceTypeOrReferenceId < 0)
- sLog->outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup);
if (cond->SourceEntry && iSourceTypeOrReferenceId < 0)
- sLog->outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry);
}
else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType
{
@@ -804,13 +802,13 @@ void ConditionMgr::LoadConditions(bool isReload)
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType))
{
- sLog->outErrorDb("Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup);
delete cond;
continue;
}
if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType))
{
- sLog->outErrorDb("Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId);
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId);
delete cond;
continue;
}
@@ -896,7 +894,7 @@ void ConditionMgr::LoadConditions(bool isReload)
if (!valid)
{
- sLog->outErrorDb("Not handled grouped condition, SourceGroup %u", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "Not handled grouped condition, SourceGroup %u", cond->SourceGroup);
delete cond;
}
else
@@ -928,22 +926,22 @@ void ConditionMgr::LoadConditions(bool isReload)
}
while (result->NextRow());
- sLog->outString(">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot)
{
if (!loot)
{
- sLog->outErrorDb("ConditionMgr: LootTemplate %u not found", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "ConditionMgr: LootTemplate %u not found", cond->SourceGroup);
return false;
}
if (loot->addConditionItem(cond))
return true;
- sLog->outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -963,7 +961,7 @@ bool ConditionMgr::addToGossipMenus(Condition* cond)
}
}
- sLog->outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "addToGossipMenus: GossipMenu %u not found", cond->SourceGroup);
return false;
}
@@ -982,7 +980,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
}
}
- sLog->outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry);
return false;
}
@@ -1037,7 +1035,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
// we have overlapping masks in db
if (conditionEffMask != *itr)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - "
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - "
"effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -1062,7 +1060,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX)
{
- sLog->outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType));
+ sLog->outError(LOG_FILTER_SQL, "Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType));
return false;
}
@@ -1072,7 +1070,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1080,7 +1078,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1089,7 +1087,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Disenchant.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1097,7 +1095,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1106,7 +1104,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Fishing.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1114,7 +1112,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1123,7 +1121,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Gameobject.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1131,7 +1129,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1140,7 +1138,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Item.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1148,7 +1146,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1157,7 +1155,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Mail.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1165,7 +1163,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1174,7 +1172,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Milling.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1182,7 +1180,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1191,7 +1189,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Pickpocketing.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1199,7 +1197,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1208,7 +1206,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Prospecting.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1216,7 +1214,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1225,7 +1223,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Reference.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1233,7 +1231,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1242,7 +1240,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Skinning.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1250,7 +1248,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1259,7 +1257,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Spell.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1267,7 +1265,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1277,13 +1275,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry);
if (!spellInfo)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -1314,7 +1312,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
break;
}
- sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
cond->SourceGroup &= ~(1<<i);
}
// all effects were removed, no need to add the condition at all
@@ -1326,7 +1324,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!sObjectMgr->GetCreatureTemplate(cond->SourceEntry))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry);
return false;
}
break;
@@ -1336,7 +1334,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry);
if (!spellProto)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
break;
@@ -1344,40 +1342,40 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
case CONDITION_SOURCE_TYPE_QUEST_ACCEPT:
if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry))
{
- sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry);
return false;
}
break;
case CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK:
if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry))
{
- sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry);
return false;
}
break;
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL:
if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
return false;
}
if (!sSpellMgr->GetSpellInfo(cond->SourceEntry))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
break;
case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT:
if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
return false;
}
if (!sSpellMgr->GetSpellInfo(cond->SourceEntry))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
break;
@@ -1395,13 +1393,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX)
{
- sLog->outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry);
return false;
}
if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
@@ -1411,17 +1409,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1))
{
- sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 > EFFECT_2)
{
- sLog->outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Aura condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Aura condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ITEM:
@@ -1429,13 +1427,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1);
if (!proto)
{
- sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Item condition has non existing item (%u), skipped", cond->ConditionValue1);
return false;
}
if (!cond->ConditionValue2)
{
- sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2);
return false;
}
break;
@@ -1445,14 +1443,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1);
if (!proto)
{
- sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ZONEID:
@@ -1460,20 +1458,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->ConditionValue1);
if (!areaEntry)
{
- sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1);
return false;
}
if (areaEntry->zone != 0)
{
- sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_REPUTATION_RANK:
@@ -1481,25 +1479,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->ConditionValue1);
if (!factionEntry)
{
- sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TEAM:
{
if (cond->ConditionValue1 != ALLIANCE && cond->ConditionValue1 != HORDE)
{
- sLog->outErrorDb("Team condition specifies unknown team (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Team condition specifies unknown team (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Team condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Team condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_SKILL:
@@ -1507,17 +1505,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->ConditionValue1);
if (!pSkill)
{
- sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 < 1 || cond->ConditionValue2 > sWorld->GetConfigMaxSkillValue())
{
- sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Skill condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_QUESTREWARDED:
@@ -1527,14 +1525,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1))
{
- sLog->outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 > 1)
- sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Quest condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Quest condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ACTIVE_EVENT:
@@ -1542,14 +1540,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
if (cond->ConditionValue1 >=events.size() || !events[cond->ConditionValue1].isValid())
{
- sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ACHIEVEMENT:
@@ -1557,42 +1555,42 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1);
if (!achievement)
{
- sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_CLASS:
{
if (!(cond->ConditionValue1 & CLASSMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE);
+ sLog->outError(LOG_FILTER_SQL, "Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Class condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Class condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_RACE:
{
if (!(cond->ConditionValue1 & RACEMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE);
+ sLog->outError(LOG_FILTER_SQL, "Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_MAPID:
@@ -1600,77 +1598,77 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1);
if (!me)
{
- sLog->outErrorDb("Map condition has non existing map (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Map condition has non existing map (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Map condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Map condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_SPELL:
{
if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1))
{
- sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_LEVEL:
{
if (cond->ConditionValue2 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Level condition has invalid option (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Level condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_DRUNKENSTATE:
{
if (cond->ConditionValue1 > DRUNKEN_SMASHED)
{
- sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
{
- sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_NEAR_CREATURE:
{
if (!sObjectMgr->GetCreatureTemplate(cond->ConditionValue1))
{
- sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_NEAR_GAMEOBJECT:
{
if (!sObjectMgr->GetGameObjectTemplate(cond->ConditionValue1))
{
- sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_OBJECT_ENTRY:
@@ -1680,79 +1678,79 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
case TYPEID_UNIT:
if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2))
{
- sLog->outErrorDb("ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2);
return false;
}
break;
case TYPEID_GAMEOBJECT:
if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2))
{
- sLog->outErrorDb("ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2);
return false;
}
break;
case TYPEID_PLAYER:
case TYPEID_CORPSE:
if (cond->ConditionValue2)
- sLog->outErrorDb("ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2);
break;
default:
- sLog->outErrorDb("ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TYPE_MASK:
{
if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE)))
{
- sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_RELATION_TO:
{
if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue1 == cond->ConditionTarget)
{
- sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 >= RELATION_MAX)
{
- sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_REACTION_TO:
{
if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue1 == cond->ConditionTarget)
{
- sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
return false;
}
if (!cond->ConditionValue2)
{
- sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2);
return false;
}
break;
@@ -1761,17 +1759,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue1 == cond->ConditionTarget)
{
- sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3);
return false;
}
break;
@@ -1779,38 +1777,38 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
case CONDITION_ALIVE:
{
if (cond->ConditionValue1)
- sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value1 (%u)!", cond->ConditionValue1);
if (cond->ConditionValue2)
- sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_HP_VAL:
{
if (cond->ConditionValue2 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_HP_PCT:
{
if (cond->ConditionValue1 > 100)
{
- sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_AREAID:
@@ -1820,19 +1818,19 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (!sWorld->getWorldState(cond->ConditionValue1))
{
- sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "World state condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_PHASEMASK:
{
if (cond->ConditionValue2)
- sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TITLE:
@@ -1840,22 +1838,22 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1);
if (!titleEntry)
{
- sLog->outErrorDb("Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1);
return false;
}
break;
}
case CONDITION_UNUSED_19:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring");
+ sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring");
return false;
case CONDITION_UNUSED_20:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring");
+ sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring");
return false;
case CONDITION_UNUSED_21:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring");
+ sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring");
return false;
case CONDITION_UNUSED_24:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring");
+ sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring");
return false;
default:
break;
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index d7a769d3f5c..27695f3eafa 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -59,8 +59,8 @@ void LoadDisables()
if (!result)
{
- sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!");
+
return;
}
@@ -71,7 +71,7 @@ void LoadDisables()
DisableType type = DisableType(fields[0].GetUInt32());
if (type >= MAX_DISABLE_TYPES)
{
- sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type);
+ sLog->outError(LOG_FILTER_SQL, "Invalid type %u specified in `disables` table, skipped.", type);
continue;
}
@@ -88,13 +88,13 @@ void LoadDisables()
case DISABLE_TYPE_SPELL:
if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
{
- sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
{
- sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags for spell %u are invalid, skipped.", entry);
continue;
}
@@ -121,7 +121,7 @@ void LoadDisables()
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
{
- sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
bool isFlagInvalid = false;
@@ -142,12 +142,12 @@ void LoadDisables()
break;
case MAP_BATTLEGROUND:
case MAP_ARENA:
- sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Battleground map %u specified to be disabled in map case, skipped.", entry);
continue;
}
if (isFlagInvalid)
{
- sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags for map %u are invalid, skipped.", entry);
continue;
}
break;
@@ -155,64 +155,64 @@ void LoadDisables()
case DISABLE_TYPE_BATTLEGROUND:
if (!sBattlemasterListStore.LookupEntry(entry))
{
- sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
- sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for battleground %u, useless data.", entry);
break;
case DISABLE_TYPE_OUTDOORPVP:
if (entry > MAX_OUTDOORPVP_TYPES)
{
- sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
continue;
}
if (flags)
- sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for outdoor PvP %u, useless data.", entry);
break;
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
if (!sAchievementCriteriaStore.LookupEntry(entry))
{
- sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
- sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for Achievement Criteria %u, useless data.", entry);
break;
case DISABLE_TYPE_VMAP:
{
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
{
- sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
switch (mapEntry->map_type)
{
case MAP_COMMON:
if (flags & VMAP_DISABLE_AREAFLAG)
- sLog->outString("Areaflag disabled for world map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Areaflag disabled for world map %u.", entry);
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
- sLog->outString("Liquid status disabled for world map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Liquid status disabled for world map %u.", entry);
break;
case MAP_INSTANCE:
case MAP_RAID:
if (flags & VMAP_DISABLE_HEIGHT)
- sLog->outString("Height disabled for instance map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for instance map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
- sLog->outString("LoS disabled for instance map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for instance map %u.", entry);
break;
case MAP_BATTLEGROUND:
if (flags & VMAP_DISABLE_HEIGHT)
- sLog->outString("Height disabled for battleground map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for battleground map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
- sLog->outString("LoS disabled for battleground map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for battleground map %u.", entry);
break;
case MAP_ARENA:
if (flags & VMAP_DISABLE_HEIGHT)
- sLog->outString("Height disabled for arena map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for arena map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
- sLog->outString("LoS disabled for arena map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for arena map %u.", entry);
break;
default:
break;
@@ -228,8 +228,8 @@ void LoadDisables()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
+
}
void CheckQuestDisables()
@@ -239,8 +239,8 @@ void CheckQuestDisables()
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
if (!count)
{
- sLog->outString(">> Checked 0 quest disables.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables.");
+
return;
}
@@ -250,17 +250,17 @@ void CheckQuestDisables()
const uint32 entry = itr->first;
if (!sObjectMgr->GetQuestTemplate(entry))
{
- sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Quest entry %u from `disables` doesn't exist, skipped.", entry);
m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++);
continue;
}
if (itr->second.flags)
- sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for quest %u, useless data.", entry);
++itr;
}
- sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index 80949effa0c..e73480cb4de 100755
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -245,7 +245,7 @@ enum AreaFlags
AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?)
AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag)
AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled)
- AREA_FLAG_NEED_FLY = 0x00001000, // Unknown
+ AREA_FLAG_NEED_FLY = 0x00001000, // Respawn alive at the graveyard without corpse
AREA_FLAG_UNUSED1 = 0x00002000, // Unused in 3.3.5a
AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag)
AREA_FLAG_OUTDOOR_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area)
@@ -260,7 +260,7 @@ enum AreaFlags
AREA_FLAG_WINTERGRASP = 0x01000000, // Wintergrasp and it's subzones
AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors
AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors
- AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Same as AREA_FLAG_WINTERGRASP except for The Sunken Ring and Western Bridge.
+ AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Can Hearth And Resurrect From Area
AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly
};
@@ -416,16 +416,27 @@ enum SummonPropFlags
enum VehicleSeatFlags
{
+ VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_ENTER = 0x00000001,
+ VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_RIDE = 0x00000002,
+ VEHICLE_SEAT_FLAG_SHOULD_USE_VEH_SEAT_EXIT_ANIM_ON_VOLUNTARY_EXIT = 0x00000008,
VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
- VEHICLE_SEAT_FLAG_UNK1 = 0x00000400, // needed for CGCamera__SyncFreeLookFacing
+ VEHICLE_SEAT_FLAG_ALLOW_TURNING = 0x00000400, // needed for CGCamera__SyncFreeLookFacing
VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL = 0x00001000, // Can cast spells with SPELL_AURA_MOUNTED from seat (possibly 4.x only, 0 seats on 3.3.5a)
VEHICLE_SEAT_FLAG_UNCONTROLLED = 0x00002000, // can override !& VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT
VEHICLE_SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle
+ VEHICLE_SEAT_FLAG_SHOULD_USE_VEH_SEAT_EXIT_ANIMN_ON_FORCED_EXIT = 0x00008000,
+ VEHICLE_SEAT_FLAG_HAS_VEH_EXIT_ANIM_VOLUNTARY_EXIT = 0x00040000,
+ VEHICLE_SEAT_FLAG_HAS_VEH_EXIT_ANIM_FORCED_EXIT = 0x00080000,
+ VEHICLE_SEAT_FLAG_REC_HAS_VEHICLE_ENTER_ANIM = 0x00400000,
+ VEHICLE_SEAT_FLAG_ENABLE_VEHICLE_ZOOM = 0x01000000,
VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT = 0x02000000, // Lua_CanExitVehicle - can enter and exit at free will
VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
+ VEHICLE_SEAT_FLAG_HAS_START_WARITING_FOR_VEH_TRANSITION_ANIM_ENTER = 0x08000000,
+ VEHICLE_SEAT_FLAG_HAS_START_WARITING_FOR_VEH_TRANSITION_ANIM_EXIT = 0x10000000,
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
VEHICLE_SEAT_FLAG_UNK2 = 0x40000000, // checked in conjunction with 0x800 in CastSpell2
+ VEHICLE_SEAT_FLAG_ALLOWS_INTERACTION = 0x80000000,
};
enum VehicleSeatFlagsB
@@ -437,6 +448,7 @@ enum VehicleSeatFlagsB
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
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 4be6c33db79..850c58bdf93 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -200,7 +200,7 @@ uint32 DBCFileCount = 0;
static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename)
{
- sLog->outError("Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
+ sLog->outError(LOG_FILTER_GENERAL, "Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
// ASSERT must fail after function call
return false;
@@ -457,7 +457,7 @@ void LoadDBCStores(const std::string& dataPath)
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
{
if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
- sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
+ sLog->outError(LOG_FILTER_SQL, "spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0
}
else
@@ -610,7 +610,7 @@ void LoadDBCStores(const std::string& dataPath)
// error checks
if (bad_dbc_files.size() >= DBCFileCount)
{
- sLog->outError("Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
exit(1);
}
else if (!bad_dbc_files.empty())
@@ -619,7 +619,7 @@ void LoadDBCStores(const std::string& dataPath)
for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
str += *i + "\n";
- sLog->outError("Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
exit(1);
}
@@ -632,12 +632,12 @@ void LoadDBCStores(const std::string& dataPath)
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
- sLog->outError("You have _outdated_ DBC files. Please extract correct versions from current using client.");
+ sLog->outError(LOG_FILTER_GENERAL, "You have _outdated_ DBC files. Please extract correct versions from current using client.");
exit(1);
}
- sLog->outString(">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
+
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 15792fd57da..fdec06f6f48 100755
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1052,7 +1052,7 @@ struct GtRegenMPPerSptEntry
/* no used
struct HolidayDescriptionsEntry
{
- uint32 ID; // 0, this is NOT holiday id
+ uint32 ID; // 0, m_holidayDescriptionID
//char* name[16] // 1-16 m_name_lang
// 17 name flags
};
@@ -1061,7 +1061,7 @@ struct HolidayDescriptionsEntry
/* no used
struct HolidayNamesEntry
{
- uint32 ID; // 0, this is NOT holiday id
+ uint32 ID; // 0, m_holidayNameID
//char* name[16] // 1-16 m_name_lang
// 17 name flags
};
@@ -1203,7 +1203,7 @@ struct LFGDungeonEntry
uint32 recmaxlevel; // 22
int32 map; // 23
uint32 difficulty; // 24
- //uint32 flags; // 25
+ //uint32 flags; // 25 (flags & 4) = IsHoliday
uint32 type; // 26
//uint32 unk; // 27
//char* iconname; // 28
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 47c298d7467..bb6c1dfdcc1 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -135,8 +135,7 @@ void LFGMgr::LoadRewards()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
return;
}
@@ -157,25 +156,25 @@ void LFGMgr::LoadRewards()
if (!sLFGDungeonStore.LookupEntry(dungeonId))
{
- sLog->outErrorDb("Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
continue;
}
if (!maxLevel || maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- sLog->outErrorDb("Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
}
if (firstQuestId && !sObjectMgr->GetQuestTemplate(firstQuestId))
{
- sLog->outErrorDb("First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
firstQuestId = 0;
}
if (otherQuestId && !sObjectMgr->GetQuestTemplate(otherQuestId))
{
- sLog->outErrorDb("Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
otherQuestId = 0;
}
@@ -183,8 +182,7 @@ void LFGMgr::LoadRewards()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void LFGMgr::Update(uint32 diff)
@@ -310,7 +308,7 @@ void LFGMgr::Update(uint32 diff)
LfgQueueInfo* queue = itQueue->second;
if (!queue)
{
- sLog->outError("LFGMgr::Update: [" UI64FMTD "] queued with null queue info!", itQueue->first);
+ sLog->outError(LOG_FILTER_LFG, "LFGMgr::Update: [" UI64FMTD "] queued with null queue info!", itQueue->first);
continue;
}
uint32 dungeonId = (*queue->dungeons.begin());
@@ -433,8 +431,8 @@ void LFGMgr::InitializeLockedDungeons(Player* player)
locktype = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
{
- if (!player->GetGroup() || !player->GetGroup()->isLFGGroup() || GetDungeon(player->GetGroup()->GetGUID(), true) != dungeon->ID || GetState(player->GetGroup()->GetGUID()) != LFG_STATE_DUNGEON)
- locktype = LFG_LOCKSTATUS_RAID_LOCKED;
+ //if (!player->GetGroup() || !player->GetGroup()->isLFGGroup() || GetDungeon(player->GetGroup()->GetGUID(), true) != dungeon->ID || GetState(player->GetGroup()->GetGUID()) != LFG_STATE_DUNGEON)
+ locktype = LFG_LOCKSTATUS_RAID_LOCKED;
}
else if (dungeon->minlevel > level)
locktype = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
@@ -791,7 +789,7 @@ LfgProposal* LFGMgr::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FindNewGroup: (%s) - all(%s)", ConcatenateGuids(check).c_str(), ConcatenateGuids(all).c_str());
LfgProposal* pProposal = NULL;
- if (!check.size() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal))
+ if (check.empty() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal))
return NULL;
// Try to match with queued groups
@@ -863,7 +861,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
if (itQueue == m_QueueInfoMap.end() || GetState(guid) != LFG_STATE_QUEUED)
{
- sLog->outError("LFGMgr::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", (*it));
+ sLog->outError(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", (*it));
RemoveFromQueue(guid);
return false;
}
@@ -1241,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key)
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap)
{
lockMap.clear();
- for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it)
+ for (PlayerSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{
uint64 guid = (*it)->GetGUID();
LfgLockMap cachedLockMap = GetLockedDungeons(guid);
- for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2)
+ for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
@@ -1404,19 +1402,23 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
LfgProposalPlayer* player = pProposal->players[(*it)->GetGUID()];
uint32 lowgroupguid = (*it)->GetGroup() ? (*it)->GetGroup()->GetLowGUID() : 0;
if (player->groupLowGuid != lowgroupguid)
- sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid);
+ sLog->outError(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid);
uint64 guid2 = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid2);
if (itQueue == m_QueueInfoMap.end())
{
- sLog->outError("LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid);
+ sLog->outError(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid);
waitTimesMap[(*it)->GetGUID()] = -1;
}
else
waitTimesMap[(*it)->GetGUID()] = int32(joinTime - itQueue->second->joinTime);
}
+ // Set the dungeon difficulty
+ LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId);
+ ASSERT(dungeon);
+
// Create a new group (if needed)
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL;
@@ -1427,6 +1429,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
Group* group = player->GetGroup();
if (sendUpdate)
player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
+
if (group)
{
player->GetSession()->SendLfgUpdateParty(updateData);
@@ -1478,14 +1481,16 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
break;
}
}
+
m_teleport.push_back(pguid);
grp->SetLfgRoles(pguid, pProposal->players[pguid]->role);
SetState(pguid, LFG_STATE_DUNGEON);
+
+ // Add the cooldown spell if queued for a random dungeon
+ if (dungeon->type == LFG_TYPE_RANDOM)
+ player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
}
- // Set the dungeon difficulty
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId);
- ASSERT(dungeon);
grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
uint64 gguid = grp->GetGUID();
SetDungeon(gguid, dungeon->Entry());
@@ -1626,6 +1631,7 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas
{
if (!grp)
return;
+
uint64 gguid = grp->GetGUID();
SetState(gguid, LFG_STATE_BOOT);
@@ -1635,7 +1641,6 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas
pBoot->reason = reason;
pBoot->victim = victim;
pBoot->votedNeeded = GetVotesNeeded(gguid);
- PlayerSet players;
// Set votes
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1651,15 +1656,11 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas
else
{
pBoot->votes[guid] = LFG_ANSWER_PENDING; // Other members need to vote
- players.insert(plrg);
+ plrg->GetSession()->SendLfgBootPlayer(pBoot);
}
}
}
- // Notify players
- for (PlayerSet::const_iterator it = players.begin(); it != players.end(); ++it)
- (*it)->GetSession()->SendLfgBootPlayer(pBoot);
-
m_Boots[grp->GetLowGUID()] = pBoot;
}
@@ -1748,14 +1749,7 @@ void LFGMgr::UpdateBoot(Player* player, bool accept)
void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in");
- if (out)
- {
- player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
- player->TeleportToBGEntryPoint();
- return;
- }
- // TODO Add support for LFG_TELEPORTERROR_FATIGUE
LfgTeleportError error = LFG_TELEPORTERROR_OK;
Group* grp = player->GetGroup();
@@ -1765,10 +1759,25 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
error = LFG_TELEPORTERROR_PLAYER_DEAD;
else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING))
error = LFG_TELEPORTERROR_FALLING;
+ else if (player->IsMirrorTimerActive(FATIGUE_TIMER))
+ error = LFG_TELEPORTERROR_FATIGUE;
else
{
- uint64 gguid = grp->GetGUID();
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(gguid));
+ LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(grp->GetGUID()));
+
+ if (out)
+ {
+ // Player needs to be inside the LFG dungeon to be able to teleport out
+ if (dungeon && player->GetMapId() == uint32(dungeon->map))
+ {
+ player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
+ player->TeleportToBGEntryPoint();
+ }
+ else
+ player->GetSession()->SendLfgTeleportError(LFG_TELEPORTERROR_DONT_REPORT); // Not sure which error message to send
+
+ return;
+ }
if (!dungeon)
error = LFG_TELEPORTERROR_INVALID_LOCATION;
@@ -1802,7 +1811,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon->map);
if (!at)
{
- sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", player->GetGUID(), dungeon->map, dungeon->difficulty);
+ sLog->outError(LOG_FILTER_LFG, "LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", player->GetGUID(), dungeon->map, dungeon->difficulty);
error = LFG_TELEPORTERROR_INVALID_LOCATION;
}
else
@@ -1817,7 +1826,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
if (error == LFG_TELEPORTERROR_OK)
{
- if (!player->GetMap()->IsDungeon() && !player->GetMap()->IsRaid())
+ if (!player->GetMap()->IsDungeon())
player->SetBattlegroundEntryPoint();
if (player->isInFlight())
@@ -1832,7 +1841,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
else
{
error = LFG_TELEPORTERROR_INVALID_LOCATION;
- sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid);
+ sLog->outError(LOG_FILTER_LFG, "LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid);
}
}
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index d10902b9553..f21818deb64 100755
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -68,6 +68,7 @@ enum LfgTeleportError
LFG_TELEPORTERROR_OK = 0, // Internal use
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
LFG_TELEPORTERROR_FALLING = 2,
+ LFG_TELEPORTERROR_DONT_REPORT = 3,
LFG_TELEPORTERROR_FATIGUE = 4,
LFG_TELEPORTERROR_INVALID_LOCATION = 6
};
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 6175addfae2..e4b67e22221 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -23,9 +23,10 @@
#include "SharedDefines.h"
#include "Player.h"
#include "Group.h"
-#include "ScriptPCH.h"
#include "LFGScripts.h"
#include "LFGMgr.h"
+#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
{
@@ -117,13 +118,14 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
return;
}
+ uint32 state = sLFGMgr->GetState(gguid);
sLFGMgr->ClearState(guid);
sLFGMgr->SetState(guid, LFG_STATE_NONE);
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
+ if (method == GROUP_REMOVEMETHOD_LEAVE && state != LFG_STATE_FINISHED_DUNGEON && player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
+ player->CastSpell(player, LFG_SPELL_DUNGEON_DESERTER, false);
/*
- if (method == GROUP_REMOVEMETHOD_LEAVE)
- // Add deserter flag
else if (group->isLfgKickActive())
// Update internal kick cooldown of kicked
*/
@@ -134,7 +136,7 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
sLFGMgr->TeleportPlayer(player, true);
}
- if (sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon
+ if (state != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon
sLFGMgr->OfferContinue(group);
}
diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h
index 4b332c7d731..ac1f66abbda 100644
--- a/src/server/game/DungeonFinding/LFGScripts.h
+++ b/src/server/game/DungeonFinding/LFGScripts.h
@@ -21,7 +21,7 @@
#include "Common.h"
#include "SharedDefines.h"
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
class Player;
class Group;
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 5b7c40e5494..60c0b7ad394 100755
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -78,7 +78,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
if (!IsPositionValid())
{
- sLog->outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_PLAYER, "Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
return false;
}
@@ -89,7 +89,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask());
- SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
+ SetObjectScale(1);
SetUInt64Value(CORPSE_FIELD_OWNER, owner->GetGUID());
_gridCoord = Trinity::ComputeGridCoord(GetPositionX(), GetPositionY());
@@ -134,7 +134,7 @@ void Corpse::DeleteBonesFromWorld()
if (!corpse)
{
- sLog->outError("Bones %u not found in world.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Bones %u not found in world.", GetGUIDLow());
return;
}
@@ -194,7 +194,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
if (!IsPositionValid())
{
- sLog->outError("Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
+ sLog->outError(LOG_FILTER_PLAYER, "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
return false;
}
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 6a8ae07291a..866437d828c 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -135,7 +135,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit
bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
- m_owner.ForcedDespawn();
+ m_owner.DespawnOrUnsummon(); // since we are here, we are not TempSummon as object type cannot change during runtime
return true;
}
@@ -173,7 +173,7 @@ Creature::~Creature()
i_AI = NULL;
//if (m_uint32Values)
- // sLog->outError("Deconstruct Creature Entry = %u", GetEntry());
+ // sLog->outError(LOG_FILTER_UNITS, "Deconstruct Creature Entry = %u", GetEntry());
}
void Creature::AddToWorld()
@@ -261,7 +261,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!normalInfo)
{
- sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature::InitEntry creature entry %u does not exist.", Entry);
return false;
}
@@ -299,7 +299,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
// Cancel load if no model defined
if (!(cinfo->GetFirstValidModelId()))
{
- sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
return false;
}
@@ -307,7 +307,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (!minfo) // Cancel load if no model defined
{
- sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
return false;
}
@@ -333,7 +333,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate
SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate
- SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale);
+ SetObjectScale(cinfo->scale);
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight);
@@ -357,8 +357,9 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
m_regenHealth = cInfo->RegenHealth;
- // creatures always have melee weapon ready if any
- SetSheath(SHEATH_STATE_MELEE);
+ // creatures always have melee weapon ready if any unless specified otherwise
+ if (!GetCreatureAddon())
+ SetSheath(SHEATH_STATE_MELEE);
SelectLevel(GetCreatureTemplate());
if (team == HORDE)
@@ -467,13 +468,13 @@ void Creature::Update(uint32 diff)
switch (m_deathState)
{
- case JUST_ALIVED:
- // Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting.
- sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry());
+ case JUST_RESPAWNED:
+ // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
+ sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
break;
case JUST_DIED:
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
- sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
break;
case DEAD:
{
@@ -485,7 +486,7 @@ void Creature::Update(uint32 diff)
break;
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT);
- time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(dbtableHighGuid, GetMap()->GetInstanceId());
+ time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (!linkedRespawntime) // Can respawn
Respawn();
else // the master is dead
@@ -522,7 +523,7 @@ void Creature::Update(uint32 diff)
else if (m_corpseRemoveTime <= time(NULL))
{
RemoveCorpse(false);
- sLog->outStaticDebug("Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
+ sLog->outDebug(LOG_FILTER_UNITS, "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
}
break;
}
@@ -754,7 +755,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
- sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
return false;
}
@@ -768,7 +769,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
if (!IsPositionValid())
{
- sLog->outError("Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang);
+ sLog->outError(LOG_FILTER_UNITS, "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang);
return false;
}
@@ -795,10 +796,12 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
//! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there
if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
+ {
z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
- //! Relocate again with updated Z coord
- Relocate(x, y, z, ang);
+ //! Relocate again with updated Z coord
+ Relocate(x, y, z, ang);
+ }
uint32 displayID = GetNativeDisplayId();
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
@@ -833,7 +836,7 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const
if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS)
{
- sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
+ sLog->outError(LOG_FILTER_SQL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
GetGUIDLow(), GetEntry());
return false;
}
@@ -1035,7 +1038,7 @@ void Creature::SaveToDB()
CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid);
if (!data)
{
- sLog->outError("Creature::SaveToDB failed, cannot get creature data!");
+ sLog->outError(LOG_FILTER_UNITS, "Creature::SaveToDB failed, cannot get creature data!");
return;
}
@@ -1125,7 +1128,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt8(index++, uint8(GetDefaultMovementType()));
stmt->setUInt32(index++, npcflag);
stmt->setUInt32(index++, unit_flags);
- stmt->setUInt32(index, dynamicflags);
+ stmt->setUInt32(index++, dynamicflags);
trans->Append(stmt);
WorldDatabase.CommitTransaction(trans);
@@ -1249,7 +1252,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
- sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
return false;
}
@@ -1275,7 +1278,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
if (!data)
{
- sLog->outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
return false;
}
@@ -1300,7 +1303,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
m_respawnDelay = data->spawntimesecs;
m_deathState = ALIVE;
- m_respawnTime = sObjectMgr->GetCreatureRespawnTime(m_DBTableGuid, GetInstanceId());
+ m_respawnTime = GetMap()->GetCreatureRespawnTime(m_DBTableGuid);
if (m_respawnTime) // respawn on Update
{
m_deathState = DEAD;
@@ -1391,11 +1394,11 @@ void Creature::DeleteFromDB()
{
if (!m_DBTableGuid)
{
- sLog->outError("Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
return;
}
- sObjectMgr->RemoveCreatureRespawnTime(m_DBTableGuid, GetInstanceId());
+ GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
sObjectMgr->DeleteCreatureData(m_DBTableGuid);
SQLTransaction trans = WorldDatabase.BeginTransaction();
@@ -1552,7 +1555,7 @@ void Creature::setDeathState(DeathState s)
Unit::setDeathState(CORPSE);
}
- else if (s == JUST_ALIVED)
+ else if (s == JUST_RESPAWNED)
{
//if (isPet())
// setActive(true);
@@ -1595,9 +1598,9 @@ void Creature::Respawn(bool force)
if (getDeathState() == DEAD)
{
if (m_DBTableGuid)
- sObjectMgr->RemoveCreatureRespawnTime(m_DBTableGuid, GetInstanceId());
+ GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
- sLog->outStaticDebug("Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName(), GetGUIDLow(), GetGUID(), GetEntry());
+ sLog->outDebug(LOG_FILTER_UNITS, "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName(), GetGUIDLow(), GetGUID(), GetEntry());
m_respawnTime = 0;
lootForPickPocketed = false;
lootForBody = false;
@@ -1608,7 +1611,7 @@ void Creature::Respawn(bool force)
CreatureTemplate const* cinfo = GetCreatureTemplate();
SelectLevel(cinfo);
- setDeathState(JUST_ALIVED);
+ setDeathState(JUST_RESPAWNED);
uint32 displayID = GetNativeDisplayId();
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
@@ -1665,19 +1668,23 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
if (!spellInfo)
return false;
- // Spells that don't have effectMechanics.
- if (!spellInfo->HasAnyEffectMechanic() && GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
+ // Creature is immune to main mechanic of the spell
+ if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
return true;
// This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
// the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
bool immunedToAllEffects = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (!spellInfo->Effects[i].IsEffect())
+ continue;
if (!IsImmunedToSpellEffect(spellInfo, i))
{
immunedToAllEffects = false;
break;
}
+ }
if (immunedToAllEffects)
return true;
@@ -1707,7 +1714,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
+ sLog->outError(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]);
continue;
}
@@ -1755,7 +1762,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
+ sLog->outError(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]);
continue;
}
@@ -1827,7 +1834,7 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const
if (dist > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry());
dist = ATTACK_DISTANCE;
}
@@ -2010,7 +2017,7 @@ void Creature::SaveRespawnTime()
if (isSummon() || !m_DBTableGuid || (m_creatureData && !m_creatureData->dbData))
return;
- sObjectMgr->SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), m_respawnTime);
+ GetMap()->SaveCreatureRespawnTime(m_DBTableGuid, m_respawnTime);
}
// this should not be called by petAI or
@@ -2111,7 +2118,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
if (!AdditionalSpellInfo)
{
- sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
continue;
}
@@ -2119,7 +2126,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
if (HasAura(*itr))
{
if (!reload)
- sLog->outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
continue;
}
@@ -2146,7 +2153,7 @@ void Creature::SetInCombatWithZone()
{
if (!CanHaveThreatList())
{
- sLog->outError("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
return;
}
@@ -2154,7 +2161,7 @@ void Creature::SetInCombatWithZone()
if (!map->IsDungeon())
{
- sLog->outError("Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
+ sLog->outError(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
return;
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 4b5b07fd8a5..c8ebf1aa13b 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -507,7 +507,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
if (isPet())
return false;
- return GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS;
+ return GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_BOSS;
}
bool IsDungeonBoss() const;
@@ -635,7 +635,6 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void RemoveCorpse(bool setSpawnTime = true);
- void ForcedDespawn(uint32 timeMSToDespawn = 0);
void DespawnOrUnsummon(uint32 msTimeToDespawn = 0);
time_t const& GetRespawnTime() const { return m_respawnTime; }
@@ -678,6 +677,11 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); }
Position GetHomePosition() { return m_homePosition; }
+ void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
+ void SetTransportHomePosition(const Position &pos) { m_transportHomePosition.Relocate(pos); }
+ void GetTransportHomePosition(float &x, float &y, float &z, float &ori) { m_transportHomePosition.GetPosition(x, y, z, ori); }
+ Position GetTransportHomePosition() { return m_transportHomePosition; }
+
uint32 GetWaypointPath(){return m_path_id;}
void LoadPath(uint32 pathid) { m_path_id = pathid; }
@@ -751,6 +755,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
uint32 m_originalEntry;
Position m_homePosition;
+ Position m_transportHomePosition;
bool DisableReputationGain;
@@ -763,6 +768,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool IsInvisibleDueToDespawn() const;
bool CanAlwaysSee(WorldObject const* obj) const;
private:
+ void ForcedDespawn(uint32 timeMSToDespawn = 0);
+
//WaypointMovementGenerator vars
uint32 m_waypointID;
uint32 m_path_id;
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 54953ef5420..8823a788555 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -84,8 +84,7 @@ void FormationMgr::LoadCreatureFormations()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
return;
}
@@ -118,14 +117,14 @@ void FormationMgr::LoadCreatureFormations()
{
if (!sObjectMgr->GetCreatureData(group_member->leaderGUID))
{
- sLog->outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
+ sLog->outError(LOG_FILTER_SQL, "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
delete group_member;
continue;
}
if (!sObjectMgr->GetCreatureData(memberGUID))
{
- sLog->outErrorDb("creature_formations table member guid %u incorrect (not exist)", memberGUID);
+ sLog->outError(LOG_FILTER_SQL, "creature_formations table member guid %u incorrect (not exist)", memberGUID);
delete group_member;
continue;
}
@@ -136,8 +135,7 @@ void FormationMgr::LoadCreatureFormations()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void CreatureGroup::AddMember(Creature* member)
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index a39bd8eddf7..63e186ffc42 100755
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -47,10 +47,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me
for (GossipMenuItemContainer::const_iterator itr = _menuItems.begin(); itr != _menuItems.end(); ++itr)
{
if (int32(itr->first) > menuItemId)
- {
- menuItemId = menuItemId;
break;
- }
menuItemId = itr->first + 1;
}
@@ -180,7 +177,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const
PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId);
if (!poi)
{
- sLog->outErrorDb("Request to send non-existing POI (Id: %u), ignored.", poiId);
+ sLog->outError(LOG_FILTER_SQL, "Request to send non-existing POI (Id: %u), ignored.", poiId);
return;
}
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index 2af6b4c04fd..43b29c600d6 100755
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
@@ -159,7 +159,7 @@ void TempSummon::Update(uint32 diff)
}
default:
UnSummon();
- sLog->outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
+ sLog->outError(LOG_FILTER_UNITS, "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
break;
}
}
@@ -267,7 +267,7 @@ void TempSummon::RemoveFromWorld()
owner->m_SummonSlot[slot] = 0;
//if (GetOwnerGUID())
- // sLog->outError("Unit %u has owner guid when removed from world", GetEntry());
+ // sLog->outError(LOG_FILTER_UNITS, "Unit %u has owner guid when removed from world", GetEntry());
Creature::RemoveFromWorld();
}
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 829eb73bf80..537bbd9c099 100755
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -36,6 +36,7 @@ class TempSummon : public Creature
Unit* GetSummoner() const;
uint64 GetSummonerGUID() { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
+ uint32 GetTimer() { return m_timer; }
const SummonPropertiesEntry* const m_Properties;
private:
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index abeae0656ee..cd4a9443867 100755
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -85,14 +85,14 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
Relocate(pos);
if (!IsPositionValid())
{
- sLog->outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
+ sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetEntry(spellId);
- SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
+ SetObjectScale(1);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index d96c9052b7a..08518217e26 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -119,7 +119,7 @@ void GameObject::RemoveFromOwner()
else if (IS_PET_GUID(ownerGUID))
ownerType = "pet";
- sLog->outCrash("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
+ sLog->outFatal(LOG_FILTER_GENERAL, "Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);
SetOwnerGUID(0);
}
@@ -137,10 +137,9 @@ void GameObject::AddToWorld()
// The state can be changed after GameObject::Create but before GameObject::AddToWorld
bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false;
if (m_model)
- GetMap()->Insert(*m_model);
- if (startOpen ^ toggledState)
- EnableCollision(false);
+ GetMap()->InsertGameObjectModel(*m_model);
+ EnableCollision(startOpen ^ toggledState);
WorldObject::AddToWorld();
}
}
@@ -155,8 +154,8 @@ void GameObject::RemoveFromWorld()
RemoveFromOwner();
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
WorldObject::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
}
@@ -170,7 +169,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
Relocate(x, y, z, ang);
if (!IsPositionValid())
{
- sLog->outError("Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y);
+ sLog->outError(LOG_FILTER_GENERAL, "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y);
return false;
}
@@ -187,7 +186,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
if (!goinfo)
{
- sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z);
return false;
}
@@ -197,7 +196,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
{
- sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type);
return false;
}
@@ -206,7 +205,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
UpdateRotationFields(rotation2, rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3
- SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
+ SetObjectScale(goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
@@ -222,9 +221,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
SetGoType(GameobjectTypes(goinfo->type));
SetGoState(go_state);
-
- SetGoArtKit(0); // unknown what this is
- SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit);
+ SetGoArtKit(artKit);
switch (goinfo->type)
{
@@ -270,7 +267,7 @@ void GameObject::Update(uint32 diff)
if (!AI())
{
if (!AIM_Initialize())
- sLog->outError("Could not initialize GameObjectAI");
+ sLog->outError(LOG_FILTER_GENERAL, "Could not initialize GameObjectAI");
} else
AI()->UpdateAI(diff);
@@ -340,7 +337,7 @@ void GameObject::Update(uint32 diff)
if (m_respawnTime <= now) // timer expired
{
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
- time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(dbtableHighGuid, GetMap()->GetInstanceId());
+ time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
if (linkedRespawntime) // Can't respawn, the master is dead
{
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
@@ -649,7 +646,7 @@ void GameObject::SaveToDB()
GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid);
if (!data)
{
- sLog->outError("GameObject::SaveToDB failed, cannot get gameobject data!");
+ sLog->outError(LOG_FILTER_GENERAL, "GameObject::SaveToDB failed, cannot get gameobject data!");
return;
}
@@ -723,7 +720,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
if (!data)
{
- sLog->outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid);
return false;
}
@@ -763,13 +760,13 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
else
{
m_respawnDelayTime = data->spawntimesecs;
- m_respawnTime = sObjectMgr->GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
+ m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid);
// ready to respawn
if (m_respawnTime && m_respawnTime <= time(NULL))
{
m_respawnTime = 0;
- sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId());
+ GetMap()->RemoveGORespawnTime(m_DBTableGuid);
}
}
}
@@ -790,7 +787,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
void GameObject::DeleteFromDB()
{
- sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId());
+ GetMap()->RemoveGORespawnTime(m_DBTableGuid);
sObjectMgr->DeleteGOData(m_DBTableGuid);
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
@@ -857,6 +854,13 @@ bool GameObject::IsDynTransport() const
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
+bool GameObject::IsDestructibleBuilding() const
+{
+ GameObjectTemplate const* gInfo = GetGOInfo();
+ if (!gInfo) return false;
+ return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
+}
+
Unit* GameObject::GetOwner() const
{
return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
@@ -865,7 +869,7 @@ Unit* GameObject::GetOwner() const
void GameObject::SaveRespawnTime()
{
if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
- sObjectMgr->SaveGORespawnTime(m_DBTableGuid, GetInstanceId(), m_respawnTime);
+ GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime);
}
bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
@@ -873,7 +877,7 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
if (WorldObject::IsAlwaysVisibleFor(seer))
return true;
- if (IsTransport())
+ if (IsTransport() || IsDestructibleBuilding())
return true;
if (!seer)
@@ -910,7 +914,7 @@ void GameObject::Respawn()
if (m_spawnedByDefault && m_respawnTime > 0)
{
m_respawnTime = time(NULL);
- sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId());
+ GetMap()->RemoveGORespawnTime(m_DBTableGuid);
}
}
@@ -1304,7 +1308,7 @@ void GameObject::Use(Unit* user)
//provide error, no fishable zone or area should be 0
if (!zone_skill)
- sLog->outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone);
+ sLog->outError(LOG_FILTER_SQL, "Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone);
int32 skill = player->GetSkillValue(SKILL_FISHING);
@@ -1320,7 +1324,7 @@ void GameObject::Use(Unit* user)
int32 roll = irand(1, 100);
- sLog->outStaticDebug("Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll);
// but you will likely cause junk in areas that require a high fishing skill (not yet implemented)
if (chance >= roll)
@@ -1614,7 +1618,7 @@ void GameObject::Use(Unit* user)
}
default:
if (GetGoType() >= MAX_GAMEOBJECT_TYPE)
- sLog->outError("GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)",
+ sLog->outError(LOG_FILTER_GENERAL, "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)",
user->GetTypeId(), user->GetGUIDLow(), user->GetName(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType());
break;
}
@@ -1626,7 +1630,7 @@ void GameObject::Use(Unit* user)
if (!spellInfo)
{
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
- sLog->outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType());
+ sLog->outError(LOG_FILTER_GENERAL, "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType());
else
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
return;
@@ -1676,7 +1680,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
else
{
trigger->setFaction(14);
- // Set owner guid for target if no owner avalible - needed by trigger auras
+ // 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);
}
@@ -1713,7 +1717,13 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
void GameObject::EventInform(uint32 eventId)
{
- if (eventId && m_zoneScript)
+ if (!eventId)
+ return;
+
+ if (AI())
+ AI()->EventInform(eventId);
+
+ if (m_zoneScript)
m_zoneScript->ProcessEvent(this, eventId);
}
@@ -1825,6 +1835,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
m_goValue->Building.Health = m_goValue->Building.MaxHealth;
SetGoAnimProgress(255);
}
+ EnableCollision(true);
break;
case GO_DESTRUCTIBLE_DAMAGED:
{
@@ -1881,6 +1892,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
m_goValue->Building.Health = 0;
SetGoAnimProgress(0);
}
+ EnableCollision(false);
break;
}
case GO_DESTRUCTIBLE_REBUILDING:
@@ -1900,6 +1912,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
m_goValue->Building.Health = m_goValue->Building.MaxHealth;
SetGoAnimProgress(255);
}
+ EnableCollision(true);
break;
}
}
@@ -1909,13 +1922,14 @@ void GameObject::SetLootState(LootState state, Unit* unit)
{
m_lootState = state;
AI()->OnStateChanged(state, unit);
+ sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
if (m_model)
{
// startOpen determines whether we are going to add or remove the LoS on activation
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
// Use the current go state
- if (GetGoState() == GO_STATE_ACTIVE)
+ if (GetGoState() != GO_STATE_ACTIVE)
startOpen = !startOpen;
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
@@ -1928,6 +1942,7 @@ void GameObject::SetLootState(LootState state, Unit* unit)
void GameObject::SetGoState(GOState state)
{
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
+ sScriptMgr->OnGameObjectStateChanged(this, state);
if (m_model)
{
if (!IsInWorld())
@@ -1963,8 +1978,8 @@ void GameObject::EnableCollision(bool enable)
if (!m_model)
return;
- /*if (enable && !GetMap()->Contains(*m_model))
- GetMap()->Insert(*m_model);*/
+ /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->InsertGameObjectModel(*m_model);*/
m_model->enable(enable ? GetPhaseMask() : 0);
}
@@ -1974,12 +1989,12 @@ void GameObject::UpdateModel()
if (!IsInWorld())
return;
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
delete m_model;
m_model = GameObjectModel::Create(*this);
if (m_model)
- GetMap()->Insert(*m_model);
+ GetMap()->InsertGameObjectModel(*m_model);
}
Player* GameObject::GetLootRecipient() const
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index a8035043543..eb2fa8f1a0e 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -632,6 +632,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
bool IsTransport() const;
bool IsDynTransport() const;
+ bool IsDestructibleBuilding() const;
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index 4eede93bd37..db563c712cd 100755
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -41,7 +41,7 @@ Bag::~Bag()
{
if (item->IsInWorld())
{
- sLog->outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
+ sLog->outFatal(LOG_FILTER_PLAYER_ITEMS, "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i);
item->RemoveFromWorld();
@@ -78,7 +78,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
Object::_Create(guidlow, 0, HIGHGUID_CONTAINER);
SetEntry(itemid);
- SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ SetObjectScale(1.0f);
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index f2b893896dc..c032647d924 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -36,7 +36,7 @@ void AddItemsSetItem(Player* player, Item* item)
if (!set)
{
- sLog->outErrorDb("Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId);
+ sLog->outError(LOG_FILTER_SQL, "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId);
return;
}
@@ -96,7 +96,7 @@ void AddItemsSetItem(Player* player, Item* item)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
break;
}
@@ -117,7 +117,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
if (!set)
{
- sLog->outErrorDb("Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId);
+ sLog->outError(LOG_FILTER_SQL, "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId);
return;
}
@@ -258,7 +258,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
Object::_Create(guidlow, 0, HIGHGUID_ITEM);
SetEntry(itemid);
- SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ SetObjectScale(1.0f);
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
@@ -274,7 +274,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
SetSpellCharges(i, itemProto->Spells[i].SpellCharges);
- SetUInt32Value(ITEM_FIELD_DURATION, abs(itemProto->Duration));
+ SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration);
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
return true;
}
@@ -400,7 +400,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
// Set entry, MUST be before proto check
SetEntry(entry);
- SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ SetObjectScale(1.0f);
ItemTemplate const* proto = GetTemplate();
if (!proto)
@@ -420,7 +420,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
// update duration if need, and remove if not need
if ((proto->Duration == 0) != (duration == 0))
{
- SetUInt32Value(ITEM_FIELD_DURATION, abs(proto->Duration));
+ SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration);
need_save = true;
}
@@ -597,7 +597,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
// item can have not null only one from field values
if ((itemProto->RandomProperty) && (itemProto->RandomSuffix))
{
- sLog->outErrorDb("Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
+ sLog->outError(LOG_FILTER_SQL, "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
return 0;
}
@@ -608,7 +608,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
if (!random_id)
{
- sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
+ sLog->outError(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
return 0;
}
@@ -621,7 +621,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
if (!random_id)
{
- sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
+ sLog->outError(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
return 0;
}
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 1d5fcae7d28..a5f9ed5c008 100755
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -240,6 +240,7 @@ class Item : public Object
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); }
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
+ bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
bool IsNotEmptyBag() const;
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
bool CanBeTraded(bool mail = false, bool trade = false) const;
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index f3d7d7fd56c..f85bf80e145 100755
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -70,14 +70,10 @@ void LoadRandomEnchantmentsTable()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
- {
- sLog->outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
- sLog->outString();
- }
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
uint32 GetItemEnchantMod(int32 entry)
@@ -91,7 +87,7 @@ uint32 GetItemEnchantMod(int32 entry)
EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry);
if (tab == RandomItemEnch.end())
{
- sLog->outErrorDb("Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
return 0;
}
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index 2eae7234229..5088a30157c 100755
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
@@ -192,6 +192,13 @@ enum ItemFlagsExtra
ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED = 0x00000100
};
+enum ItemFlagsCustom
+{
+ ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline
+ ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops
+ ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004, // Item will always follow group/master/need before greed looting rules
+};
+
enum BAG_FAMILY_MASK
{
BAG_FAMILY_MASK_NONE = 0x00000000,
@@ -644,7 +651,7 @@ struct ItemTemplate
uint32 GemProperties; // id from GemProperties.dbc
uint32 RequiredDisenchantSkill;
float ArmorDamageModifier;
- int32 Duration; // negative = realtime, positive = ingame time
+ uint32 Duration;
uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc
uint32 HolidayId; // id from Holidays.dbc
uint32 ScriptId;
@@ -652,6 +659,7 @@ struct ItemTemplate
uint32 FoodType;
uint32 MinMoneyLoot;
uint32 MaxMoneyLoot;
+ uint32 FlagsCu;
// helpers
bool CanChangeEquipStateInCombat() const
@@ -674,6 +682,8 @@ struct ItemTemplate
return false;
}
+ bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
+
uint32 GetMaxStackSize() const
{
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 70b680c6ae0..2e4ad07f86d 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -41,12 +41,15 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "SpellAuraEffects.h"
-
+#include "UpdateFieldFlags.h"
#include "TemporarySummon.h"
#include "Totem.h"
#include "OutdoorPvPMgr.h"
#include "MovementPacketBuilder.h"
#include "DynamicTree.h"
+#include "Group.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
uint32 GuidHigh2TypeId(uint32 guid_hi)
{
@@ -74,6 +77,7 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1)
m_uint32Values = NULL;
_changedFields = NULL;
m_valuesCount = 0;
+ _fieldNotifyFlags = UF_FLAG_DYNAMIC;
m_inWorld = false;
m_objectUpdated = false;
@@ -88,7 +92,7 @@ WorldObject::~WorldObject()
{
if (GetTypeId() == TYPEID_CORPSE)
{
- sLog->outCrash("Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
ASSERT(false);
}
ResetMap();
@@ -99,16 +103,16 @@ Object::~Object()
{
if (IsInWorld())
{
- sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
if (isType(TYPEMASK_ITEM))
- sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Item slot %u", ((Item*)this)->GetSlot());
ASSERT(false);
RemoveFromWorld();
}
if (m_objectUpdated)
{
- sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
ASSERT(false);
sObjectAccessor->RemoveUpdateObject(this);
}
@@ -463,17 +467,13 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
IsActivateToQuest = true;
- updateMask->SetBit(GAMEOBJECT_DYNAMIC);
-
if (((GameObject*)this)->GetGoArtKit())
updateMask->SetBit(GAMEOBJECT_BYTES_1);
}
else if (isType(TYPEMASK_UNIT))
{
if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
- {
updateMask->SetBit(UNIT_FIELD_AURASTATE);
- }
}
}
else // case UPDATETYPE_VALUES
@@ -481,10 +481,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
{
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
- {
IsActivateToQuest = true;
- }
- updateMask->SetBit(GAMEOBJECT_DYNAMIC);
+
updateMask->SetBit(GAMEOBJECT_BYTES_1);
if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST && ToGameObject()->GetGOInfo()->chest.groupLootRules &&
@@ -494,9 +492,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
else if (isType(TYPEMASK_UNIT))
{
if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
- {
updateMask->SetBit(UNIT_FIELD_AURASTATE);
- }
}
}
@@ -627,6 +623,11 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
}
+ // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
+ if (Unit const* unit = ToUnit())
+ if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
+ if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID()))
+ dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
*data << dynamicFlags;
}
// FG: pretend that OTHER players in own group are friendly ("blue")
@@ -783,26 +784,98 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou
}
}
-void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const
+void Object::GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const
+{
+ // This function assumes updatefield index is always valid
+ switch (GetTypeId())
+ {
+ case TYPEID_ITEM:
+ case TYPEID_CONTAINER:
+ flags = ItemUpdateFieldFlags;
+ isOwner = isItemOwner = ((Item*)this)->GetOwnerGUID() == target->GetGUID();
+ break;
+ case TYPEID_UNIT:
+ case TYPEID_PLAYER:
+ {
+ Player* plr = ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself();
+ flags = UnitUpdateFieldFlags;
+ isOwner = ToUnit()->GetOwnerGUID() == target->GetGUID();
+ hasSpecialInfo = ToUnit()->HasAuraTypeWithCaster(SPELL_AURA_EMPATHY, target->GetGUID());
+ isPartyMember = plr && plr->IsInSameGroupWith(target);
+ break;
+ }
+ case TYPEID_GAMEOBJECT:
+ flags = GameObjectUpdateFieldFlags;
+ isOwner = ToGameObject()->GetOwnerGUID() == target->GetGUID();
+ break;
+ case TYPEID_DYNAMICOBJECT:
+ flags = DynamicObjectUpdateFieldFlags;
+ isOwner = ((DynamicObject*)this)->GetCasterGUID() == target->GetGUID();
+ break;
+ case TYPEID_CORPSE:
+ flags = CorpseUpdateFieldFlags;
+ isOwner = ToCorpse()->GetOwnerGUID() == target->GetGUID();
+ break;
+ case TYPEID_OBJECT:
+ break;
+ }
+}
+
+bool Object::IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const
+{
+ if (flags == UF_FLAG_NONE)
+ return false;
+
+ if (flags & UF_FLAG_PUBLIC)
+ return true;
+
+ if (flags & UF_FLAG_PRIVATE && isSelf)
+ return true;
+
+ if (flags & UF_FLAG_OWNER && isOwner)
+ return true;
+
+ if (flags & UF_FLAG_ITEM_OWNER && isItemOwner)
+ return true;
+
+ if (flags & UF_FLAG_PARTY_MEMBER && isPartyMember)
+ return true;
+
+ return false;
+}
+
+void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
{
bool* indexes = _changedFields;
+ uint32* flags = NULL;
+ bool isSelf = target == this;
+ bool isOwner = false;
+ bool isItemOwner = false;
+ bool hasSpecialInfo = false;
+ bool isPartyMember = false;
+
+ GetUpdateFieldData(target, flags, isOwner, isItemOwner, hasSpecialInfo, isPartyMember);
for (uint16 index = 0; index < m_valuesCount; ++index, ++indexes)
- {
- if (*indexes)
+ if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*indexes && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember)))
updateMask->SetBit(index);
- }
}
-void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const
+void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const
{
uint32* value = m_uint32Values;
+ uint32* flags = NULL;
+ bool isSelf = target == this;
+ bool isOwner = false;
+ bool isItemOwner = false;
+ bool hasSpecialInfo = false;
+ bool isPartyMember = false;
+
+ GetUpdateFieldData(target, flags, isOwner, isItemOwner, hasSpecialInfo, isPartyMember);
for (uint16 index = 0; index < m_valuesCount; ++index, ++value)
- {
- if (*value)
+ if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*value && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember)))
updateMask->SetBit(index);
- }
}
void Object::SetInt32Value(uint16 index, int32 value)
@@ -932,7 +1005,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
if (offset > 4)
{
- sLog->outError("Object::SetByteValue: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::SetByteValue: wrong offset %u", offset);
return;
}
@@ -956,7 +1029,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
if (offset > 2)
{
- sLog->outError("Object::SetUInt16Value: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::SetUInt16Value: wrong offset %u", offset);
return;
}
@@ -1068,7 +1141,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
if (offset > 4)
{
- sLog->outError("Object::SetByteFlag: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::SetByteFlag: wrong offset %u", offset);
return;
}
@@ -1091,7 +1164,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
if (offset > 4)
{
- sLog->outError("Object::RemoveByteFlag: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::RemoveByteFlag: wrong offset %u", offset);
return;
}
@@ -1110,7 +1183,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
bool Object::PrintIndexError(uint32 index, bool set) const
{
- sLog->outError("Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType);
+ sLog->outError(LOG_FILTER_GENERAL, "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType);
// ASSERT must fail after function call
return false;
@@ -1165,32 +1238,32 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
void MovementInfo::OutDebug()
{
- sLog->outString("MOVEMENT INFO");
- sLog->outString("guid " UI64FMTD, guid);
- sLog->outString("flags %u", flags);
- sLog->outString("flags2 %u", flags2);
- sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
- sLog->outString("position: `%s`", pos.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_GENERAL, "MOVEMENT INFO");
+ sLog->outInfo(LOG_FILTER_GENERAL, "guid " UI64FMTD, guid);
+ sLog->outInfo(LOG_FILTER_GENERAL, "flags %u", flags);
+ sLog->outInfo(LOG_FILTER_GENERAL, "flags2 %u", flags2);
+ sLog->outInfo(LOG_FILTER_GENERAL, "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
+ sLog->outInfo(LOG_FILTER_GENERAL, "position: `%s`", pos.ToString().c_str());
if (flags & MOVEMENTFLAG_ONTRANSPORT)
{
- sLog->outString("TRANSPORT:");
- sLog->outString("guid: " UI64FMTD, t_guid);
- sLog->outString("position: `%s`", t_pos.ToString().c_str());
- sLog->outString("seat: %i", t_seat);
- sLog->outString("time: %u", t_time);
+ sLog->outInfo(LOG_FILTER_GENERAL, "TRANSPORT:");
+ sLog->outInfo(LOG_FILTER_GENERAL, "guid: " UI64FMTD, t_guid);
+ sLog->outInfo(LOG_FILTER_GENERAL, "position: `%s`", t_pos.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_GENERAL, "seat: %i", t_seat);
+ sLog->outInfo(LOG_FILTER_GENERAL, "time: %u", t_time);
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
- sLog->outString("time2: %u", t_time2);
+ sLog->outInfo(LOG_FILTER_GENERAL, "time2: %u", t_time2);
}
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
- sLog->outString("pitch: %f", pitch);
+ sLog->outInfo(LOG_FILTER_GENERAL, "pitch: %f", pitch);
- sLog->outString("fallTime: %u", fallTime);
+ sLog->outInfo(LOG_FILTER_GENERAL, "fallTime: %u", fallTime);
if (flags & MOVEMENTFLAG_FALLING)
- sLog->outString("j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed);
+ sLog->outInfo(LOG_FILTER_GENERAL, "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed);
if (flags & MOVEMENTFLAG_SPLINE_ELEVATION)
- sLog->outString("splineElevation: %f", splineElevation);
+ sLog->outInfo(LOG_FILTER_GENERAL, "splineElevation: %f", splineElevation);
}
WorldObject::WorldObject(bool isWorldObject): WorldLocation(),
@@ -2110,7 +2183,7 @@ void WorldObject::SetMap(Map* map)
return;
if (m_currMap)
{
- sLog->outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
+ sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
ASSERT(false);
}
m_currMap = map;
@@ -2145,7 +2218,7 @@ void WorldObject::AddObjectToRemoveList()
Map* map = FindMap();
if (!map)
{
- sLog->outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId());
+ sLog->outError(LOG_FILTER_GENERAL, "Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId());
return;
}
@@ -2258,7 +2331,17 @@ void WorldObject::SetZoneScript()
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
else if (!map->IsBattlegroundOrArena())
- m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ }
+ }
}
}
@@ -2311,7 +2394,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->Relocate(x, y, z, ang);
if (!pet->IsPositionValid())
{
- sLog->outError("Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
+ sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
delete pet;
return NULL;
}
@@ -2320,7 +2403,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
uint32 pet_number = sObjectMgr->GeneratePetNumber();
if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
{
- sLog->outError("no such creature entry %u", entry);
+ sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry);
delete pet;
return NULL;
}
@@ -2397,7 +2480,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
- sLog->outErrorDb("Gameobject template %u not found in database!", entry);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject template %u not found in database!", entry);
return NULL;
}
Map* map = GetMap();
@@ -2699,7 +2782,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
{
- sLog->outCrash("WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty);
+ sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty);
return;
}
@@ -2745,7 +2828,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
{
- sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty);
+ sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty);
return;
}
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 39be4d4f529..ab9ea2daea9 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -34,11 +34,11 @@
#define CONTACT_DISTANCE 0.5f
#define INTERACTION_DISTANCE 5.0f
#define ATTACK_DISTANCE 5.0f
-#define MAX_VISIBILITY_DISTANCE 500.0f // max distance for visible objects
+#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible objects
#define SIGHT_RANGE_UNIT 50.0f
-#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents
-#define DEFAULT_VISIBILITY_INSTANCE 120.0f // default visible distance in instances, 120 yards
-#define DEFAULT_VISIBILITY_BGARENAS 180.0f // default visible distance in BG/Arenas, 180 yards
+#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents
+#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
+#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards
#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
#define DEFAULT_COMBAT_REACH 1.5f
@@ -137,6 +137,8 @@ class Object
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
+ void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); }
+
TypeID GetTypeId() const { return m_objectTypeId; }
bool isType(uint16 mask) const { return (mask & m_objectType); }
@@ -298,6 +300,9 @@ class Object
virtual void BuildUpdate(UpdateDataMapType&) {}
void BuildFieldsUpdate(Player*, UpdateDataMapType &) const;
+ void SetFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags |= flag; }
+ void RemoveFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags &= ~flag; }
+
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
@@ -318,13 +323,16 @@ class Object
Object();
void _InitValues();
- void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
+ void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
void _LoadIntoDataField(const char* data, uint32 startOffset, uint32 count);
- virtual void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
+ void GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const;
- virtual void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
+ bool IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const;
+
+ void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
+ void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
void _BuildMovementUpdate(ByteBuffer * data, uint16 flags) const;
void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask* updateMask, Player* target) const;
@@ -344,6 +352,8 @@ class Object
uint16 m_valuesCount;
+ uint16 _fieldNotifyFlags;
+
bool m_objectUpdated;
private:
@@ -498,13 +508,13 @@ struct MovementInfo
t_seat = -1;
}
- uint32 GetMovementFlags() { return flags; }
+ uint32 GetMovementFlags() const { return flags; }
void SetMovementFlags(uint32 flag) { flags = flag; }
void AddMovementFlag(uint32 flag) { flags |= flag; }
void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
- uint16 GetExtraMovementFlags() { return flags2; }
+ uint16 GetExtraMovementFlags() const { return flags2; }
void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; }
bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; }
@@ -685,7 +695,7 @@ class WorldObject : public Object, public WorldLocation
bool IsInMap(const WorldObject* obj) const
{
if (obj)
- return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj);
+ return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap());
return false;
}
bool IsWithinDist3d(float x, float y, float z, float dist) const
@@ -703,7 +713,7 @@ class WorldObject : public Object, public WorldLocation
}
bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const
{
- return obj && IsInMap(obj) && _IsWithinDist(obj, dist2compare, is3D);
+ return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
}
bool IsWithinLOS(float x, float y, float z) const;
bool IsWithinLOSInMap(const WorldObject* obj) const;
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp
index 8f480ab3235..45464f19083 100755
--- a/src/server/game/Entities/Object/Updates/UpdateData.cpp
+++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp
@@ -57,7 +57,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
int z_res = deflateInit(&c_stream, sWorld->getIntConfig(CONFIG_COMPRESSION));
if (z_res != Z_OK)
{
- sLog->outError("Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
@@ -70,14 +70,14 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
z_res = deflate(&c_stream, Z_NO_FLUSH);
if (z_res != Z_OK)
{
- sLog->outError("Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
if (c_stream.avail_in != 0)
{
- sLog->outError("Can't compress update packet (zlib: deflate not greedy)");
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate not greedy)");
*dst_size = 0;
return;
}
@@ -85,7 +85,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
z_res = deflate(&c_stream, Z_FINISH);
if (z_res != Z_STREAM_END)
{
- sLog->outError("Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
@@ -93,7 +93,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
z_res = deflateEnd(&c_stream);
if (z_res != Z_OK)
{
- sLog->outError("Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp
new file mode 100644
index 00000000000..95bdaef221b
--- /dev/null
+++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp
@@ -0,0 +1,1568 @@
+/*
+ * Copyright (C) 2008-2012 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 "UpdateFieldFlags.h"
+
+uint32 ItemUpdateFieldFlags[CONTAINER_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER
+ UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CONTAINED
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CONTAINED+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_GIFTCREATOR
+ UF_FLAG_PUBLIC, // ITEM_FIELD_GIFTCREATOR+1
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_STACK_COUNT
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_DURATION
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+1
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+2
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+3
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+4
+ UF_FLAG_PUBLIC, // ITEM_FIELD_FLAGS
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_PROPERTY_SEED
+ UF_FLAG_PUBLIC, // ITEM_FIELD_RANDOM_PROPERTIES_ID
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_DURABILITY
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_MAXDURABILITY
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CREATE_PLAYED_TIME
+ UF_FLAG_NONE, // ITEM_FIELD_PAD
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_NUM_SLOTS
+ UF_FLAG_NONE, // CONTAINER_ALIGN_PAD
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+1
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+2
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+3
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+4
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+5
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+6
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+7
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+8
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+9
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+10
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+11
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+12
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+13
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+14
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+15
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+16
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+17
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+18
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+19
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+20
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+21
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+22
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+23
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+24
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+25
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+26
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+27
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+28
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+29
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+30
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+31
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+32
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+33
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+34
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+35
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+36
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+37
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+38
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+39
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+40
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+41
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+42
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+43
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+44
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+45
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+46
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+47
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+48
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+49
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+50
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+51
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+52
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+53
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+54
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+55
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+56
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+57
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+58
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+59
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+60
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+61
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+62
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+63
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+64
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+65
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+66
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+67
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+68
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+69
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+70
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+71
+};
+
+uint32 UnitUpdateFieldFlags[PLAYER_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON+1
+ UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER
+ UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARMEDBY
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARMEDBY+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMONEDBY
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMONEDBY+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CREATEDBY
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CREATEDBY+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET
+ UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHANNEL_OBJECT
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHANNEL_OBJECT+1
+ UF_FLAG_PUBLIC, // UNIT_CHANNEL_SPELL
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_0
+ UF_FLAG_PUBLIC, // UNIT_FIELD_HEALTH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER3
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER4
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER5
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER7
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXHEALTH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER3
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER4
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER5
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER7
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_LEVEL
+ UF_FLAG_PUBLIC, // UNIT_FIELD_FACTIONTEMPLATE
+ UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID
+ UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID+1
+ UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID+2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS
+ UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS_2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_AURASTATE
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BASEATTACKTIME
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BASEATTACKTIME+1
+ UF_FLAG_PRIVATE, // UNIT_FIELD_RANGEDATTACKTIME
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BOUNDINGRADIUS
+ UF_FLAG_PUBLIC, // UNIT_FIELD_COMBATREACH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_DISPLAYID
+ UF_FLAG_PUBLIC, // UNIT_FIELD_NATIVEDISPLAYID
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MOUNTDISPLAYID
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MINDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MAXDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MINOFFHANDDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MAXOFFHANDDAMAGE
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_PETNUMBER
+ UF_FLAG_PUBLIC, // UNIT_FIELD_PET_NAME_TIMESTAMP
+ UF_FLAG_OWNER, // UNIT_FIELD_PETEXPERIENCE
+ UF_FLAG_OWNER, // UNIT_FIELD_PETNEXTLEVELEXP
+ UF_FLAG_DYNAMIC, // UNIT_DYNAMIC_FLAGS
+ UF_FLAG_PUBLIC, // UNIT_MOD_CAST_SPEED
+ UF_FLAG_PUBLIC, // UNIT_CREATED_BY_SPELL
+ UF_FLAG_DYNAMIC, // UNIT_NPC_FLAGS
+ UF_FLAG_PUBLIC, // UNIT_NPC_EMOTESTATE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT0
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT0
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT0
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BASE_MANA
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_BASE_HEALTH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER_MODS
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER_MULTIPLIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER_MODS
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MINRANGEDDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MAXRANGEDDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MAXHEALTHMODIFIER
+ UF_FLAG_PUBLIC, // UNIT_FIELD_HOVERHEIGHT
+ UF_FLAG_NONE, // UNIT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // PLAYER_DUEL_ARBITER
+ UF_FLAG_PUBLIC, // PLAYER_DUEL_ARBITER+1
+ UF_FLAG_PUBLIC, // PLAYER_FLAGS
+ UF_FLAG_PUBLIC, // PLAYER_GUILDID
+ UF_FLAG_PUBLIC, // PLAYER_GUILDRANK
+ UF_FLAG_PUBLIC, // PLAYER_BYTES
+ UF_FLAG_PUBLIC, // PLAYER_BYTES_2
+ UF_FLAG_PUBLIC, // PLAYER_BYTES_3
+ UF_FLAG_PUBLIC, // PLAYER_DUEL_TEAM
+ UF_FLAG_PUBLIC, // PLAYER_GUILD_TIMESTAMP
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_1_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_4
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_2_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_3_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_4_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_5_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_6_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_7_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_8_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_9_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_10_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_11_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_12_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_13_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_14_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_15_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_16_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_17_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_18_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_19_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_20_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_21_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_22_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_23_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_24_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_25_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_5
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_1_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_1_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_2_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_2_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_3_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_3_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_4_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_4_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_5_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_5_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_6_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_6_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_7_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_7_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_8_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_8_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_9_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_9_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_10_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_10_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_11_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_11_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_12_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_12_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_13_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_13_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_14_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_14_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_15_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_15_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_16_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_16_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_17_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_17_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_18_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_18_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_19_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_19_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_CHOSEN_TITLE
+ UF_FLAG_PUBLIC, // PLAYER_FAKE_INEBRIATION
+ UF_FLAG_NONE, // PLAYER_FIELD_PAD_0
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+46
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+47
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+48
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+49
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+50
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+51
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+52
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+53
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+54
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+55
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+46
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+47
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+48
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+49
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+50
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+51
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+52
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+53
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+54
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+55
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+56
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+57
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+58
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+59
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+60
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+61
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+62
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+63
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+46
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+47
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+48
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+49
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+50
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+51
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+52
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+53
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+54
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+55
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+56
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+57
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+58
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+59
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+60
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+61
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+62
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+63
+ UF_FLAG_PRIVATE, // PLAYER_FARSIGHT
+ UF_FLAG_PRIVATE, // PLAYER_FARSIGHT+1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES+1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES1+1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES2
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES2+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KNOWN_CURRENCIES
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KNOWN_CURRENCIES+1
+ UF_FLAG_PRIVATE, // PLAYER_XP
+ UF_FLAG_PRIVATE, // PLAYER_NEXT_LEVEL_XP
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+1
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+2
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+3
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+4
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+5
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+6
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+7
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+8
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+9
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+10
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+11
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+12
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+13
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+14
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+15
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+16
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+17
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+18
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+19
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+20
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+21
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+22
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+23
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+24
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+25
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+26
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+27
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+28
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+29
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+30
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+31
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+32
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+33
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+34
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+35
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+36
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+37
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+38
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+39
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+40
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+41
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+42
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+43
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+44
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+45
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+46
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+47
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+48
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+49
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+50
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+51
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+52
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+53
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+54
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+55
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+56
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+57
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+58
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+59
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+60
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+61
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+62
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+63
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+64
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+65
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+66
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+67
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+68
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+69
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+70
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+71
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+72
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+73
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+74
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+75
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+76
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+77
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+78
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+79
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+80
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+81
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+82
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+83
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+84
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+85
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+86
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+87
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+88
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+89
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+90
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+91
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+92
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+93
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+94
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+95
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+96
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+97
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+98
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+99
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+100
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+101
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+102
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+103
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+104
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+105
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+106
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+107
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+108
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+109
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+110
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+111
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+112
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+113
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+114
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+115
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+116
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+117
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+118
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+119
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+120
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+121
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+122
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+123
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+124
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+125
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+126
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+127
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+128
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+129
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+130
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+131
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+132
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+133
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+134
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+135
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+136
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+137
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+138
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+139
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+140
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+141
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+142
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+143
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+144
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+145
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+146
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+147
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+148
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+149
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+150
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+151
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+152
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+153
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+154
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+155
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+156
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+157
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+158
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+159
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+160
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+161
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+162
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+163
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+164
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+165
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+166
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+167
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+168
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+169
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+170
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+171
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+172
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+173
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+174
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+175
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+176
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+177
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+178
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+179
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+180
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+181
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+182
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+183
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+184
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+185
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+186
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+187
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+188
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+189
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+190
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+191
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+192
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+193
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+194
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+195
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+196
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+197
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+198
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+199
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+200
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+201
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+202
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+203
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+204
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+205
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+206
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+207
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+208
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+209
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+210
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+211
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+212
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+213
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+214
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+215
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+216
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+217
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+218
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+219
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+220
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+221
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+222
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+223
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+224
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+225
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+226
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+227
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+228
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+229
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+230
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+231
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+232
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+233
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+234
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+235
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+236
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+237
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+238
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+239
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+240
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+241
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+242
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+243
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+244
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+245
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+246
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+247
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+248
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+249
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+250
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+251
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+252
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+253
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+254
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+255
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+256
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+257
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+258
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+259
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+260
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+261
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+262
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+263
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+264
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+265
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+266
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+267
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+268
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+269
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+270
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+271
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+272
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+273
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+274
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+275
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+276
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+277
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+278
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+279
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+280
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+281
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+282
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+283
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+284
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+285
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+286
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+287
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+288
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+289
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+290
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+291
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+292
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+293
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+294
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+295
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+296
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+297
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+298
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+299
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+300
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+301
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+302
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+303
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+304
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+305
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+306
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+307
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+308
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+309
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+310
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+311
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+312
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+313
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+314
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+315
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+316
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+317
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+318
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+319
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+320
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+321
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+322
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+323
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+324
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+325
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+326
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+327
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+328
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+329
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+330
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+331
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+332
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+333
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+334
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+335
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+336
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+337
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+338
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+339
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+340
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+341
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+342
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+343
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+344
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+345
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+346
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+347
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+348
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+349
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+350
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+351
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+352
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+353
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+354
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+355
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+356
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+357
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+358
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+359
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+360
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+361
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+362
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+363
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+364
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+365
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+366
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+367
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+368
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+369
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+370
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+371
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+372
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+373
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+374
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+375
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+376
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+377
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+378
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+379
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+380
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+381
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+382
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+383
+ UF_FLAG_PRIVATE, // PLAYER_CHARACTER_POINTS1
+ UF_FLAG_PRIVATE, // PLAYER_CHARACTER_POINTS2
+ UF_FLAG_PRIVATE, // PLAYER_TRACK_CREATURES
+ UF_FLAG_PRIVATE, // PLAYER_TRACK_RESOURCES
+ UF_FLAG_PRIVATE, // PLAYER_BLOCK_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_DODGE_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_PARRY_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_EXPERTISE
+ UF_FLAG_PRIVATE, // PLAYER_OFFHAND_EXPERTISE
+ UF_FLAG_PRIVATE, // PLAYER_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_RANGED_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_OFFHAND_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+1
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+2
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+3
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+4
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+5
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+6
+ UF_FLAG_PRIVATE, // PLAYER_SHIELD_BLOCK
+ UF_FLAG_PRIVATE, // PLAYER_SHIELD_BLOCK_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+1
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+2
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+3
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+4
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+5
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+6
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+7
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+8
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+9
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+10
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+11
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+12
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+13
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+14
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+15
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+16
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+17
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+18
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+19
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+20
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+21
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+22
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+23
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+24
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+25
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+26
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+27
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+28
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+29
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+30
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+31
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+32
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+33
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+34
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+35
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+36
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+37
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+38
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+39
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+40
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+41
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+42
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+43
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+44
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+45
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+46
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+47
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+48
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+49
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+50
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+51
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+52
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+53
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+54
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+55
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+56
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+57
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+58
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+59
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+60
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+61
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+62
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+63
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+64
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+65
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+66
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+67
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+68
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+69
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+70
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+71
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+72
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+73
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+74
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+75
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+76
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+77
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+78
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+79
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+80
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+81
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+82
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+83
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+84
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+85
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+86
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+87
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+88
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+89
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+90
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+91
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+92
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+93
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+94
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+95
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+96
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+97
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+98
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+99
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+100
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+101
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+102
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+103
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+104
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+105
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+106
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+107
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+108
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+109
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+110
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+111
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+112
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+113
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+114
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+115
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+116
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+117
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+118
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+119
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+120
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+121
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+122
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+123
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+124
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+125
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+126
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+127
+ UF_FLAG_PRIVATE, // PLAYER_REST_STATE_EXPERIENCE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COINAGE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_DONE_POS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_PCT
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_DONE_PCT
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_TARGET_RESISTANCE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BYTES
+ UF_FLAG_PRIVATE, // PLAYER_AMMO_ID
+ UF_FLAG_PRIVATE, // PLAYER_SELF_RES_SPELL
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PVP_MEDALS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KILLS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_TODAY_CONTRIBUTION
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_YESTERDAY_CONTRIBUTION
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_LIFETIME_HONORBALE_KILLS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BYTES2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_WATCHED_FACTION_INDEX
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_HONOR_CURRENCY
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_CURRENCY
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MAX_LEVEL
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+24
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+1
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+2
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+3
+ UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1
+ UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1+1
+ UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+5
+ UF_FLAG_PRIVATE, // PLAYER_GLYPHS_ENABLED
+ UF_FLAG_PRIVATE, // PLAYER_PET_SPELL_POWER
+};
+
+uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_CREATED_BY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_CREATED_BY+1
+ UF_FLAG_PUBLIC, // GAMEOBJECT_DISPLAYID
+ UF_FLAG_PUBLIC, // GAMEOBJECT_FLAGS
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+1
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+2
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+3
+ UF_FLAG_DYNAMIC, // GAMEOBJECT_DYNAMIC
+ UF_FLAG_PUBLIC, // GAMEOBJECT_FACTION
+ UF_FLAG_PUBLIC, // GAMEOBJECT_LEVEL
+ UF_FLAG_PUBLIC, // GAMEOBJECT_BYTES_1
+};
+
+uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTER
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTER+1
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_BYTES
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_SPELLID
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_RADIUS
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTTIME
+};
+
+uint32 CorpseUpdateFieldFlags[CORPSE_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER+1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_PARTY
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_PARTY+1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_DISPLAY_ID
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+2
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+3
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+4
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+5
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+6
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+7
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+8
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+9
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+10
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+11
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+12
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+13
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+14
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+15
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+16
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+17
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+18
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_BYTES_1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_BYTES_2
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_GUILD
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_FLAGS
+ UF_FLAG_DYNAMIC, // CORPSE_FIELD_DYNAMIC_FLAGS
+ UF_FLAG_NONE, // CORPSE_FIELD_PAD
+};
diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
new file mode 100644
index 00000000000..71b3f0cd4aa
--- /dev/null
+++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _UPDATEFIELDFLAGS_H
+#define _UPDATEFIELDFLAGS_H
+
+#include "UpdateFields.h"
+#include "Define.h"
+
+enum UpdatefieldFlags
+{
+ UF_FLAG_NONE = 0x000,
+ UF_FLAG_PUBLIC = 0x001,
+ UF_FLAG_PRIVATE = 0x002,
+ UF_FLAG_OWNER = 0x004,
+ UF_FLAG_UNUSED1 = 0x008,
+ UF_FLAG_ITEM_OWNER = 0x010,
+ UF_FLAG_SPECIAL_INFO = 0x020,
+ UF_FLAG_PARTY_MEMBER = 0x040,
+ UF_FLAG_UNUSED2 = 0x080,
+ UF_FLAG_DYNAMIC = 0x100,
+};
+
+extern uint32 ItemUpdateFieldFlags[CONTAINER_END];
+extern uint32 UnitUpdateFieldFlags[PLAYER_END];
+extern uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END];
+extern uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END];
+extern uint32 CorpseUpdateFieldFlags[CORPSE_END];
+
+#endif // _UPDATEFIELDFLAGS_H
diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h
index d4ecd42819c..ad70936b81d 100755
--- a/src/server/game/Entities/Object/Updates/UpdateMask.h
+++ b/src/server/game/Entities/Object/Updates/UpdateMask.h
@@ -26,26 +26,26 @@ class UpdateMask
{
public:
UpdateMask() : mCount(0), mBlocks(0), mUpdateMask(0) { }
- UpdateMask(const UpdateMask& mask) : mUpdateMask(0) { *this = mask; }
+ UpdateMask(UpdateMask const& mask) : mUpdateMask(0) { *this = mask; }
~UpdateMask()
{
- delete [] mUpdateMask;
+ delete[] mUpdateMask;
}
- void SetBit (uint32 index)
+ void SetBit(uint32 index)
{
- ((uint8 *)mUpdateMask)[ index >> 3 ] |= 1 << (index & 0x7);
+ ((uint8*)mUpdateMask)[index >> 3] |= 1 << (index & 0x7);
}
- void UnsetBit (uint32 index)
+ void UnsetBit(uint32 index)
{
- ((uint8 *)mUpdateMask)[ index >> 3 ] &= (0xff ^ (1 << (index & 0x7)));
+ ((uint8*)mUpdateMask)[index >> 3] &= (0xff ^ (1 << (index & 0x7)));
}
- bool GetBit (uint32 index) const
+ bool GetBit(uint32 index) const
{
- return (((uint8 *)mUpdateMask)[ index >> 3 ] & (1 << (index & 0x7))) != 0;
+ return (((uint8*)mUpdateMask)[index >> 3] & (1 << (index & 0x7))) != 0;
}
uint32 GetBlockCount() const { return mBlocks; }
@@ -70,7 +70,7 @@ class UpdateMask
memset(mUpdateMask, 0, mBlocks << 2);
}
- UpdateMask& operator = (const UpdateMask& mask)
+ UpdateMask& operator=(UpdateMask const& mask)
{
if (this == &mask)
return *this;
@@ -81,21 +81,21 @@ class UpdateMask
return *this;
}
- void operator &= (const UpdateMask& mask)
+ void operator&=(UpdateMask const& mask)
{
ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i)
mUpdateMask[i] &= mask.mUpdateMask[i];
}
- void operator |= (const UpdateMask& mask)
+ void operator|=(UpdateMask const& mask)
{
ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i)
mUpdateMask[i] |= mask.mUpdateMask[i];
}
- UpdateMask operator & (const UpdateMask& mask) const
+ UpdateMask operator&(UpdateMask const& mask) const
{
ASSERT(mask.mCount <= mCount);
@@ -106,7 +106,7 @@ class UpdateMask
return newmask;
}
- UpdateMask operator | (const UpdateMask& mask) const
+ UpdateMask operator|(UpdateMask const& mask) const
{
ASSERT(mask.mCount <= mCount);
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index fcb89e33dc1..17b214857db 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -183,7 +183,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
if (!IsPositionValid())
{
- sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
return false;
}
@@ -229,7 +229,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
break;
default:
if (!IsPetGhoul())
- sLog->outError("Pet have incorrect type (%u) for pet loading.", getPetType());
+ sLog->outError(LOG_FILTER_PETS, "Pet have incorrect type (%u) for pet loading.", getPetType());
break;
}
@@ -562,7 +562,7 @@ void Pet::Update(uint32 diff)
{
if (owner->GetPetGUID() != GetGUID())
{
- sLog->outError("Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName());
+ sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName());
Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
return;
}
@@ -760,7 +760,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
if (!IsPositionValid())
{
- sLog->outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
return false;
}
@@ -768,7 +768,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
CreatureTemplate const* cinfo = GetCreatureTemplate();
if (!cinfo)
{
- sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
+ sLog->outError(LOG_FILTER_PETS, "CreateBaseAtCreature() failed, creatureInfo is missing!");
return false;
}
@@ -843,7 +843,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
m_unitTypeMask |= UNIT_MASK_HUNTER_PET;
}
else
- sLog->outError("Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass());
+ sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass());
}
uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry;
@@ -870,7 +870,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
else
scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
- SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
+ SetObjectScale(scale);
}
// Resistance
@@ -940,14 +940,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
{
case 510: // mage Water Elemental
{
- SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f));
+ SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f));
break;
}
case 1964: //force of nature
{
if (!pInfo)
SetCreateHealth(30 + 30*petlevel);
- float bonusDmg = m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_NATURE) * 0.15f;
+ float bonusDmg = m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f;
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - (petlevel / 2) + bonusDmg));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + (petlevel / 2) + bonusDmg));
break;
@@ -967,7 +967,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetCreateHealth(40*petlevel);
SetCreateMana(28 + 10*petlevel);
}
- SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) * 0.5f));
+ SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f));
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel));
break;
@@ -979,7 +979,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetCreateMana(28 + 10*petlevel);
SetCreateHealth(28 + 30*petlevel);
}
- int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW)* 0.3f));
+ int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f));
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel) + bonus_dmg));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel) + bonus_dmg));
@@ -1020,7 +1020,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
}
case 31216: // Mirror Image
{
- SetBonusDamage(int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FROST) * 0.33f));
+ SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f));
SetDisplayId(m_owner->GetDisplayId());
if (!pInfo)
{
@@ -1041,6 +1041,13 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)));
break;
}
+ case 28017: // Bloodworms
+ {
+ SetCreateHealth(4 * petlevel);
+ SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f));
+ SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4)));
+ SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4)));
+ }
}
break;
}
@@ -1113,7 +1120,7 @@ void Pet::_LoadSpellCooldowns()
if (!sSpellMgr->GetSpellInfo(spell_id))
{
- sLog->outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id);
+ sLog->outError(LOG_FILTER_PETS, "Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id);
continue;
}
@@ -1264,7 +1271,7 @@ void Pet::_LoadAuras(uint32 timediff)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
- sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
+ sLog->outError(LOG_FILTER_PETS, "Unknown aura (spellid %u), ignore.", spellid);
continue;
}
@@ -1295,7 +1302,7 @@ void Pet::_LoadAuras(uint32 timediff)
}
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
- sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
+ sLog->outInfo(LOG_FILTER_PETS, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -1371,7 +1378,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
// do pet spell book cleanup
if (state == PETSPELL_UNCHANGED) // spell load case
{
- sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId);
+ sLog->outError(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL);
@@ -1380,7 +1387,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 1b1a6c0f62d..3475817816d 100755
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -164,6 +164,7 @@ class Pet : public Guardian
bool HaveInDiet(ItemTemplate const* item) const;
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
void SetDuration(int32 dur) { m_duration = dur; }
+ int32 GetDuration() { return m_duration; }
/*
bool UpdateStats(Stats stat);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 26ea7c110d2..f463a62e9fa 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -74,6 +74,8 @@
#include "InstanceScript.h"
#include <cmath>
#include "AccountMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -630,8 +632,6 @@ void KillRewarder::Reward()
// == Player ====================================================
-UpdateMask Player::updateVisualBits;
-
// we can disable this warning for this since it only
// causes undefined behavior when passed to the base class constructor
#ifdef _MSC_VER
@@ -724,12 +724,10 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
for (uint8 i=0; i<MAX_TIMERS; i++)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
- _lastLiquid = NULL;
m_MirrorTimerFlags = UNDERWATER_NONE;
m_MirrorTimerFlagsLast = UNDERWATER_NONE;
m_isInWater = false;
m_drunkTimer = 0;
- m_drunk = 0;
m_restTime = 0;
m_deathTimer = 0;
m_deathExpireTime = 0;
@@ -932,7 +930,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class);
if (!info)
{
- sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class);
return false;
}
@@ -945,7 +943,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class);
if (!cEntry)
{
- sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class);
return false;
}
@@ -961,7 +959,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
if (!IsValidGender(createInfo->Gender))
{
- sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender);
return false;
}
@@ -1231,7 +1229,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
}
// item can't be added
- sLog->outError("STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
return false;
}
@@ -1298,7 +1296,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
{
if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
{
- sLog->outStaticDebug("We are fall to death, loosing 10 percents durability");
+ sLog->outDebug(LOG_FILTER_PLAYER, "We are fall to death, loosing 10 percents durability");
DurabilityLossAll(0.10f, false);
// durability lost message
WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0);
@@ -1461,49 +1459,51 @@ void Player::HandleDrowning(uint32 time_diff)
m_MirrorTimerFlagsLast = m_MirrorTimerFlags;
}
-///The player sobers by 256 every 10 seconds
+///The player sobers by 1% every 9 seconds
void Player::HandleSobering()
{
m_drunkTimer = 0;
- uint32 drunk = (m_drunk <= 256) ? 0 : (m_drunk - 256);
+ uint8 currentDrunkValue = GetDrunkValue();
+ uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0;
SetDrunkValue(drunk);
}
-DrunkenState Player::GetDrunkenstateByValue(uint16 value)
+DrunkenState Player::GetDrunkenstateByValue(uint8 value)
{
- if (value >= 23000)
+ if (value >= 90)
return DRUNKEN_SMASHED;
- if (value >= 12800)
+ if (value >= 50)
return DRUNKEN_DRUNK;
- if (value & 0xFFFE)
+ if (value)
return DRUNKEN_TIPSY;
return DRUNKEN_SOBER;
}
-void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
+void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
{
- uint32 oldDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
+ bool isSobering = newDrunkValue < GetDrunkValue();
+ uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue());
+ if (newDrunkValue > 100)
+ newDrunkValue = 100;
// select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates
- int32 drunkPercent = newDrunkenValue * 100 / 0xFFFF;
- drunkPercent = std::max(drunkPercent, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
-
+ int32 drunkPercent = std::max<int32>(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
if (drunkPercent)
{
m_invisibilityDetect.AddFlag(INVISIBILITY_DRUNK);
m_invisibilityDetect.SetValue(INVISIBILITY_DRUNK, drunkPercent);
}
- else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkenValue)
+ else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue)
m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK);
- m_drunk = newDrunkenValue;
- SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & 0xFFFF0001) | (m_drunk & 0xFFFE));
-
- uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
-
+ uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
+ SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue);
UpdateObjectVisibility();
+ if (!isSobering)
+ m_drunkTimer = 0; // reset sobering timer
+
if (newDrunkenState == oldDrunkenState)
return;
@@ -1511,7 +1511,6 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
data << uint64(GetGUID());
data << uint32(newDrunkenState);
data << uint32(itemId);
-
SendMessageToSet(&data, true);
}
@@ -1535,9 +1534,9 @@ void Player::Update(uint32 p_time)
//ASSERT (!m_spellModTakingSpell);
if (m_spellModTakingSpell)
{
- //sLog->outCrash("Player has m_pad %u during update!", m_pad);
+ //sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad);
//if (m_spellModTakingSpell)
- sLog->outCrash("Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
+ sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
m_spellModTakingSpell = NULL;
}
@@ -1734,7 +1733,7 @@ void Player::Update(uint32 p_time)
{
// m_nextSave reseted in SaveToDB call
SaveToDB();
- sLog->outDetail("Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
}
else
m_nextSave -= p_time;
@@ -1752,11 +1751,10 @@ void Player::Update(uint32 p_time)
m_Last_tick = now;
}
- if (m_drunk)
+ if (GetDrunkValue())
{
m_drunkTimer += p_time;
-
- if (m_drunkTimer > 10*IN_MILLISECONDS)
+ if (m_drunkTimer > 9 * IN_MILLISECONDS)
HandleSobering();
}
@@ -1824,7 +1822,7 @@ void Player::setDeathState(DeathState s)
{
if (!cur)
{
- sLog->outError("setDeathState: attempt to kill a dead player %s(%d)", GetName(), GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "setDeathState: attempt to kill a dead player %s(%d)", GetName(), GetGUIDLow());
return;
}
@@ -1882,12 +1880,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass);
if (!info)
{
- sLog->outError("Player %u has incorrect race/class pair. Don't build enum.", guid);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid);
return false;
}
else if (!IsValidGender(gender))
{
- sLog->outError("Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
return false;
}
@@ -2069,14 +2067,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
- sLog->outError("TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
+ sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
{
- sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
+ sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED);
return false;
}
@@ -2409,6 +2407,7 @@ void Player::RemoveFromWorld()
StopCastingBindSight();
UnsummonPetTemporaryIfAny();
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
}
///- Do not add/remove the player from the object storage
@@ -2429,7 +2428,7 @@ void Player::RemoveFromWorld()
{
if (WorldObject* viewpoint = GetViewpoint())
{
- sLog->outCrash("Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
SetViewpoint(viewpoint, false);
}
}
@@ -3154,7 +3153,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
// reset size before reapply auras
- SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ SetObjectScale(1.0f);
// save base values (bonuses already included in stored stats
for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
@@ -3323,7 +3322,7 @@ void Player::SendInitialSpells()
uint16 spellCooldowns = m_spellCooldowns.size();
data << uint16(spellCooldowns);
- for (SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
+ for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
{
SpellInfo const* sEntry = sSpellMgr->GetSpellInfo(itr->first);
if (!sEntry)
@@ -3358,7 +3357,7 @@ void Player::SendInitialSpells()
GetSession()->SendPacket(&data);
- sLog->outDetail("CHARACTER: Sent Initial Spells");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells");
}
void Player::RemoveMail(uint32 id)
@@ -3439,7 +3438,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3448,7 +3447,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3458,7 +3457,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3467,7 +3466,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addTalent: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -3512,7 +3511,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3521,7 +3520,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3531,7 +3530,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3540,7 +3539,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -4294,7 +4293,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
if (!sSpellMgr->GetSpellInfo(spell_id))
{
- sLog->outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
continue;
}
@@ -4493,119 +4492,6 @@ Mail* Player::GetMail(uint32 id)
return NULL;
}
-void Player::_SetCreateBits(UpdateMask* updateMask, Player* target) const
-{
- if (target == this)
- Object::_SetCreateBits(updateMask, target);
- else
- {
- for (uint16 index = 0; index < m_valuesCount; index++)
- if (GetUInt32Value(index) != 0 && updateVisualBits.GetBit(index))
- updateMask->SetBit(index);
- }
-}
-
-void Player::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
-{
- if (target == this)
- Object::_SetUpdateBits(updateMask, target);
- else
- {
- Object::_SetUpdateBits(updateMask, target);
- *updateMask &= updateVisualBits;
- }
-}
-
-void Player::InitVisibleBits()
-{
- updateVisualBits.SetCount(PLAYER_END);
-
- updateVisualBits.SetBit(OBJECT_FIELD_GUID);
- updateVisualBits.SetBit(OBJECT_FIELD_TYPE);
- updateVisualBits.SetBit(OBJECT_FIELD_ENTRY);
- updateVisualBits.SetBit(OBJECT_FIELD_SCALE_X);
- updateVisualBits.SetBit(UNIT_FIELD_CHARM + 0);
- updateVisualBits.SetBit(UNIT_FIELD_CHARM + 1);
- updateVisualBits.SetBit(UNIT_FIELD_SUMMON + 0);
- updateVisualBits.SetBit(UNIT_FIELD_SUMMON + 1);
- updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY + 0);
- updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY + 1);
- updateVisualBits.SetBit(UNIT_FIELD_TARGET + 0);
- updateVisualBits.SetBit(UNIT_FIELD_TARGET + 1);
- updateVisualBits.SetBit(UNIT_FIELD_CHANNEL_OBJECT + 0);
- updateVisualBits.SetBit(UNIT_FIELD_CHANNEL_OBJECT + 1);
- updateVisualBits.SetBit(UNIT_FIELD_BYTES_0);
- updateVisualBits.SetBit(UNIT_FIELD_HEALTH);
- updateVisualBits.SetBit(UNIT_FIELD_POWER1);
- updateVisualBits.SetBit(UNIT_FIELD_POWER2);
- updateVisualBits.SetBit(UNIT_FIELD_POWER3);
- updateVisualBits.SetBit(UNIT_FIELD_POWER4);
- updateVisualBits.SetBit(UNIT_FIELD_POWER5);
- updateVisualBits.SetBit(UNIT_FIELD_POWER6);
- updateVisualBits.SetBit(UNIT_FIELD_POWER7);
- updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER3);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER4);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7);
- updateVisualBits.SetBit(UNIT_FIELD_LEVEL);
- updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE);
- updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0);
- updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 1);
- updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 2);
- updateVisualBits.SetBit(UNIT_FIELD_FLAGS);
- updateVisualBits.SetBit(UNIT_FIELD_FLAGS_2);
- updateVisualBits.SetBit(UNIT_FIELD_AURASTATE);
- updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 0);
- updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 1);
- updateVisualBits.SetBit(UNIT_FIELD_BOUNDINGRADIUS);
- updateVisualBits.SetBit(UNIT_FIELD_COMBATREACH);
- updateVisualBits.SetBit(UNIT_FIELD_DISPLAYID);
- updateVisualBits.SetBit(UNIT_FIELD_NATIVEDISPLAYID);
- updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID);
- updateVisualBits.SetBit(UNIT_FIELD_BYTES_1);
- updateVisualBits.SetBit(UNIT_FIELD_PETNUMBER);
- updateVisualBits.SetBit(UNIT_FIELD_PET_NAME_TIMESTAMP);
- updateVisualBits.SetBit(UNIT_DYNAMIC_FLAGS);
- updateVisualBits.SetBit(UNIT_CHANNEL_SPELL);
- updateVisualBits.SetBit(UNIT_MOD_CAST_SPEED);
- updateVisualBits.SetBit(UNIT_FIELD_BASE_MANA);
- updateVisualBits.SetBit(UNIT_FIELD_BYTES_2);
- updateVisualBits.SetBit(UNIT_FIELD_HOVERHEIGHT);
-
- updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 0);
- updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 1);
- updateVisualBits.SetBit(PLAYER_FLAGS);
- updateVisualBits.SetBit(PLAYER_GUILDID);
- updateVisualBits.SetBit(PLAYER_GUILDRANK);
- updateVisualBits.SetBit(PLAYER_BYTES);
- updateVisualBits.SetBit(PLAYER_BYTES_2);
- updateVisualBits.SetBit(PLAYER_BYTES_3);
- updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
- updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
- updateVisualBits.SetBit(UNIT_NPC_FLAGS);
-
- // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
- for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
- updateVisualBits.SetBit(i);
-
- // Players visible items are not inventory stuff
- for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
- {
- uint16 offset = i * 2;
-
- // item entry
- updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENTRYID + offset);
- // enchant
- updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + offset);
- }
-
- updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE);
-}
-
void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
{
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
@@ -5081,7 +4967,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
break;
}
default:
- sLog->outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
}
if (updateRealmChars)
@@ -5111,7 +4997,7 @@ void Player::DeleteOldCharacters()
*/
void Player::DeleteOldCharacters(uint32 keepDays)
{
- sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
+ sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS);
stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY)));
@@ -5119,7 +5005,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
if (result)
{
- sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
do
{
Field* fields = result->Fetch();
@@ -5139,7 +5025,7 @@ void Player::SetMovement(PlayerMovementType pType)
case MOVE_WATER_WALK: data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size()+4); break;
case MOVE_LAND_WALK: data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size()+4); break;
default:
- sLog->outError("Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType);
return;
}
data.append(GetPackGUID());
@@ -5168,7 +5054,7 @@ void Player::BuildPlayerRepop()
// the player cannot have a corpse already, only bones which are not returned by GetCorpse
if (GetCorpse())
{
- sLog->outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow());
return;
}
@@ -5177,7 +5063,7 @@ void Player::BuildPlayerRepop()
Corpse* corpse = GetCorpse();
if (!corpse)
{
- sLog->outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
return;
}
GetMap()->AddToMap(corpse);
@@ -5534,7 +5420,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
if (!dcost)
{
- sLog->outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
return TotalCost;
}
@@ -5542,7 +5428,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
if (!dQualitymodEntry)
{
- sLog->outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
return TotalCost;
}
@@ -5558,7 +5444,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
{
if (GetGuildId() == 0)
{
- sLog->outStaticDebug("You are not member of a guild");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild");
return TotalCost;
}
@@ -5573,7 +5459,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
}
else if (!HasEnoughMoney(costs))
{
- sLog->outStaticDebug("You do not have enough money");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money");
return TotalCost;
}
else
@@ -5610,7 +5496,17 @@ void Player::RepopAtGraveyard()
if (Battleground* bg = GetBattleground())
ClosestGrave = bg->GetClosestGraveYard(this);
else
- ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ {
+ if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ else
+ {
+ if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ else
+ ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ }
+ }
// stop countdown until repop
m_deathTimer = 0;
@@ -5781,7 +5677,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
{
if (modGroup >= BASEMOD_END || modType >= MOD_END)
{
- sLog->outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
return;
}
@@ -5812,7 +5708,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
{
if (modGroup >= BASEMOD_END || modType > MOD_END)
{
- sLog->outError("trial to access non existed BaseModGroup or wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!");
return 0.0f;
}
@@ -5826,7 +5722,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const
{
if (modGroup >= BASEMOD_END)
{
- sLog->outError("wrong BaseModGroup in GetTotalBaseModValue()!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!");
return 0.0f;
}
@@ -6548,7 +6444,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
if (!pSkill)
{
- sLog->outError("Skill not found in SkillLineStore: skill #%u", id);
+ sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id);
return;
}
@@ -6708,8 +6604,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const
void Player::SendActionButtons(uint32 state) const
{
- sLog->outDetail("Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec);
-
WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(state);
/*
@@ -6731,20 +6625,20 @@ void Player::SendActionButtons(uint32 state) const
}
GetSession()->SendPacket(&data);
- sLog->outDetail("Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
}
bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
{
if (button >= MAX_ACTION_BUTTONS)
{
- sLog->outError("Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
return false;
}
if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
- sLog->outError("Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
return false;
}
@@ -6753,7 +6647,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_SPELL:
if (!sSpellMgr->GetSpellInfo(action))
{
- sLog->outError("Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
return false;
}
@@ -6766,7 +6660,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_ITEM:
if (!sObjectMgr->GetItemTemplate(action))
{
- sLog->outError("Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
return false;
}
break;
@@ -6788,7 +6682,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
// set data and update to CHANGED if not NEW
ab.SetActionAndType(action, ActionButtonType(type));
- sLog->outDetail("Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
+ sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
return &ab;
}
@@ -6803,7 +6697,7 @@ void Player::removeActionButton(uint8 button)
else
buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
- sLog->outDetail("Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
}
ActionButton const* Player::GetActionButton(uint8 button)
@@ -6830,11 +6724,6 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t
if (GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
- // code block for underwater state update
- // Unit::UpdatePosition() checks for validity and updates our coordinates
- // so we re-fetch them instead of using "raw" coordinates from function params
- UpdateUnderwaterState(GetMap(), GetPositionX(), GetPositionY(), GetPositionZ());
-
if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
GetSession()->SendCancelTrade();
@@ -6920,7 +6809,7 @@ void Player::CheckAreaExploreAndOutdoor()
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
{
- sLog->outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
+ sLog->outError(LOG_FILTER_PLAYER, "Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
return;
}
@@ -6936,7 +6825,7 @@ void Player::CheckAreaExploreAndOutdoor()
AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId());
if (!areaEntry)
{
- sLog->outError("Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
return;
}
@@ -6973,7 +6862,7 @@ void Player::CheckAreaExploreAndOutdoor()
GiveXP(XP, NULL);
SendExplorationExperience(area, XP);
}
- sLog->outDetail("Player %u discovered a new area: %u", GetGUIDLow(), area);
+ sLog->outInfo(LOG_FILTER_PLAYER, "Player %u discovered a new area: %u", GetGUIDLow(), area);
}
}
}
@@ -6987,10 +6876,10 @@ uint32 Player::TeamForRace(uint8 race)
case 1: return HORDE;
case 7: return ALLIANCE;
}
- sLog->outError("Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
+ sLog->outError(LOG_FILTER_PLAYER, "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
}
else
- sLog->outError("Race (%u) not found in DBC: wrong DBC files?", uint32(race));
+ sLog->outError(LOG_FILTER_PLAYER, "Race (%u) not found in DBC: wrong DBC files?", uint32(race));
return ALLIANCE;
}
@@ -7537,6 +7426,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
}
@@ -7684,7 +7575,7 @@ void Player::CheckDuelDistance(time_t currTime)
bool Player::IsOutdoorPvPActive()
{
- return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && (IsPvP() || sWorld->IsPvPRealm()) && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
+ return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && IsPvP() && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
}
void Player::DuelComplete(DuelCompleteType type)
@@ -7819,7 +7710,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
if (item->IsBroken())
return;
- sLog->outDetail("applying mods for item %u ", item->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow());
uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -8305,7 +8196,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
return;
}
- sLog->outStaticDebug("WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id);
+ sLog->outDebug(LOG_FILTER_PLAYER, "WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id);
CastSpell(this, spellInfo, true, item);
}
@@ -8411,7 +8302,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId);
continue;
}
@@ -8480,7 +8371,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
continue;
}
@@ -8525,7 +8416,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
if (!spellInfo)
{
- sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
SendEquipError(EQUIP_ERR_NONE, item, NULL);
return;
}
@@ -8557,7 +8448,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
- sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId);
continue;
}
@@ -8585,7 +8476,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
continue;
}
@@ -9109,7 +9000,6 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot->loot_type = loot_type;
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
-
data << uint64(guid);
data << uint8(loot_type);
data << LootView(*loot, this, permission);
@@ -9223,6 +9113,9 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 4100: // The Culling of Stratholme
NumberOfFields = 13;
break;
+ case 4273: // Ulduar
+ NumberOfFields = 10;
+ break;
default:
NumberOfFields = 12;
break;
@@ -9263,6 +9156,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 1519: // Stormwind City
case 1537: // Ironforge
case 2257: // Deeprun Tram
+ case 3703: // Shattrath City
break;
case 139: // Eastern Plaguelands
if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP)
@@ -9669,7 +9563,6 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(3610) << uint32(0x0); // 9 show
}
break;
- case 3703: // Shattrath City
case 4384: // Strand of the Ancients
if (bg && bg->GetTypeID(true) == BATTLEGROUND_SA)
bg->FillInitialWorldStates(data);
@@ -9767,6 +9660,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW
}
break;
+ // Ulduar
+ case 4273:
+ if (instance && mapid == 603)
+ instance->FillInitialWorldStates(data);
+ else
+ {
+ data << uint32(4132) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES
+ data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED
+ }
+ break;
default:
data << uint32(0x914) << uint32(0x0); // 7
data << uint32(0x913) << uint32(0x0); // 8
@@ -9802,7 +9705,7 @@ uint32 Player::GetXPRestBonus(uint32 xp)
SetRestBonus(GetRestBonus() - rested_bonus);
- sLog->outDetail("Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus());
+ sLog->outInfo(LOG_FILTER_PLAYER, "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus());
return rested_bonus;
}
@@ -9834,7 +9737,7 @@ void Player::ResetPetTalents()
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ sLog->outError(LOG_FILTER_PLAYER, "Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
pet->resetTalents();
@@ -10150,7 +10053,8 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (inBankAlso)
{
- for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
+ // checking every item from 39 to 74 (including bank bags)
+ for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetEntry() == item)
count += pItem->GetCount();
@@ -10190,7 +10094,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte
if (Bag* pBag = GetBagByPos(i))
count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem);
- for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
+ for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem)
if (ItemTemplate const* pProto = pItem->GetTemplate())
@@ -10216,7 +10120,7 @@ Item* Player::GetItemByGuid(uint64 guid) const
if (pItem->GetGUID() == guid)
return pItem;
- for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
+ for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem->GetGUID() == guid)
return pItem;
@@ -10671,7 +10575,7 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
// currencytoken case
- if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS))
+ if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->IsCurrencyToken()))
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
// prevent cheating
@@ -11024,7 +10928,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
}
}
- else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
+ else if (pProto->IsCurrencyToken())
{
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
@@ -11191,7 +11095,7 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
}
}
- else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
+ else if (pProto->IsCurrencyToken())
{
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
@@ -11440,7 +11344,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
if (b_found)
continue;
- if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
+ if (pProto->IsCurrencyToken())
{
for (uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{
@@ -11736,7 +11640,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
uint8 pItemslot = pItem->GetSlot();
if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END)
{
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!",
+ sLog->outError(LOG_FILTER_PLAYER, "Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!",
GetName(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId);
return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED;
}
@@ -12012,7 +11916,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje
Map const* map = lootedObject->GetMap();
if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true))
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
- if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
+ if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty()))
lootedObjectInDungeon = true;
if (!lootedObjectInDungeon)
@@ -12173,11 +12077,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
pItem->SetItemRandomProperties(randomPropertyId);
pItem = StoreItem(dest, pItem, update);
- const ItemTemplate* proto = pItem->GetTemplate();
- for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
- if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
- CastSpell(this, proto->Spells[i].SpellId, true, pItem);
-
if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound())
{
pItem->SetSoulboundTradeable(allowedLooters);
@@ -12283,6 +12182,14 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
+
+ const ItemTemplate* proto = pItem->GetTemplate();
+ for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
+ if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
+ if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
+ if (!HasAura(proto->Spells[i].SpellId))
+ CastSpell(this, proto->Spells[i].SpellId, true, pItem);
+
return pItem;
}
else
@@ -12319,6 +12226,13 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
pItem2->SetState(ITEM_CHANGED, this);
+ const ItemTemplate* proto = pItem2->GetTemplate();
+ for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
+ if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
+ if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
+ if (!HasAura(proto->Spells[i].SpellId))
+ CastSpell(this, proto->Spells[i].SpellId, true, pItem2);
+
return pItem2;
}
}
@@ -12365,7 +12279,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
if (!spellProto)
- sLog->outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
+ sLog->outError(LOG_FILTER_PLAYER, "Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
else
{
m_weaponChangeTimer = spellProto->StartRecoveryTime;
@@ -12747,7 +12661,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
{
ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
pItem->SetCount(pItem->GetCount() - count + remcount);
- if (IsInWorld() & update)
+ if (IsInWorld() && update)
pItem->SendUpdateToPlayer(this);
pItem->SetState(ITEM_CHANGED, this);
return;
@@ -12775,7 +12689,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
{
ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
pItem->SetCount(pItem->GetCount() - count + remcount);
- if (IsInWorld() & update)
+ if (IsInWorld() && update)
pItem->SendUpdateToPlayer(this);
pItem->SetState(ITEM_CHANGED, this);
return;
@@ -12841,7 +12755,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
{
ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
pItem->SetCount(pItem->GetCount() - count + remcount);
- if (IsInWorld() & update)
+ if (IsInWorld() && update)
pItem->SendUpdateToPlayer(this);
pItem->SetState(ITEM_CHANGED, this);
return;
@@ -12916,6 +12830,11 @@ Item* Player::GetItemByEntry(uint32 entry) const
if (pItem->GetEntry() == entry)
return pItem;
+ for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
+ if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (pItem->GetEntry() == entry)
+ return pItem;
+
for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
if (Bag* pBag = GetBagByPos(i))
for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
@@ -12949,7 +12868,7 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update)
ItemRemovedQuestCheck(pItem->GetEntry(), count);
pItem->SetCount(pItem->GetCount() - count);
count = 0;
- if (IsInWorld() & update)
+ if (IsInWorld() && update)
pItem->SendUpdateToPlayer(this);
pItem->SetState(ITEM_CHANGED, this);
}
@@ -13537,9 +13456,9 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint
}
case EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM: // no idea about this one...
{
- data << uint64(0);
- data << uint32(0);
- data << uint64(0);
+ data << uint64(0); // item guid
+ data << uint32(0); // slot
+ data << uint64(0); // container
break;
}
case EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED:
@@ -13647,7 +13566,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly)
Item* item = *itr;
++itr; // current element can be erased in UpdateDuration
- if ((realtimeonly && item->GetTemplate()->Duration < 0) || !realtimeonly)
+ if (!realtimeonly || item->GetTemplate()->FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME)
item->UpdateDuration(this, time);
}
}
@@ -14123,7 +14042,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
// nothing do..
break;
default:
- sLog->outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type);
+ sLog->outError(LOG_FILTER_PLAYER, "Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type);
break;
} /*switch (enchant_display_type)*/
} /*for*/
@@ -14224,7 +14143,7 @@ void Player::SendNewItem(Item* item, uint32 count, bool received, bool created,
data << uint64(GetGUID()); // player GUID
data << uint32(received); // 0=looted, 1=from npc
data << uint32(created); // 0=received, 1=created
- data << uint32(1); // always 0x01 (probably meant to be count of listed items)
+ data << uint32(1); // bool print error to chat
data << uint8(item->GetBagSlot()); // bagslot
// item slot, but when added to stack: 0xFFFFFFFF
data << uint32((item->GetCount() == count) ? item->GetSlot() : -1);
@@ -14295,7 +14214,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
VendorItemData const* vendorItems = creature->GetVendorItems();
if (!vendorItems || vendorItems->Empty())
{
- sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
canTalk = false;
}
break;
@@ -14344,7 +14263,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
canTalk = false;
break;
default:
- sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId);
+ sLog->outError(LOG_FILTER_SQL, "Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId);
canTalk = false;
break;
}
@@ -14439,7 +14358,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
{
if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER)
{
- sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry());
+ sLog->outError(LOG_FILTER_PLAYER, "Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry());
return;
}
}
@@ -14543,7 +14462,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
- sLog->outError("a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow());
return;
}
@@ -16615,7 +16534,7 @@ void Player::_LoadArenaTeamInfo(PreparedQueryResult result)
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
{
- sLog->outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId);
continue;
}
@@ -16655,10 +16574,11 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
uint8 index = fields[1].GetUInt8();
eqSet.Name = fields[2].GetString();
eqSet.IconName = fields[3].GetString();
+ eqSet.IgnoreMask = fields[4].GetUInt32();
eqSet.state = EQUIPMENT_SET_UNCHANGED;
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
- eqSet.Items[i] = fields[4+i].GetUInt32();
+ eqSet.Items[i] = fields[5+i].GetUInt32();
m_EquipmentSets[index] = eqSet;
@@ -16765,7 +16685,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (!result)
{
- sLog->outError("Player (GUID: %u) not found in table `characters`, can't load. ", guid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) not found in table `characters`, can't load. ", guid);
return false;
}
@@ -16777,13 +16697,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// player should be able to load/delete character only with correct account!
if (dbAccountId != GetSession()->GetAccountId())
{
- sLog->outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId);
return false;
}
if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBANNED))
{
- sLog->outError("Player (GUID: %u) is banned, can't load.", guid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) is banned, can't load.", guid);
return false;
}
@@ -16811,7 +16731,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
uint8 Gender = fields[5].GetUInt8();
if (!IsValidGender(Gender))
{
- sLog->outError("Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender);
return false;
}
@@ -16842,7 +16762,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32());
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
- SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 1, fields[49].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32());
@@ -16934,7 +16855,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !IsPositionValid())
{
- sLog->outError("Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
RelocateToHomebind();
}
// Player was saved in Arena or Bg
@@ -16972,7 +16893,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (mapId == MAPID_INVALID) // Battleground Entry Point not found (???)
{
- sLog->outError("Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid);
RelocateToHomebind();
}
else
@@ -16994,7 +16915,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// transport size limited
m_movementInfo.t_pos.m_positionX > 250 || m_movementInfo.t_pos.m_positionY > 250 || m_movementInfo.t_pos.m_positionZ > 250)
{
- sLog->outError("Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
guid, GetPositionX()+m_movementInfo.t_pos.m_positionX, GetPositionY()+m_movementInfo.t_pos.m_positionY,
GetPositionZ()+m_movementInfo.t_pos.m_positionZ, GetOrientation()+m_movementInfo.t_pos.m_orientation);
@@ -17014,7 +16935,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
if (!m_transport)
{
- sLog->outError("Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.",
guid, transGUID);
RelocateToHomebind();
@@ -17041,12 +16962,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (!nodeEntry) // don't know taxi start node, to homebind
{
- sLog->outError("Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow());
RelocateToHomebind();
}
else // have start node, to it
{
- sLog->outError("Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow());
mapId = nodeEntry->map_id;
Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z, 0.0f);
}
@@ -17096,13 +17017,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(mapId);
if (at)
{
- sLog->outError("Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
Relocate(at->target_X, at->target_Y, at->target_Z, GetOrientation());
mapId = at->target_mapId;
}
else
{
- sLog->outError("Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
RelocateToHomebind();
}
@@ -17112,11 +17033,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
mapId = info->mapId;
Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
- sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
- sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
}
@@ -17130,7 +17051,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
else
{
- sLog->outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), mapId);
RelocateToHomebind();
}
}
@@ -17152,13 +17073,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// set value, including drunk invisibility detection
// calculate sobering. after 15 minutes logged out, the player will be sober again
- float soberFactor;
- if (time_diff > 15*MINUTE)
- soberFactor = 0;
- else
- soberFactor = 1-time_diff/(15.0f*MINUTE);
- uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
- SetDrunkValue(newDrunkenValue);
+ uint8 newDrunkValue = 0;
+ if (time_diff < uint32(GetDrunkValue()) * 9)
+ newDrunkValue = GetDrunkValue() - time_diff / 9;
+
+ SetDrunkValue(newDrunkValue);
m_cinematic = fields[18].GetUInt8();
m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32();
@@ -17174,7 +17093,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
m_stableSlots = fields[32].GetUInt8();
if (m_stableSlots > MAX_PET_STABLES)
{
- sLog->outError("Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots));
+ sLog->outError(LOG_FILTER_PLAYER, "Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots));
m_stableSlots = MAX_PET_STABLES;
}
@@ -17194,7 +17113,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
// clear charm/summon related fields
- SetUInt64Value(UNIT_FIELD_SUMMONEDBY, 0);
+ SetOwnerGUID(0);
SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0);
SetUInt64Value(UNIT_FIELD_CHARM, 0);
SetUInt64Value(UNIT_FIELD_SUMMON, 0);
@@ -17252,7 +17171,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS)
{
m_activeSpec = 0;
- sLog->outError("Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName(), GetGUIDLow(), m_specsCount, m_activeSpec);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName(), GetGUIDLow(), m_specsCount, m_activeSpec);
}
_LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADTALENTS));
@@ -17457,7 +17376,7 @@ void Player::_LoadActions(PreparedQueryResult result)
ab->uState = ACTIONBUTTON_UNCHANGED;
else
{
- sLog->outError(" ...at loading, and will deleted in DB also");
+ sLog->outError(LOG_FILTER_PLAYER, " ...at loading, and will deleted in DB also");
// Will deleted in DB at next save (it can create data until save but marked as deleted)
m_actionButtons[button].uState = ACTIONBUTTON_DELETED;
@@ -17501,7 +17420,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
- sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
+ sLog->outError(LOG_FILTER_PLAYER, "Unknown aura (spellid %u), ignore.", spellid);
continue;
}
@@ -17535,7 +17454,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
- sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
+ sLog->outInfo(LOG_FILTER_PLAYER, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -17558,13 +17477,13 @@ void Player::_LoadGlyphAuras()
continue;
}
else
- sLog->outError("Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags);
}
else
- sLog->outError("Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i);
}
else
- sLog->outError("Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i);
// On any error remove glyph
SetGlyph(i, 0);
@@ -17599,6 +17518,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
uint32 zoneId = GetZoneId();
std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
+ std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags
std::list<Item*> problematicItems;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -17643,9 +17563,15 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
// Remember bags that may contain items in them
if (err == EQUIP_ERR_OK)
+ {
if (IsBagPos(item->GetPos()))
if (Bag* pBag = item->ToBag())
bagMap[item->GetGUIDLow()] = pBag;
+ }
+ else
+ if (IsBagPos(item->GetPos()))
+ if (item->IsBag())
+ invalidBagMap[item->GetGUIDLow()] = item;
}
else
{
@@ -17657,8 +17583,23 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
ItemPosCountVec dest;
err = CanStoreItem(itr->second->GetSlot(), slot, dest, item);
if (err == EQUIP_ERR_OK)
- itr->second->StoreItem(slot, item, true);
+ item = StoreItem(dest, item, true);
}
+ else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
+ {
+ std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid);
+ if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end())
+ err = EQUIP_ERR_INT_BAG_ERROR;
+ }
+ else
+ {
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?",
+ GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot);
+ item->DeleteFromInventoryDB(trans);
+ delete item;
+ continue;
+ }
+
}
// Item's state may have changed after storing
@@ -17666,7 +17607,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
item->SetState(ITEM_UNCHANGED, this);
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.",
GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err);
item->DeleteFromInventoryDB(trans);
problematicItems.push_back(item);
@@ -17782,7 +17723,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
{
- if (events[*itr].holiday_id == proto->HolidayId)
+ if (uint32(events[*itr].holiday_id) == proto->HolidayId)
{
remove = false;
break;
@@ -17792,7 +17733,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.",
GetGUIDLow(), GetName(), itemGuid, itemEntry);
remove = true;
}
@@ -17807,7 +17748,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.",
GetGUIDLow(), GetName(), itemEntry);
Item::DeleteFromInventoryDB(trans, itemGuid);
Item::DeleteFromDB(trans, itemGuid);
@@ -17838,7 +17779,7 @@ void Player::_LoadMailedItems(Mail* mail)
if (!proto)
{
- sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);
stmt->setUInt32(0, itemGuid);
@@ -17854,7 +17795,7 @@ void Player::_LoadMailedItems(Mail* mail)
if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate))
{
- sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
stmt->setUInt32(0, itemGuid);
@@ -17917,7 +17858,7 @@ void Player::_LoadMail()
if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId))
{
- sLog->outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId);
m->mailTemplateId = 0;
}
@@ -17974,7 +17915,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
else
{
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
- sLog->outError("Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).",
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).",
GetName(), GetGUIDLow(), quest_id, qstatus);
}
@@ -18098,7 +18039,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query
{
- sLog->outError("Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow());
break;
}
@@ -18229,12 +18170,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !mapEntry->IsDungeon())
{
- sLog->outError("_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName(), GetGUIDLow(), mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName(), GetGUIDLow(), mapId);
deleteInstance = true;
}
else if (difficulty >= MAX_DIFFICULTY)
{
- sLog->outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
deleteInstance = true;
}
else
@@ -18242,12 +18183,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty));
if (!mapDiff)
{
- sLog->outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
deleteInstance = true;
}
else if (!perm && group)
{
- sLog->outError("_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty);
deleteInstance = true;
}
}
@@ -18318,10 +18259,10 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
CharacterDatabase.Execute(stmt);
}
- itr->second.save->RemovePlayer(this); // save can become invalid
if (itr->second.perm)
GetSession()->SendCalendarRaidLockout(itr->second.save, false);
+ itr->second.save->RemovePlayer(this); // save can become invalid
m_boundInstances[difficulty].erase(itr++);
}
}
@@ -18593,7 +18534,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
- sLog->outError("Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName());
return false;
}
@@ -18641,7 +18582,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
CharacterDatabase.Execute(stmt);
}
- sLog->outStaticDebug("Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f",
+ sLog->outDebug(LOG_FILTER_PLAYER, "Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f",
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
return true;
@@ -18730,7 +18671,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -18841,7 +18782,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -19085,7 +19026,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
}
else
{
- sLog->outError("Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
m_refundableItems.erase(itr);
}
}
@@ -19116,7 +19057,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
uint32 bagTestGUID = 0;
if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
bagTestGUID = test2->GetGUIDLow();
- sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState());
+ sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState());
// according to the test that was just performed nothing should be in this slot, delete
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT);
stmt->setUInt32(0, bagTestGUID);
@@ -19132,7 +19073,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
}
else if (test != item)
{
- sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
// save all changes to the item...
if (item->GetState() != ITEM_NEW) // only for existing items, no dupes
item->SaveToDB(trans);
@@ -19542,7 +19483,7 @@ void Player::_SaveStats(SQLTransaction& trans)
void Player::outDebugValues() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_UNITS, LOG_LEVEL_DEBUG))
return;
sLog->outDebug(LOG_FILTER_UNITS, "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA));
@@ -19783,7 +19724,11 @@ void Player::SendResetInstanceSuccess(uint32 MapId)
void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId)
{
- // TODO: find what other fail reasons there are besides players in the instance
+ /*reasons for instance reset failure:
+ // 0: There are players inside the instance.
+ // 1: There are players offline in your party.
+ // 2>: There are players in your party attempting to zone into an instance.
+ */
WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4);
data << uint32(reason);
data << uint32(MapId);
@@ -19858,7 +19803,7 @@ Pet* Player::GetPet() const
return pet;
//there may be a guardian in slot
- //sLog->outError("Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid));
+ //sLog->outError(LOG_FILTER_PLAYER, "Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid));
//const_cast<Player*>(this)->SetPetGUID(0);
}
@@ -19960,10 +19905,10 @@ void Player::StopCastingCharm()
if (GetCharmGUID())
{
- sLog->outCrash("Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId());
if (charm->GetCharmerGUID())
{
- sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
ASSERT(false);
}
else
@@ -19976,7 +19921,7 @@ inline void Player::BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std:
*data << uint8(msgtype);
*data << uint32(language);
*data << uint64(GetGUID());
- *data << uint32(language); //language 2.1.0 ?
+ *data << uint32(0); // constant unknown time
*data << uint64(GetGUID());
*data << uint32(text.length() + 1);
*data << text;
@@ -20077,8 +20022,10 @@ void Player::PetSpellInitialize()
WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1);
data << uint64(pet->GetGUID());
data << uint16(pet->GetCreatureTemplate()->family); // creature family (required for pet talents)
- data << uint32(0);
- data << uint8(pet->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
+ data << uint32(pet->GetDuration());
+ data << uint8(pet->GetReactState());
+ data << uint8(charmInfo->GetCommandState());
+ data << uint16(0); // Flags, mostly unknown
// action bar loop
charmInfo->BuildActionBar(&data);
@@ -20111,22 +20058,33 @@ void Player::PetSpellInitialize()
for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
{
- time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
-
- data << uint32(itr->first); // spellid
- data << uint16(0); // spell category?
- data << uint32(cooldown); // cooldown
- data << uint32(0); // category cooldown
- }
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
+ if (!spellInfo)
+ {
+ data << uint32(0);
+ data << uint16(0);
+ data << uint32(0);
+ data << uint32(0);
+ continue;
+ }
- for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureCategoryCooldowns.begin(); itr != pet->m_CreatureCategoryCooldowns.end(); ++itr)
- {
time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
+ data << uint32(itr->first); // spell ID
- data << uint32(itr->first); // spellid
- data << uint16(0); // spell category?
- data << uint32(0); // cooldown
- data << uint32(cooldown); // category cooldown
+ CreatureSpellCooldowns::const_iterator categoryitr = pet->m_CreatureCategoryCooldowns.find(spellInfo->Category);
+ if (categoryitr != pet->m_CreatureCategoryCooldowns.end())
+ {
+ time_t categoryCooldown = (categoryitr->second > curTime) ? (categoryitr->second - curTime) * IN_MILLISECONDS : 0;
+ data << uint16(spellInfo->Category); // spell category
+ data << uint32(cooldown); // spell cooldown
+ data << uint32(categoryCooldown); // category cooldown
+ }
+ else
+ {
+ data << uint16(0);
+ data << uint32(cooldown);
+ data << uint32(0);
+ }
}
GetSession()->SendPacket(&data);
@@ -20142,7 +20100,7 @@ void Player::PossessSpellInitialize()
if (!charmInfo)
{
- sLog->outError("Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
+ sLog->outError(LOG_FILTER_PLAYER, "Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
return;
}
@@ -20162,24 +20120,24 @@ void Player::PossessSpellInitialize()
void Player::VehicleSpellInitialize()
{
- Creature* veh = GetVehicleCreatureBase();
- if (!veh)
+ Creature* vehicle = GetVehicleCreatureBase();
+ if (!vehicle)
return;
- uint8 cooldownCount = veh->m_CreatureSpellCooldowns.size() + veh->m_CreatureCategoryCooldowns.size();
+ uint8 cooldownCount = vehicle->m_CreatureSpellCooldowns.size();
WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4));
- data << uint64(veh->GetGUID());
- data << uint16(veh->GetCreatureTemplate()->family);
- data << uint32(0);
- // The following three segments are read as one uint32
- data << uint8(veh->GetReactState());
- data << uint8(0); // CommandState?
- data << uint16(0); // unk
+ data << uint64(vehicle->GetGUID()); // Guid
+ data << uint16(0); // Pet Family (0 for all vehicles)
+ data << uint32(vehicle->isSummon() ? vehicle->ToTempSummon()->GetTimer() : 0); // Duration
+ // The following three segments are read by the client as one uint32
+ data << uint8(vehicle->GetReactState()); // React State
+ data << uint8(0); // Command State
+ data << uint16(0x800); // DisableActions (set for all vehicles)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
- uint32 spellId = veh->m_spells[i];
+ uint32 spellId = vehicle->m_spells[i];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -20187,54 +20145,59 @@ void Player::VehicleSpellInitialize()
continue;
}
- ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(veh->GetEntry(), spellId);
- if (!sConditionMgr->IsObjectMeetToConditions(this, veh, conditions))
+ ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId);
+ if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions))
{
- sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", veh->ToCreature()->GetEntry(), spellId);
+ sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId);
data << uint16(0) << uint8(0) << uint8(i+8);
continue;
}
if (spellInfo->IsPassive())
- {
- veh->CastSpell(veh, spellId, true);
- data << uint16(0) << uint8(0) << uint8(i+8);
- }
- else
- data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i+8));
+ vehicle->CastSpell(vehicle, spellId, true);
+
+ data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i+8));
}
for (uint32 i = CREATURE_MAX_SPELLS; i < MAX_SPELL_CONTROL_BAR; ++i)
- data << uint16(0) << uint8(0) << uint8(i+8);
+ data << uint32(0);
- data << uint8(0);
- /*if (v23 > 0)
- {
- for (uint32 i = 0; i < v23; ++i)
- data << uint32(v16); // Some spellid?
- }*/
+ data << uint8(0); // Auras?
// Cooldowns
- data << cooldownCount;
+ data << uint8(cooldownCount);
time_t now = sWorld->GetGameTime();
- CreatureSpellCooldowns::const_iterator itr;
- for (itr = veh->m_CreatureSpellCooldowns.begin(); itr != veh->m_CreatureSpellCooldowns.end(); ++itr)
- {
- time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0;
- data << uint32(itr->first); // SpellId
- data << uint16(0); // unk
- data << uint32(cooldown); // spell cooldown
- data << uint32(0); // category cooldown
- }
- for (itr = veh->m_CreatureCategoryCooldowns.begin(); itr != veh->m_CreatureCategoryCooldowns.end(); ++itr)
+ for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr)
{
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
+ if (!spellInfo)
+ {
+ data << uint32(0);
+ data << uint16(0);
+ data << uint32(0);
+ data << uint32(0);
+ continue;
+ }
+
time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0;
- data << uint32(itr->first); // SpellId
- data << uint16(0); // unk
- data << uint32(0); // spell cooldown
- data << uint32(cooldown); // category cooldown
+ data << uint32(itr->first); // spell ID
+
+ CreatureSpellCooldowns::const_iterator categoryitr = vehicle->m_CreatureCategoryCooldowns.find(spellInfo->Category);
+ if (categoryitr != vehicle->m_CreatureCategoryCooldowns.end())
+ {
+ time_t categoryCooldown = (categoryitr->second > now) ? (categoryitr->second - now) * IN_MILLISECONDS : 0;
+ data << uint16(spellInfo->Category); // spell category
+ data << uint32(cooldown); // spell cooldown
+ data << uint32(categoryCooldown); // category cooldown
+ }
+ else
+ {
+ data << uint16(0);
+ data << uint32(cooldown);
+ data << uint32(0);
+ }
}
GetSession()->SendPacket(&data);
@@ -20249,7 +20212,7 @@ void Player::CharmSpellInitialize()
CharmInfo* charmInfo = charm->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
return;
}
@@ -20273,7 +20236,7 @@ void Player::CharmSpellInitialize()
if (charm->GetTypeId() != TYPEID_PLAYER)
data << uint8(charm->ToCreature()->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
else
- data << uint8(0) << uint8(0) << uint16(0);
+ data << uint32(0);
charmInfo->BuildActionBar(&data);
@@ -20494,7 +20457,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
else
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_GUID_TYPE);
- stmt->setUInt8(0, uint8(type));
+ stmt->setUInt8(1, uint8(type));
}
stmt->setUInt32(0, GUID_LOPART(guid));
@@ -20960,7 +20923,7 @@ void Player::InitDisplayIds()
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
- sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
return;
}
@@ -20976,7 +20939,7 @@ void Player::InitDisplayIds()
SetNativeDisplayId(info->displayId_m);
break;
default:
- sLog->outError("Invalid gender %u for player", gender);
+ sLog->outError(LOG_FILTER_PLAYER, "Invalid gender %u for player", gender);
return;
}
}
@@ -21113,7 +21076,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
if (!iece)
{
- sLog->outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
+ sLog->outError(LOG_FILTER_PLAYER, "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
return false;
}
@@ -21156,7 +21119,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
if ((uint32)count > maxCount)
{
- sLog->outError("Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId);
count = (uint8)maxCount;
}
price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
@@ -21636,7 +21599,7 @@ void Player::SetBattlegroundEntryPoint()
if (const WorldSafeLocsEntry* entry = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()))
m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f);
else
- sLog->outError("SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
+ sLog->outError(LOG_FILTER_PLAYER, "SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
}
// If new entry point is not BG or arena set it
else if (!GetMap()->IsBattlegroundOrArena())
@@ -22255,8 +22218,8 @@ void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint3
data << uint32(time);
if (type == RAID_INSTANCE_WELCOME)
{
- data << uint8(0); // is your (1)
- data << uint8(0); // is extended (1), ignored if prev field is 0
+ data << uint8(0); // is locked
+ data << uint8(0); // is extended, ignored if prev field is 0
}
GetSession()->SendPacket(&data);
}
@@ -22870,7 +22833,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
break;
}
default:
- sLog->outError("HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass);
+ sLog->outError(LOG_FILTER_PLAYER, "HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass);
break;
}
@@ -22948,7 +22911,7 @@ uint32 Player::GetResurrectionSpellId()
case 27239: spell_id = 27240; break; // rank 6
case 47883: spell_id = 47882; break; // rank 7
default:
- sLog->outError("Unhandled spell %u: S.Resurrection", (*itr)->GetId());
+ sLog->outError(LOG_FILTER_PLAYER, "Unhandled spell %u: S.Resurrection", (*itr)->GetId());
continue;
}
@@ -23301,7 +23264,7 @@ Player* Player::GetNextRandomRaidMember(float radius)
PartyResult Player::CanUninviteFromGroup() const
{
- const Group* grp = GetGroup();
+ Group const* grp = GetGroup();
if (!grp)
return ERR_NOT_IN_GROUP;
@@ -23324,8 +23287,12 @@ PartyResult Player::CanUninviteFromGroup() const
if (grp->isRollLootActive())
return ERR_PARTY_LFG_BOOT_LOOT_ROLLS;
+ // TODO: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer.
+ for (GroupReference const* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
+ if (itr->getSource() && itr->getSource()->isInCombat())
+ return ERR_PARTY_LFG_BOOT_IN_COMBAT;
+
/* Missing support for these types
- return ERR_PARTY_LFG_BOOT_IN_COMBAT; // also have a cooldown (some secs after combat finish
return ERR_PARTY_LFG_BOOT_COOLDOWN_S;
return ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S;
*/
@@ -23348,7 +23315,7 @@ bool Player::isUsingLfg()
return sLFGMgr->GetState(guid) != LFG_STATE_NONE;
}
-void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
+void Player::SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup)
{
//we must move references from m_group to m_originalGroup
SetOriginalGroup(GetGroup(), GetSubGroup());
@@ -23358,7 +23325,7 @@ void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
m_group.setSubGroup((uint8)subgroup);
}
-void Player::RemoveFromBattlegroundRaid()
+void Player::RemoveFromBattlegroundOrBattlefieldRaid()
{
//remove existing reference
m_group.unlink();
@@ -23500,7 +23467,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
{
- sLog->outCrash("Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName());
return;
}
@@ -23516,7 +23483,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
{
- sLog->outCrash("Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName());
return;
}
@@ -23993,7 +23960,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill);
if (!pSkill)
{
- sLog->outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill);
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u has skill %u that does not exist.", GetGUIDLow(), skill);
continue;
}
@@ -24011,7 +23978,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
}
if (value == 0)
{
- sLog->outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL);
@@ -24040,7 +24007,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
if (count >= PLAYER_MAX_SKILLS) // client limit
{
- sLog->outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
break;
}
}
@@ -24208,7 +24175,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
}
//Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
- sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
+ sLog->outDebug(LOG_FILTER_PLAYER, "FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
}
}
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute
@@ -24322,7 +24289,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
uint32 spellid = talentInfo->RankID[talentRank];
if (spellid == 0)
{
- sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
+ sLog->outError(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
return;
}
@@ -24334,7 +24301,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
learnSpell(spellid, false);
AddTalent(spellid, m_activeSpec, true);
- sLog->outDetail("TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec);
+ sLog->outInfo(LOG_FILTER_PLAYER, "TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec);
// update free talent points
SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
@@ -24459,7 +24426,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
uint32 spellid = talentInfo->RankID[talentRank];
if (spellid == 0)
{
- sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
+ sLog->outError(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
return;
}
@@ -24469,7 +24436,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// learn! (other talent ranks will unlearned at learning)
pet->learnSpell(spellid);
- sLog->outDetail("PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
+ sLog->outInfo(LOG_FILTER_PLAYER, "PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
// update free talent points
pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
@@ -24752,7 +24719,13 @@ void Player::SendEquipmentSetList()
data << itr->second.Name;
data << itr->second.IconName;
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
- data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
+ {
+ // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM
+ if (itr->second.IgnoreMask & (1 << i))
+ data.appendPackGUID(uint64(1));
+ else
+ data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
+ }
++count; // client have limit but it checked at loading and set
}
@@ -24777,7 +24750,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
if (!found) // something wrong...
{
- sLog->outError("Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
return;
}
}
@@ -24818,6 +24791,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
stmt->setString(j++, eqset.Name.c_str());
stmt->setString(j++, eqset.IconName.c_str());
+ stmt->setUInt32(j++, eqset.IgnoreMask);
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
stmt->setUInt32(j++, eqset.Items[i]);
stmt->setUInt32(j++, GetGUIDLow());
@@ -24834,6 +24808,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
stmt->setUInt32(j++, index);
stmt->setString(j++, eqset.Name.c_str());
stmt->setString(j++, eqset.IconName.c_str());
+ stmt->setUInt32(j++, eqset.IgnoreMask);
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
stmt->setUInt32(j++, eqset.Items[i]);
trans->Append(stmt);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 1b80b68113f..358eebb7548 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -640,7 +640,7 @@ enum EquipmentSetUpdateState
struct EquipmentSet
{
- EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW)
+ EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
{
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
Items[i] = 0;
@@ -649,6 +649,7 @@ struct EquipmentSet
uint64 Guid;
std::string Name;
std::string IconName;
+ uint32 IgnoreMask;
uint32 Items[EQUIPMENT_SLOT_END];
EquipmentSetUpdateState state;
};
@@ -980,7 +981,7 @@ class TradeData
public: // constructors
TradeData(Player* player, Player* trader) :
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
- m_money(0), m_spell(0) {}
+ m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); }
Player* GetTrader() const { return m_trader; }
TradeData* GetTraderData() const;
@@ -1068,9 +1069,6 @@ class Player : public Unit, public GridObject<Player>
void CleanupsBeforeDelete(bool finalCleanup = true);
- static UpdateMask updateVisualBits;
- static void InitVisibleBits();
-
void AddToWorld();
void RemoveFromWorld();
@@ -1970,6 +1968,7 @@ class Player : public Unit, public GridObject<Player>
StopMirrorTimer(BREATH_TIMER);
StopMirrorTimer(FIRE_TIMER);
}
+ bool IsMirrorTimerActive(MirrorTimerType type) { return m_MirrorTimer[type] == getMaxTimer(type); }
void SetMovement(PlayerMovementType pType);
@@ -2051,9 +2050,9 @@ class Player : public Unit, public GridObject<Player>
inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; }
- void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0);
- uint16 GetDrunkValue() const { return m_drunk; }
- static DrunkenState GetDrunkenstateByValue(uint16 value);
+ void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
+ uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); }
+ static DrunkenState GetDrunkenstateByValue(uint8 value);
uint32 GetDeathTimer() const { return m_deathTimer; }
uint32 GetCorpseReclaimDelay(bool pvp) const;
@@ -2418,9 +2417,9 @@ class Player : public Unit, public GridObject<Player>
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
- // Battleground Group System
- void SetBattlegroundRaid(Group* group, int8 subgroup = -1);
- void RemoveFromBattlegroundRaid();
+ // Battleground / Battlefield Group System
+ void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
+ void RemoveFromBattlegroundOrBattlefieldRaid();
Group* GetOriginalGroup() { return m_originalGroup.getTarget(); }
GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
@@ -2618,9 +2617,6 @@ class Player : public Unit, public GridObject<Player>
void _SaveStats(SQLTransaction& trans);
void _SaveInstanceTimeRestrictions(SQLTransaction& trans);
- void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
- void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
-
/*********************************************************/
/*** ENVIRONMENTAL SYSTEM ***/
/*********************************************************/
@@ -2724,7 +2720,6 @@ class Player : public Unit, public GridObject<Player>
time_t m_lastDailyQuestTime;
uint32 m_drunkTimer;
- uint16 m_drunk;
uint32 m_weaponChangeTimer;
uint32 m_zoneUpdateId;
@@ -2825,7 +2820,6 @@ class Player : public Unit, public GridObject<Player>
uint32 m_lastFallTime;
float m_lastFallZ;
- LiquidTypeEntry const* _lastLiquid;
int32 m_MirrorTimer[MAX_TIMERS];
uint8 m_MirrorTimerFlags;
uint8 m_MirrorTimerFlagsLast;
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 81a505b7acc..88d3108dbe2 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -35,8 +35,7 @@ void MapManager::LoadTransports()
if (!result)
{
- sLog->outString(">> Loaded 0 transports. DB table `transports` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transports. DB table `transports` is empty!");
return;
}
@@ -52,21 +51,21 @@ void MapManager::LoadTransports()
uint32 period = fields[3].GetUInt32();
uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString());
- const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
+ GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
- sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
continue;
}
if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
{
- sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
continue;
}
- // sLog->outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
+ // sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
std::set<uint32> mapsUsed;
@@ -74,7 +73,7 @@ void MapManager::LoadTransports()
if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
// skip transports with empty waypoints list
{
- sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
+ sLog->outError(LOG_FILTER_SQL, "Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
delete t;
continue;
}
@@ -86,7 +85,7 @@ void MapManager::LoadTransports()
float o = 1.0f;
// creates the Gameobject
- if (!t->Create(lowguid, entry, mapid, x, y, z, o, 100, 0))
+ if (!t->Create(lowguid, entry, mapid, x, y, z, o, 255, 0))
{
delete t;
continue;
@@ -116,13 +115,12 @@ void MapManager::LoadTransports()
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
std::string name = fields[2].GetString();
- sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);
+ sLog->outError(LOG_FILTER_SQL, "Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);
}
while (result->NextRow());
}
- sLog->outString(">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void MapManager::LoadTransportNPCs()
@@ -134,8 +132,7 @@ void MapManager::LoadTransportNPCs()
if (!result)
{
- sLog->outString(">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
return;
}
@@ -166,8 +163,7 @@ void MapManager::LoadTransportNPCs()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0),
@@ -197,7 +193,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
if (!IsPositionValid())
{
- sLog->outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_TRANSPORTS, "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, x, y);
return false;
}
@@ -208,17 +204,16 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
if (!goinfo)
{
- sLog->outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
+ sLog->outError(LOG_FILTER_SQL, "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
return false;
}
m_goInfo = goinfo;
- SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
+ SetObjectScale(goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
- //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
- SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
+ SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->entry);
@@ -355,7 +350,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
}
// for (int i = 0; i < keyFrames.size(); ++i) {
- // sLog->outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, "%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo);
// }
// Now we're completely set up; we can move along the length of each waypoint at 100 ms intervals
@@ -398,7 +393,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
cM = keyFrames[i].node->mapid;
}
- // sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, "T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
if (teleport)
m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
}
@@ -446,14 +441,14 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
m_WayPoints[t] = WayPoint(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID);
- // sLog->outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, "T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
t += keyFrames[i + 1].node->delay * 1000;
}
uint32 timer = t;
- // sLog->outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, " Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer);
m_curr = m_WayPoints.begin();
m_next = GetNextWayPoint();
@@ -512,7 +507,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
bool Transport::AddPassenger(Player* passenger)
{
if (m_passengers.insert(passenger).second)
- sLog->outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
+ sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s boarded transport %s.", passenger->GetName(), GetName());
sScriptMgr->OnAddPassenger(this, passenger);
return true;
@@ -521,7 +516,7 @@ bool Transport::AddPassenger(Player* passenger)
bool Transport::RemovePassenger(Player* passenger)
{
if (m_passengers.erase(passenger))
- sLog->outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName());
+ sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s removed from transport %s.", passenger->GetName(), GetName());
sScriptMgr->OnRemovePassenger(this, passenger);
return true;
@@ -532,7 +527,7 @@ void Transport::Update(uint32 p_diff)
if (!AI())
{
if (!AIM_Initialize())
- sLog->outError("Could not initialize GameObjectAI for Transport");
+ sLog->outError(LOG_FILTER_TRANSPORTS, "Could not initialize GameObjectAI for Transport");
} else
AI()->UpdateAI(p_diff);
@@ -657,10 +652,11 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
o + GetOrientation());
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
+ creature->SetTransportHomePosition(creature->m_movementInfo.t_pos);
if (!creature->IsPositionValid())
{
- sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
+ sLog->outError(LOG_FILTER_TRANSPORTS, "Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
delete creature;
return 0;
}
@@ -699,11 +695,33 @@ void Transport::UpdateNPCPositions()
Creature* npc = *itr;
float x, y, z, o;
- o = GetOrientation() + npc->m_movementInfo.t_pos.m_orientation;
- x = GetPositionX() + (npc->m_movementInfo.t_pos.m_positionX * cos(GetOrientation()) + npc->m_movementInfo.t_pos.m_positionY * sin(GetOrientation() + M_PI));
- y = GetPositionY() + (npc->m_movementInfo.t_pos.m_positionY * cos(GetOrientation()) + npc->m_movementInfo.t_pos.m_positionX * sin(GetOrientation()));
- z = GetPositionZ() + npc->m_movementInfo.t_pos.m_positionZ;
- npc->SetHomePosition(x, y, z, o);
+ npc->m_movementInfo.t_pos.GetPosition(x, y, z, o);
+ CalculatePassengerPosition(x, y, z, o);
GetMap()->CreatureRelocation(npc, x, y, z, o, false);
+ npc->GetTransportHomePosition(x, y, z, o);
+ CalculatePassengerPosition(x, y, z, o);
+ npc->SetHomePosition(x, y, z, o);
}
}
+
+//! This method transforms supplied transport offsets into global coordinates
+void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
+{
+ float inx = x, iny = y, inz = z, ino = o;
+ o = GetOrientation() + ino;
+ x = GetPositionX() + (inx * cos(GetOrientation()) + iny * sin(GetOrientation() + M_PI));
+ y = GetPositionY() + (iny * cos(GetOrientation()) + inx * sin(GetOrientation()));
+ z = GetPositionZ() + inz;
+}
+
+//! This method transforms supplied global coordinates into local offsets
+void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
+{
+ o -= GetOrientation();
+ z -= GetPositionZ();
+ y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
+ x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
+ float inx = x, iny = y;
+ y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) - sin(GetOrientation() + M_PI) * tan(GetOrientation()));
+ x = (inx - iny * sin(GetOrientation() + M_PI) / cos(GetOrientation())) / (cos(GetOrientation()) - tan(GetOrientation()) * sin(GetOrientation() + M_PI));
+}
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index 518dcf6359d..4b0c42c9071 100755
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -47,6 +47,8 @@ class Transport : public GameObject
uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0);
void UpdatePosition(MovementInfo* mi);
void UpdateNPCPositions();
+ void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+ void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
void BuildStartMovePacket(Map const* targetMap);
void BuildStopMovePacket(Map const* targetMap);
uint32 GetScriptId() const { return ScriptId; }
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 69771129ac9..5cec0cf4375 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -142,13 +142,13 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply)
void Player::UpdateSpellDamageAndHealingBonus()
{
- // Magic damage modifiers implemented in Unit::SpellDamageBonus
+ // Magic damage modifiers implemented in Unit::SpellDamageBonusDone
// This information for client side use only
// Get healing bonus for all schools
- SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonus(SPELL_SCHOOL_MASK_ALL));
+ SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL));
// Get damage bonus for all schools
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonus(SpellSchoolMask(1 << i)));
+ SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)));
}
bool Player::UpdateAllStats()
@@ -1068,6 +1068,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
#define ENTRY_TREANT 1964
#define ENTRY_FIRE_ELEMENTAL 15438
#define ENTRY_GHOUL 26125
+#define ENTRY_BLOODWORM 28017
bool Guardian::UpdateStats(Stats stat)
{
@@ -1229,6 +1230,7 @@ void Guardian::UpdateMaxHealth()
case ENTRY_SUCCUBUS: multiplicator = 9.1f; break;
case ENTRY_FELHUNTER: multiplicator = 9.5f; break;
case ENTRY_FELGUARD: multiplicator = 11.0f; break;
+ case ENTRY_BLOODWORM: multiplicator = 1.0f; break;
default: multiplicator = 10.0f; break;
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 69c2961691a..2ba3b4e8c06 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -56,6 +56,9 @@
#include "MoveSplineInit.h"
#include "MoveSpline.h"
#include "ConditionMgr.h"
+#include "UpdateFieldFlags.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#include <math.h>
@@ -252,6 +255,7 @@ m_HostileRefManager(this)
_focusSpell = NULL;
_targetLocked = false;
+ _lastLiquid = NULL;
}
////////////////////////////////////////////////////////////
@@ -395,10 +399,25 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
m_movesplineTimer.Reset(POSITION_UPDATE_DELAY);
Movement::Location loc = movespline->ComputePosition();
- if (GetTypeId() == TYPEID_PLAYER)
- ((Player*)this)->UpdatePosition(loc.x,loc.y,loc.z,loc.orientation);
- else
- GetMap()->CreatureRelocation((Creature*)this,loc.x,loc.y,loc.z,loc.orientation);
+ if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
+ {
+ Position& pos = m_movementInfo.t_pos;
+ pos.m_positionX = loc.x;
+ pos.m_positionY = loc.y;
+ pos.m_positionZ = loc.z;
+ pos.m_orientation = loc.orientation;
+ if (Unit* vehicle = GetVehicleBase())
+ {
+ loc.x += vehicle->GetPositionX();
+ loc.y += vehicle->GetPositionY();
+ loc.z += vehicle->GetPositionZMinusOffset();
+ loc.orientation = vehicle->GetOrientation();
+ }
+ else if (Transport* trans = GetTransport())
+ trans->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
+ }
+
+ UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
}
}
@@ -408,50 +427,6 @@ void Unit::DisableSpline()
movespline->_Interrupt();
}
-void Unit::SendMonsterMoveExitVehicle(Position const* newPos)
-{
- WorldPacket data(SMSG_MONSTER_MOVE, 1+12+4+1+4+4+4+12+GetPackGUID().size());
- data.append(GetPackGUID());
-
- data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // new in 3.1, bool
- data << GetPositionX() << GetPositionY() << GetPositionZ();
- data << getMSTime();
-
- data << uint8(SPLINETYPE_FACING_ANGLE);
- data << float(GetOrientation()); // guess
- data << uint32(SPLINEFLAG_EXIT_VEHICLE);
- data << uint32(0); // Time in between points
- data << uint32(1); // 1 single waypoint
- data << newPos->GetPositionX();
- data << newPos->GetPositionY();
- data << newPos->GetPositionZ();
-
- SendMessageToSet(&data, true);
-}
-
-void Unit::SendMonsterMoveTransport(Unit* vehicleOwner)
-{
- // TODO: Turn into BuildMonsterMoveTransport packet and allow certain variables (for npc movement aboard vehicles)
- WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size() + 47);
- data.append(GetPackGUID());
- data.append(vehicleOwner->GetPackGUID());
- data << int8(GetTransSeat());
- data << uint8(0);
- data << GetPositionX() - vehicleOwner->GetPositionX();
- data << GetPositionY() - vehicleOwner->GetPositionY();
- data << GetPositionZ() - vehicleOwner->GetPositionZ();
- data << uint32(getMSTime()); // should be an increasing constant that indicates movement packet count
- data << uint8(SPLINETYPE_FACING_ANGLE);
- data << GetTransOffsetO(); // facing angle?
- data << uint32(SPLINEFLAG_TRANSPORT);
- data << uint32(GetTransTime()); // move time
- data << uint32(1); // amount of waypoints
- data << uint32(0); // waypoint X
- data << uint32(0); // waypoint Y
- data << uint32(0); // waypoint Z
- SendMessageToSet(&data, true);
-}
-
void Unit::resetAttackTimer(WeaponAttackType type)
{
m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]);
@@ -459,7 +434,7 @@ void Unit::resetAttackTimer(WeaponAttackType type)
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
{
- if (!obj || !IsInMap(obj))
+ if (!obj || !IsInMap(obj) || !InSamePhase(obj))
return false;
float dx = GetPositionX() - obj->GetPositionX();
@@ -475,7 +450,7 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
{
- if (!obj || !IsInMap(obj))
+ if (!obj || !IsInMap(obj) || !InSamePhase(obj))
return false;
float dx = GetPositionX() - obj->GetPositionX();
@@ -555,13 +530,7 @@ void Unit::DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb)
if (absorb)
*absorb += damage;
damage = 0;
- return;
}
-
- uint32 originalDamage = damage;
-
- if (absorb && originalDamage > damage)
- *absorb += (originalDamage - damage);
}
uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
@@ -662,10 +631,10 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
return 0;
}
- sLog->outStaticDebug("DealDamageStart");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageStart");
uint32 health = victim->GetHealth();
- sLog->outDetail("deal dmg:%d to health:%d ", damage, health);
+ sLog->outInfo(LOG_FILTER_UNITS, "deal dmg:%d to health:%d ", damage, health);
// duel ends when player has 1 or less hp
bool duel_hasEnded = false;
@@ -719,7 +688,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (health <= damage)
{
- sLog->outStaticDebug("DealDamage: victim just died");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamage: victim just died");
if (victim->GetTypeId() == TYPEID_PLAYER && victim != this)
{
@@ -734,7 +703,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
}
else
{
- sLog->outStaticDebug("DealDamageAlive");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageAlive");
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage);
@@ -818,7 +787,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
}
}
- sLog->outStaticDebug("DealDamageEnd returned %d damage", damage);
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageEnd returned %d damage", damage);
return damage;
}
@@ -834,15 +803,10 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo
{
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
- // TODO: this is a workaround and needs removal
- if (!originalCaster && GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem() && IsControlledByPlayer())
- if (Unit* owner = GetOwner())
- originalCaster=owner->GetGUID();
-
// TODO: this is a workaround - not needed anymore, but required for some scripts :(
if (!originalCaster && triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID();
@@ -867,7 +831,7 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -910,7 +874,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
SpellCastTargets targets;
@@ -924,7 +888,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
SpellCastTargets targets;
@@ -938,7 +902,7 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
SpellCastTargets targets;
@@ -952,7 +916,9 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask);
- damage = SpellDamageBonus(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE);
+ damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE);
+ damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE);
+
CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
SendSpellNonMeleeDamageLog(&damageInfo);
@@ -1147,7 +1113,8 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damage += CalculateDamage(damageInfo->attackType, false, true);
// Add melee damage bonus
- MeleeDamageBonus(damageInfo->target, &damage, damageInfo->attackType);
+ damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType);
+ damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType);
// Calculate armor reduction
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
@@ -1399,7 +1366,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
uint32 damage = (*dmgShieldItr)->GetAmount();
if (Unit* caster = (*dmgShieldItr)->GetCaster())
- damage = caster->SpellDamageBonus(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
+ {
+ damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
+ damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
+ }
// No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that
victim->DealDamageMods(this, damage, NULL);
@@ -1542,7 +1512,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
// Magic damage, check for resists
// Ignore spells that cant be resisted
- if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0))
+ if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (!spellInfo || (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0))
{
float victimResistance = float(victim->GetResistance(schoolMask));
victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
@@ -1913,10 +1883,10 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext
DealMeleeDamage(&damageInfo, true);
if (GetTypeId() == TYPEID_PLAYER)
- sLog->outStaticDebug("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
+ sLog->outDebug(LOG_FILTER_UNITS, "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
else
- sLog->outStaticDebug("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
+ sLog->outDebug(LOG_FILTER_UNITS, "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
}
}
@@ -1947,7 +1917,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy
float parry_chance = victim->GetUnitParryChance();
// Useful if want to specify crit & miss chances for melee, else it could be removed
- sLog->outStaticDebug("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
+ sLog->outDebug(LOG_FILTER_UNITS, "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance*100), int32(miss_chance*100), int32(dodge_chance*100), int32(parry_chance*100), int32(block_chance*100));
}
@@ -1968,22 +1938,22 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
int32 sum = 0, tmp = 0;
int32 roll = urand (0, 10000);
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus);
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d",
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d",
roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
tmp = miss_chance;
if (tmp > 0 && roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: MISS");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: MISS");
return MELEE_HIT_MISS;
}
// always crit against a sitting target (except 0 crit chance)
if (victim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !victim->IsStandState())
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT (sitting victim)");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT (sitting victim)");
return MELEE_HIT_CRIT;
}
@@ -1992,7 +1962,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// only players can't dodge if attacker is behind
if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
}
else
{
@@ -2011,7 +1981,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
&& ((tmp -= skillBonus) > 0)
&& roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum);
return MELEE_HIT_DODGE;
}
}
@@ -2020,7 +1990,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind.");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind.");
else
{
// Reduce parry chance by attacker expertise rating
@@ -2036,7 +2006,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
&& (tmp2 -= skillBonus) > 0
&& roll < (sum += tmp2))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
return MELEE_HIT_PARRY;
}
}
@@ -2048,7 +2018,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
&& (tmp -= skillBonus) > 0
&& roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum);
return MELEE_HIT_BLOCK;
}
}
@@ -2059,9 +2029,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
if (tmp > 0 && roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT DISABLED)");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT DISABLED)");
else
return MELEE_HIT_CRIT;
}
@@ -2081,7 +2051,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
tmp = tmp > 4000 ? 4000 : tmp;
if (roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum);
return MELEE_HIT_GLANCING;
}
}
@@ -2105,13 +2075,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
tmp = tmp * 200 - 1500;
if (roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum);
return MELEE_HIT_CRUSHING;
}
}
}
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: NORMAL");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: NORMAL");
return MELEE_HIT_NORMAL;
}
@@ -2176,7 +2146,7 @@ void Unit::SendMeleeAttackStart(Unit* victim)
data << uint64(GetGUID());
data << uint64(victim->GetGUID());
SendMessageToSet(&data, true);
- sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART");
+ sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTART");
}
void Unit::SendMeleeAttackStop(Unit* victim)
@@ -2186,12 +2156,12 @@ void Unit::SendMeleeAttackStop(Unit* victim)
data.append(victim ? victim->GetPackGUID() : 0);
data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation
SendMessageToSet(&data, true);
- sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP");
+ sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTOP");
if (victim)
- sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_UNITS, "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
else
- sLog->outDetail("%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_UNITS, "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow());
}
bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType)
@@ -2361,7 +2331,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
case MELEE_HIT_BLOCK: canBlock = false; break;
case MELEE_HIT_PARRY: canParry = false; break;
default:
- sLog->outStaticDebug("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
+ sLog->outDebug(LOG_FILTER_UNITS, "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
break;
}
}
@@ -2487,12 +2457,12 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell)
// Chance resist debuff
if (!spell->IsPositive())
{
- bool bNegativeAura = false;
+ bool bNegativeAura = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spell->Effects[i].ApplyAuraName != 0)
+ if (spell->Effects[i].ApplyAuraName == 0)
{
- bNegativeAura = true;
+ bNegativeAura = false;
break;
}
}
@@ -2915,9 +2885,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
m_AutoRepeatFirstCast = true;
}
- AddUnitState(UNIT_STATE_CASTING);
- } break;
+ if (pSpell->m_spellInfo->CalcCastTime(this) > 0)
+ AddUnitState(UNIT_STATE_CASTING);
+ break;
+ }
case CURRENT_CHANNELED_SPELL:
{
// channel spells always break generic non-delayed and any channeled spells
@@ -2929,8 +2901,9 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
AddUnitState(UNIT_STATE_CASTING);
- } break;
+ break;
+ }
case CURRENT_AUTOREPEAT_SPELL:
{
// only Auto Shoot does not break anything
@@ -2942,12 +2915,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
}
// special action: set first cast flag
m_AutoRepeatFirstCast = true;
- } break;
+ break;
+ }
default:
- {
- // other spell types don't break anything now
- } break;
+ break; // other spell types don't break anything now
}
// current spell (if it is still here) may be safely deleted now
@@ -3089,6 +3061,48 @@ bool Unit::IsUnderWater() const
return GetBaseMap()->IsUnderWater(GetPositionX(), GetPositionY(), GetPositionZ());
}
+void Unit::UpdateUnderwaterState(Map* m, float x, float y, float z)
+{
+ if (!isPet() && !IsVehicle())
+ return;
+
+ LiquidData liquid_status;
+ ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status);
+ if (!res)
+ {
+ if (_lastLiquid && _lastLiquid->SpellId)
+ RemoveAurasDueToSpell(_lastLiquid->SpellId);
+
+ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
+ _lastLiquid = NULL;
+ return;
+ }
+
+ if (uint32 liqEntry = liquid_status.entry)
+ {
+ LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry);
+ if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry)
+ RemoveAurasDueToSpell(_lastLiquid->SpellId);
+
+ if (liquid && liquid->SpellId)
+ {
+ if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER))
+ CastSpell(this, liquid->SpellId, true);
+ else
+ RemoveAurasDueToSpell(liquid->SpellId);
+ }
+
+ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER);
+ _lastLiquid = liquid;
+ }
+ else if (_lastLiquid && _lastLiquid->SpellId)
+ {
+ RemoveAurasDueToSpell(_lastLiquid->SpellId);
+ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
+ _lastLiquid = NULL;
+ }
+}
+
void Unit::DeMorph()
{
SetDisplayId(GetNativeDisplayId());
@@ -3580,83 +3594,6 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
// Call AfterDispel hook on AuraScript
aura->CallScriptAfterDispel(&dispelInfo);
- switch (aura->GetSpellInfo()->SpellFamilyName)
- {
- case SPELLFAMILY_WARLOCK:
- {
- // Unstable Affliction (crash if before removeaura?)
- if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x0100)
- {
- Unit* caster = aura->GetCaster();
- if (!caster)
- break;
- if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_0))
- {
- int32 damage = aurEff->GetAmount() * 9;
- // backfire damage and silence
- caster->CastCustomSpell(dispeller, 31117, &damage, NULL, NULL, true, NULL, aurEff);
- }
- }
- break;
- }
- case SPELLFAMILY_DRUID:
- {
- // Lifebloom
- if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
- {
- if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_1))
- {
- // final heal
- int32 healAmount = aurEff->GetAmount();
- int32 stack = dispelInfo.GetRemovedCharges();
- CastCustomSpell(this, 33778, &healAmount, &stack, NULL, true, NULL, NULL, aura->GetCasterGUID());
-
- // mana
- if (Unit* caster = aura->GetCaster())
- {
- int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellInfo()->ManaCostPercentage) * chargesRemoved / 2;
- caster->CastCustomSpell(caster, 64372, &mana, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID());
- }
- }
- }
- break;
- }
- case SPELLFAMILY_SHAMAN:
- {
- // Flame Shock
- if (aura->GetSpellInfo()->SpellFamilyFlags[0] & 0x10000000)
- {
- if (Unit* caster = aura->GetCaster())
- {
- uint32 triggeredSpellId = 0;
- // Lava Flows
- if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 3087, 0))
- {
- switch (aurEff->GetId())
- {
- case 51482: // Rank 3
- triggeredSpellId = 65264;
- break;
- case 51481: // Rank 2
- triggeredSpellId = 65263;
- break;
- case 51480: // Rank 1
- triggeredSpellId = 64694;
- break;
- default:
- sLog->outError("Unit::RemoveAurasDueToSpellByDispel: Unknown rank of Lava Flows (%d) found", aurEff->GetId());
- }
- }
-
- if (triggeredSpellId)
- caster->CastSpell(caster, triggeredSpellId, true);
- }
- }
- break;
- }
- default:
- break;
- }
return;
}
else
@@ -4499,7 +4436,7 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
AddPctN(multiplier, (*i)->GetAmount());
}
-
+
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
AddPctN(multiplier, itr->second);
@@ -4546,7 +4483,7 @@ int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellInfo const*
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
modifier += (*i)->GetAmount();
}
-
+
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
modifier += itr->second;
@@ -4834,7 +4771,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
data << float(pInfo->multiplier); // gain multiplier
break;
default:
- sLog->outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType()));
+ sLog->outError(LOG_FILTER_UNITS, "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType()));
return;
}
@@ -4995,7 +4932,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!triggerEntry)
{
- sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id);
return false;
}
@@ -5053,7 +4990,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
if (!triggerEntry)
{
- sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
return false;
}
@@ -5695,7 +5632,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 31571: triggered_spell_id = 57529; break;
case 31572: triggered_spell_id = 57531; break;
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id);
return false;
}
break;
@@ -5781,7 +5718,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 12847: basepoints0 = int32(0.16f * damage); break;
case 12848: basepoints0 = int32(0.20f * damage); break;
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
return false;
}
@@ -5817,7 +5754,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID()))
{
// The shield can grow to a maximum size of 20, 000 damage absorbtion
- aurEff->SetAmount(std::max<int32>(aurEff->GetAmount() + basepoints0, 20000));
+ aurEff->SetAmount(std::min<int32>(aurEff->GetAmount() + basepoints0, 20000));
// Refresh and return to prevent replacing the aura
aurEff->GetBase()->RefreshDuration();
@@ -5899,7 +5836,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 29834: triggered_spell_id=29841; break;
case 42770: triggered_spell_id=42771; break;
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id);
return false;
}
@@ -5999,6 +5936,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Siphon Life
case 63108:
{
+ if (!damage)
+ break;
// Glyph of Siphon Life
if (HasAura(56216))
triggerAmount += triggerAmount / 4;
@@ -6487,7 +6426,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Effect 0 - mod damage while having Enrage
if (effIndex == 0)
{
- if (!(procSpell->SpellFamilyFlags[0] & 0x00080000))
+ if (!(procSpell->SpellFamilyFlags[0] & 0x00080000) || procSpell->SpellIconID != 961)
return false;
triggered_spell_id = 51185;
basepoints0 = triggerAmount;
@@ -6497,7 +6436,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Effect 1 - Tiger's Fury restore energy
else if (effIndex == 1)
{
- if (!(procSpell->SpellFamilyFlags[2] & 0x00000800))
+ if (!(procSpell->SpellFamilyFlags[2] & 0x00000800) || procSpell->SpellIconID != 1181)
return false;
triggered_spell_id = 51178;
basepoints0 = triggerAmount;
@@ -6678,8 +6617,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
triggered_spell_id = 25742;
float ap = GetTotalAttackPowerValue(BASE_ATTACK);
- int32 holy = SpellBaseDamageBonus(SPELL_SCHOOL_MASK_HOLY) +
- SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_HOLY, victim);
+ int32 holy = SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY) +
+ victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY);
basepoints0 = (int32)GetAttackTime(BASE_ATTACK) * int32(ap * 0.022f + 0.044f * holy) / 1000;
break;
}
@@ -7133,7 +7072,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 3787:spellId = 58804; break; // 8 Rank
default:
{
- sLog->outError("Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)",
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)",
castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id);
return false;
}
@@ -7142,7 +7081,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!windfurySpellInfo)
{
- sLog->outError("Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId);
return false;
}
@@ -7311,30 +7250,16 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell->SpellIconID != 2019)
return false;
- AuraEffect* aurEffA = NULL;
- AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
- for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
+ if (Creature* totem = GetMap()->GetCreature(m_SummonSlot[1])) // Fire totem summon slot
{
- SpellInfo const* spell = (*i)->GetSpellInfo();
- if (spell->SpellFamilyName == uint32(SPELLFAMILY_SHAMAN) && spell->SpellFamilyFlags.HasFlag(0, 0x02000000, 0))
+ if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0]))
{
- if ((*i)->GetCasterGUID() != GetGUID())
- continue;
- if (spell->Id == 63283)
- continue;
- aurEffA = (*i);
- break;
+ int32 bp0 = CalculatePctN(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount);
+ int32 bp1 = CalculatePctN(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount);
+ CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true);
+ return true;
}
}
- if (aurEffA)
- {
- int32 bp0 = 0, bp1 = 0;
- bp0 = CalculatePctN(triggerAmount, aurEffA->GetAmount());
- if (AuraEffect* aurEffB = aurEffA->GetBase()->GetEffect(EFFECT_1))
- bp1 = CalculatePctN(triggerAmount, aurEffB->GetAmount());
- CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true, NULL, triggeredByAura);
- return true;
- }
return false;
}
break;
@@ -7353,20 +7278,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 63685;
break;
}
- // Storm, Earth and Fire
- if (dummySpell->SpellIconID == 3063)
- {
- // Earthbind Totem summon only
- if (procSpell->Id != 2484)
- return false;
-
- float chance = (float)triggerAmount;
- if (!roll_chance_f(chance))
- return false;
-
- triggered_spell_id = 64695;
- break;
- }
// Ancestral Awakening
if (dummySpell->SpellIconID == 3065)
{
@@ -7395,8 +7306,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->isAlive() || !castItem || !castItem->IsEquipped())
return false;
- Player* player = ToPlayer();
- WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
+ WeaponAttackType attType = WeaponAttackType(Player::GetAttackBySlot(castItem->GetSlot()));
if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
|| (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
|| (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
@@ -7404,8 +7314,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
- float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE)
- + SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, victim));
+ float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE)
+ + victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_FIRE));
// 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
ApplyPctF(add_spellpower, 3.84f);
@@ -7501,7 +7411,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 49270: spellId = 49268; break; // Rank 7
case 49271: spellId = 49269; break; // Rank 8
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
return false;
}
@@ -7746,17 +7656,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
}
}
- // Item - Death Knight T10 Melee 4P Bonus
- if (dummySpell->Id == 70656)
- {
- Player* player = ToPlayer();
- if (!player)
- return false;
-
- for (uint32 i = 0; i < MAX_RUNES; ++i)
- if (player->GetRuneCooldown(i) == 0)
- return false;
- }
break;
}
case SPELLFAMILY_POTION:
@@ -7826,7 +7725,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
- sLog->outError("Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7884,7 +7783,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
// Try handle unknown trigger spells
if (!triggerEntry)
{
- sLog->outError("Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7937,7 +7836,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
if (!triggerEntry)
{
- sLog->outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7984,11 +7883,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
for (uint8 i = 1; i < stack; ++i)
dmg += mod * stack;
if (Unit* caster = triggeredByAura->GetCaster())
- {
caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg);
- if (Creature* creature = caster->ToCreature())
- creature->DespawnOrUnsummon(1);
- }
break;
}
// Ball of Flames Proc
@@ -8028,7 +7923,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
*handled = true;
if (victim && victim->HasAura(53601))
{
- int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2]. CalcValue());
+ int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue());
// Item - Paladin T9 Holy 4P Bonus
if (AuraEffect const* aurEff = GetAuraEffect(67191, 0))
AddPctN(bp0, aurEff->GetAmount());
@@ -8199,6 +8094,16 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true);
break;
}
+ // Recklessness
+ case 1719:
+ {
+ //! Possible hack alert
+ //! Don't drop charges on proc, they will be dropped on SpellMod removal
+ //! Before this change, it was dropping two charges per attack, one in ProcDamageAndSpellFor, and one in RemoveSpellMods.
+ //! The reason of this behaviour is Recklessness having three auras, 2 of them can not proc (isTriggeredAura array) but the other one can, making the whole spell proc.
+ *handled = true;
+ break;
+ }
default:
break;
}
@@ -8298,6 +8203,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
CastSpell(victim, 27526, true, castItem, triggeredByAura);
return true;
}
+ // Evasive Maneuvers
+ case 50240:
+ {
+ // Remove a Evasive Charge
+ Aura* charge = GetAura(50241);
+ if (charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
+ RemoveAurasDueToSpell(50240);
+ }
}
break;
case SPELLFAMILY_MAGE:
@@ -8310,7 +8223,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
trigger_spell_id = 31643;
break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id);
return false;
}
}
@@ -8322,6 +8235,12 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
RemoveAuraFromStack(auraSpellInfo->Id);
return false;
}
+ if (auraSpellInfo->Id == 50720)
+ {
+ target = triggeredByAura->GetCaster();
+ if (!target)
+ return false;
+ }
break;
case SPELLFAMILY_WARLOCK:
{
@@ -8380,7 +8299,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 27815: trigger_spell_id = 27817; break;
case 27816: trigger_spell_id = 27818; break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id);
return false;
}
basepoints0 = CalculatePctN(int32(damage), triggerAmount) / 3;
@@ -8440,7 +8359,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
trigger_spell_id = 63468;
break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id);
return false;
}
SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id);
@@ -8553,14 +8472,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 48820: originalSpellId = 48824; break;
case 48821: originalSpellId = 48825; break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id);
return false;
}
}
SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId);
if (!originalSpell)
{
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId);
return false;
}
// percent stored in effect 1 (class scripts) base points
@@ -8672,6 +8591,16 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
trigger_spell_id = 50475;
basepoints0 = CalculatePctN(int32(damage), triggerAmount);
}
+ // Item - Death Knight T10 Melee 4P Bonus
+ else if (auraSpellInfo->Id == 70656)
+ {
+ if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT)
+ return false;
+
+ for (uint8 i = 0; i < MAX_RUNES; ++i)
+ if (ToPlayer()->GetRuneCooldown(i) == 0)
+ return false;
+ }
break;
}
case SPELLFAMILY_ROGUE:
@@ -8704,7 +8633,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if (triggerEntry == NULL)
{
// Don't cast unknown spell
- // sLog->outError("Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
+ // sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
return false;
}
@@ -8936,12 +8865,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
CastSpell(this, 70721, true);
break;
}
- // Bloodthirst (($m/100)% of max health)
- case 23880:
- {
- basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
- break;
- }
// Shamanistic Rage triggered spell
case 30824:
{
@@ -8964,7 +8887,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0))
{
- basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonus(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right?
+ basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonusDone(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right?
CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura);
return true;
}
@@ -9219,7 +9142,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au
if (!triggerEntry)
{
- sLog->outError("Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId);
return false;
}
@@ -9286,11 +9209,11 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
if (GetGUID() != guid)
{
if (Player const* player = ToPlayer())
- sLog->outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
+ sLog->outError(LOG_FILTER_UNITS, "Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
else if (Creature const* creature = ToCreature())
- sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
else
- sLog->outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction());
+ sLog->outError(LOG_FILTER_UNITS, "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction());
guid = GetGUID();
}
@@ -9551,7 +9474,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
if (this->GetTypeId() == TYPEID_PLAYER)
{
Pet* playerPet = this->ToPlayer()->GetPet();
-
+
if (playerPet && playerPet->isAlive())
playerPet->AI()->OwnerAttacked(victim);
}
@@ -9638,7 +9561,7 @@ void Unit::RemoveAllAttackers()
AttackerSet::iterator iter = m_attackers.begin();
if (!(*iter)->AttackStop())
{
- sLog->outError("WORLD: Unit has an attacker that isn't attacking it!");
+ sLog->outError(LOG_FILTER_UNITS, "WORLD: Unit has an attacker that isn't attacking it!");
m_attackers.erase(iter);
}
}
@@ -9738,6 +9661,31 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co
return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
}
+void Unit::SetOwnerGUID(uint64 owner)
+{
+ if (GetOwnerGUID() == owner)
+ return;
+
+ SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner);
+ if (!owner)
+ return;
+
+ // Update owner dependent fields
+ Player* player = ObjectAccessor::GetPlayer(*this, owner);
+ if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
+ return;
+
+ SetFieldNotifyFlag(UF_FLAG_OWNER);
+
+ UpdateData udata;
+ WorldPacket packet;
+ BuildValuesUpdateBlockForPlayer(&udata, player);
+ udata.BuildPacket(&packet);
+ player->SendDirectMessage(&packet);
+
+ RemoveFieldNotifyFlag(UF_FLAG_OWNER);
+}
+
Unit* Unit::GetOwner() const
{
if (uint64 ownerid = GetOwnerGUID())
@@ -9781,7 +9729,7 @@ Minion *Unit::GetFirstMinion() const
if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
return (Minion*)pet;
- sLog->outError("Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid));
+ sLog->outError(LOG_FILTER_UNITS, "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid));
const_cast<Unit*>(this)->SetMinionGUID(0);
}
@@ -9796,7 +9744,7 @@ Guardian* Unit::GetGuardianPet() const
if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
return (Guardian*)pet;
- sLog->outCrash("Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
const_cast<Unit*>(this)->SetPetGUID(0);
}
@@ -9810,7 +9758,7 @@ Unit* Unit::GetCharm() const
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
return pet;
- sLog->outError("Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid));
+ sLog->outError(LOG_FILTER_UNITS, "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid));
const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0);
}
@@ -9823,12 +9771,14 @@ void Unit::SetMinion(Minion *minion, bool apply)
if (apply)
{
- if (!minion->AddUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()))
+ if (minion->GetOwnerGUID())
{
- sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
return;
}
+ minion->SetOwnerGUID(GetGUID());
+
m_Controlled.insert(minion);
if (GetTypeId() == TYPEID_PLAYER)
@@ -9897,7 +9847,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
{
if (minion->GetOwnerGUID() != GetGUID())
{
- sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
return;
}
@@ -10009,7 +9959,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- sLog->outCrash("Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
charm->m_ControlledByPlayer = true;
// TODO: maybe we can use this flag to check if controlled by player
@@ -10022,7 +9972,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- sLog->outCrash("Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
{
@@ -10037,11 +9987,11 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- sLog->outCrash("Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
}
if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- sLog->outCrash("Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
if (charm->GetTypeId() == TYPEID_PLAYER)
{
@@ -10117,7 +10067,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
Unit::AuraEffectList const& magnetAuras = victim->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET);
for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
{
- if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
+ if (Unit* magnet = (*itr)->GetBase()->GetCaster())
if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
&& _IsValidAttackTarget(magnet, spellInfo)
@@ -10154,7 +10104,7 @@ Unit* Unit::GetFirstControlled() const
// Sequence: charmed, pet, other guardians
Unit* unit = GetCharm();
if (!unit)
- if (uint64 guid = GetUInt64Value(UNIT_FIELD_SUMMON))
+ if (uint64 guid = GetMinionGUID())
unit = ObjectAccessor::GetUnit(*this, guid);
return unit;
@@ -10175,14 +10125,14 @@ void Unit::RemoveAllControlled()
else if (target->GetOwnerGUID() == GetGUID() && target->isSummon())
target->ToTempSummon()->UnSummon();
else
- sLog->outError("Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
}
if (GetPetGUID())
- sLog->outCrash("Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID());
if (GetMinionGUID())
- sLog->outCrash("Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID());
if (GetCharmGUID())
- sLog->outCrash("Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID());
}
Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
@@ -10331,7 +10281,7 @@ void Unit::EnergizeBySpell(Unit* victim, uint32 spellID, uint32 damage, Powers p
victim->getHostileRefManager().threatAssist(this, float(damage) * 0.5f, spellInfo);
}
-uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
+uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
{
if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
return pdamage;
@@ -10344,33 +10294,35 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
// For totems get damage bonus from owner
if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem())
if (Unit* owner = GetOwner())
- return owner->SpellDamageBonus(victim, spellProto, pdamage, damagetype);
+ return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype);
- // Taken/Done total percent damage auras
+ // Done total percent damage auras
float DoneTotalMod = 1.0f;
float ApCoeffMod = 1.0f;
int32 DoneTotal = 0;
- int32 TakenTotal = 0;
- // ..done
// Pet damage?
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
- AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
+ // Some spells don't benefit from pct done mods
+ if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162)))
{
- 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())
+ AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
{
- if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
- else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
- else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ 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)
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
}
}
@@ -10550,7 +10502,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
break;
}
}
- break;
+ break;
case SPELLFAMILY_PRIEST:
// Mind Flay
if (spellProto->SpellFamilyFlags[0] & 0x800000)
@@ -10583,7 +10535,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
AddPctN(DoneTotalMod, aurEff->GetAmount());
}
- break;
+ break;
case SPELLFAMILY_PALADIN:
// Judgement of Vengeance/Judgement of Corruption
if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292)
@@ -10601,7 +10553,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
if (stacks)
AddPctU(DoneTotalMod, 10 * stacks);
}
- break;
+ break;
case SPELLFAMILY_DRUID:
// Thorns
if (spellProto->SpellFamilyFlags[0] & 0x100)
@@ -10610,7 +10562,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
AddPctN(DoneTotalMod, aurEff->GetAmount());
}
- break;
+ break;
case SPELLFAMILY_WARLOCK:
// Fire and Brimstone
if (spellProto->SpellFamilyFlags[1] & 0x00020040)
@@ -10632,14 +10584,14 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet())
if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
AddPctN(DoneTotalMod, 15 * count);
- break;
+ break;
case SPELLFAMILY_HUNTER:
// Steady Shot
if (spellProto->SpellFamilyFlags[1] & 0x1)
if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
AddPctN(DoneTotalMod, aurEff->GetAmount());
- break;
+ break;
case SPELLFAMILY_DEATHKNIGHT:
// Improved Icy Touch
if (spellProto->SpellFamilyFlags[0] & 0x2)
@@ -10680,53 +10632,11 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
}
}
}
- break;
- }
-
- // ..taken
- float TakenTotalMod = 1.0f;
-
- // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
- // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
- TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask());
-
- // .. taken pct: dummy auras
- AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
- for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
- {
- switch ((*i)->GetSpellInfo()->SpellIconID)
- {
- // Cheat Death
- case 2109:
- if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
- {
- if (victim->GetTypeId() != TYPEID_PLAYER)
- continue;
- float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
- AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
- }
- break;
- }
- }
-
- // From caster spells
- AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
- for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
- if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
-
- // Mod damage from spell mechanic
- if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
- {
- AuraEffectList const& mDamageDoneMechanic = victim->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())))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ break;
}
- // Taken/Done fixed damage bonus auras
- int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(spellProto->GetSchoolMask());
- int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(spellProto->GetSchoolMask(), victim);
+ // 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))
@@ -10743,7 +10653,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
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);
+ 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);
}
@@ -10754,74 +10664,20 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
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);
+ 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 || TakenAdvertisedBenefit)
+ if (DoneAdvertisedBenefit)
{
if (!bonus || coeff < 0)
- {
- // Damage Done from spell damage bonus
- int32 CastingTime = spellProto->IsChanneled() ? spellProto->GetDuration() : spellProto->CalcCastTime();
- // Damage over Time spells bonus calculation
- float DotFactor = 1.0f;
- if (damagetype == DOT)
- {
- int32 DotDuration = spellProto->GetDuration();
- // 200% limit
- if (DotDuration > 0)
- {
- if (DotDuration > 30000)
- DotDuration = 30000;
- if (!spellProto->IsChanneled())
- DotFactor = DotDuration / 15000.0f;
- uint8 x = 0;
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && (
- spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
- spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
- {
- x = j;
- break;
- }
- }
- int32 DotTicks = 6;
- if (spellProto->Effects[x].Amplitude != 0)
- DotTicks = DotDuration / spellProto->Effects[x].Amplitude;
- if (DotTicks)
- {
- DoneAdvertisedBenefit /= DotTicks;
- TakenAdvertisedBenefit /= DotTicks;
- }
- }
- }
- // Distribute Damage over multiple effects, reduce by AoE
- CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime);
-
- // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
- (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
- {
- CastingTime /= 2;
- break;
- }
- }
- if (spellProto->SchoolMask != SPELL_SCHOOL_MASK_NORMAL)
- coeff = (CastingTime / 3500.0f) * DotFactor;
- else
- coeff = DotFactor;
- }
+ coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
float factorMod = CalculateLevelPenalty(spellProto) * stack;
- // level penalty still applied on Taken bonus - is it blizzlike?
- TakenTotal+= int32(TakenAdvertisedBenefit * factorMod);
+
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
@@ -10838,27 +10694,118 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
DoneTotalMod = 1.0f;
}
- // Some spells don't benefit from pct done mods
- // maybe should be implemented like SPELL_ATTR3_NO_DONE_BONUS,
- // but then it may break spell power coeffs work on spell 31117
- if (spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)
- DoneTotalMod = 1.0f;
-
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);
- tmpDamage = (tmpDamage + TakenTotal) * TakenTotalMod;
+ return uint32(std::max(tmpDamage, 0.0f));
+}
+
+uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
+{
+ if (!spellProto || damagetype == DIRECT_DAMAGE)
+ return pdamage;
+
+ int32 TakenTotal = 0;
+ 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)
+ {
+ if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
+ TakenTotalCasterMod += (float((*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)
+ {
+ switch ((*i)->GetSpellInfo()->SpellIconID)
+ {
+ // Cheat Death
+ case 2109:
+ if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
+ {
+ if (GetTypeId() != TYPEID_PLAYER)
+ continue;
+ float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
+ AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
+ }
+ break;
+ }
+ }
+
+ // 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))
+ AddPctN(TakenTotalMod, (*i)->GetAmount());
+
+ // 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())))
+ AddPctN(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;
+
+ // Default calculation
+ if (TakenAdvertisedBenefit)
+ {
+ if (!bonus || coeff < 0)
+ coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
+
+ float factorMod = CalculateLevelPenalty(spellProto) * stack;
+ // level penalty still applied on Taken bonus - is it blizzlike?
+ if (Player* modOwner = GetSpellModOwner())
+ {
+ coeff *= 100.0f;
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ coeff /= 100.0f;
+ }
+ TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod);
+ }
+
+ float tmpDamage = 0.0f;
+
+ if (TakenTotalCasterMod)
+ {
+ if (TakenTotal < 0)
+ {
+ if (TakenTotalMod < 1)
+ tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod));
+ else
+ tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
+ }
+ else if (TakenTotalMod < 1)
+ tmpDamage = ((CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod));
+ }
+ if (!tmpDamage)
+ tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
return uint32(std::max(tmpDamage, 0.0f));
}
-int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask)
+int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
{
int32 DoneAdvertisedBenefit = 0;
- // ..done
AuraEffectList const& mDamageDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
if (((*i)->GetMiscValue() & schoolMask) != 0 &&
@@ -10891,27 +10838,19 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask)
DoneAdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
}
- return DoneAdvertisedBenefit > 0 ? DoneAdvertisedBenefit : 0;
+ return DoneAdvertisedBenefit;
}
-int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* victim)
+int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask)
{
- uint32 creatureTypeMask = victim->GetCreatureTypeMask();
-
int32 TakenAdvertisedBenefit = 0;
- // ..done (for creature type by mask) in taken
- AuraEffectList const& mDamageDoneCreature = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
- for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i)
- if (creatureTypeMask & uint32((*i)->GetMiscValue()))
- TakenAdvertisedBenefit += (*i)->GetAmount();
- // ..taken
- AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
+ AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
if (((*i)->GetMiscValue() & schoolMask) != 0)
TakenAdvertisedBenefit += (*i)->GetAmount();
- return TakenAdvertisedBenefit > 0 ? TakenAdvertisedBenefit : 0;
+ return TakenAdvertisedBenefit;
}
bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
@@ -10935,6 +10874,8 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
case 379: // Earth Shield
case 33778: // Lifebloom Final Bloom
case 64844: // Divine Hymn
+ case 71607: // Item - Bauble of True Blood 10m
+ case 71646: // Item - Bauble of True Blood 25m
break;
default:
return false;
@@ -11175,23 +11116,19 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag
return damage;
}
-uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
+uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
{
// For totems get healing bonus from owner (statue isn't totem in fact)
- if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem())
+ if (GetTypeId() == TYPEID_UNIT && isTotem())
if (Unit* owner = GetOwner())
- return owner->SpellHealingBonus(victim, spellProto, healamount, damagetype, stack);
+ return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, stack);
- // no bonus for heal potions/bandages
+ // No bonus healing for potion spells
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
return healamount;
- // Healing Done
- // Taken/Done total percent damage auras
- float DoneTotalMod = 1.0f;
- float TakenTotalMod = 1.0f;
- int32 DoneTotal = 0;
- int32 TakenTotal = 0;
+ float DoneTotalMod = 1.0f;
+ int32 DoneTotal = 0;
// Healing done percent
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
@@ -11254,28 +11191,11 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32
}
}
- // Taken/Done fixed damage bonus auras
- int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(spellProto->GetSchoolMask());
- int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(spellProto->GetSchoolMask(), victim);
-
- bool scripted = false;
-
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- switch (spellProto->Effects[i].ApplyAuraName)
- {
- // These auras do not use healing coeff
- case SPELL_AURA_PERIODIC_LEECH:
- case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
- scripted = true;
- break;
- }
- if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
- scripted = true;
- }
+ // Done fixed damage bonus auras
+ int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
// Check for table values
- SpellBonusEntry const* bonus = !scripted ? sSpellMgr->GetSpellBonusData(spellProto->Id) : NULL;
+ SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
float coeff = 0;
float factorMod = 1.0f;
if (bonus)
@@ -11285,159 +11205,184 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue(
- (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
+ (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
}
else
{
coeff = bonus->direct_damage;
if (bonus->ap_bonus > 0)
DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue(
- (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
+ (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
}
}
- else // scripted bonus
+ else
{
- // Gift of the Naaru
- if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
- {
- scripted = true;
- int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
- if (apBonus > DoneAdvertisedBenefit)
- DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick
- else
- DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick
- }
- // Earthliving - 0.45% of normal hot coeff
- else if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000)
- factorMod *= 0.45f;
- // Already set to scripted? so not uses healing bonus coefficient
- // No heal coeff for SPELL_DAMAGE_CLASS_NONE class spells by default
- else if (scripted || spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
- {
- scripted = true;
- coeff = 0.0f;
- }
+ // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
+ if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
+ return healamount;
}
// Default calculation
- if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
+ if (DoneAdvertisedBenefit)
{
- if ((!bonus && !scripted) || coeff < 0)
- {
- // Damage Done from spell damage bonus
- int32 CastingTime = !spellProto->IsChanneled() ? spellProto->CalcCastTime() : spellProto->GetDuration();
- // Damage over Time spells bonus calculation
- float DotFactor = 1.0f;
- if (damagetype == DOT)
- {
- int32 DotDuration = spellProto->GetDuration();
- // 200% limit
- if (DotDuration > 0)
- {
- if (DotDuration > 30000) DotDuration = 30000;
- if (!spellProto->IsChanneled()) DotFactor = DotDuration / 15000.0f;
- uint32 x = 0;
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; j++)
- {
- if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && (
- spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
- spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
- {
- x = j;
- break;
- }
- }
- int32 DotTicks = 6;
- if (spellProto->Effects[x].Amplitude != 0)
- DotTicks = DotDuration / spellProto->Effects[x].Amplitude;
- if (DotTicks)
- {
- DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks;
- TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks;
- }
- }
- }
- // Distribute Damage over multiple effects, reduce by AoE
- CastingTime = GetCastingTimeForBonus(spellProto, damagetype, CastingTime);
- // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
- (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
- {
- CastingTime /= 2;
- break;
- }
- }
- // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
- coeff = (CastingTime / 3500.0f) * DotFactor * 1.88f;
- }
+ if (!bonus || coeff < 0)
+ coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
factorMod *= CalculateLevelPenalty(spellProto) * stack;
- // level penalty still applied on Taken bonus - is it blizzlike?
- TakenTotal += int32(TakenAdvertisedBenefit * factorMod);
+
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
coeff /= 100.0f;
}
+
+ // Earthliving - 0.45% of normal hot coeff
+ if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000)
+ factorMod *= 0.45f;
+
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
+ // Gift of the Naaru
+ if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
+ {
+ int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
+ if (apBonus > DoneAdvertisedBenefit)
+ DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick
+ else
+ DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick
+ }
+
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ switch (spellProto->Effects[i].ApplyAuraName)
+ {
+ // Bonus healing does not apply to these spells
+ case SPELL_AURA_PERIODIC_LEECH:
+ case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
+ DoneTotal = 0;
+ break;
+ }
+ if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
+ DoneTotal = 0;
+ }
+
// use float as more appropriate for negative values and percent applying
- float heal = (int32(healamount) + DoneTotal) * DoneTotalMod;
+ float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
// apply spellmod to Done amount
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
- // Nourish cast
- if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000)
- {
- // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
- if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0))
- // increase healing by 20%
- TakenTotalMod *= 1.2f;
- }
-
- // Taken mods
+ return uint32(std::max(heal, 0.0f));
+}
- // Tenacity increase healing % taken
- if (AuraEffect const* Tenacity = victim->GetAuraEffect(58549, 0))
- AddPctN(TakenTotalMod, Tenacity->GetAmount());
+uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
+{
+ float TakenTotalMod = 1.0f;
// Healing taken percent
- float minval = (float)victim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
+ float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if (minval)
AddPctF(TakenTotalMod, minval);
- float maxval = (float)victim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
+ float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if (maxval)
AddPctF(TakenTotalMod, maxval);
+ // Tenacity increase healing % taken
+ if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
+ AddPctN(TakenTotalMod, Tenacity->GetAmount());
+
+ // Healing Done
+ int32 TakenTotal = 0;
+
+ // Taken fixed damage bonus auras
+ int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask());
+
+ // Nourish cast
+ if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000)
+ {
+ // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
+ if (GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x50, 0x4000010, 0))
+ // increase healing by 20%
+ TakenTotalMod *= 1.2f;
+ }
+
if (damagetype == DOT)
{
// Healing over time taken percent
- float minval_hot = (float)victim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
+ float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
if (minval_hot)
AddPctF(TakenTotalMod, minval_hot);
- float maxval_hot = (float)victim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
+ float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
if (maxval_hot)
AddPctF(TakenTotalMod, maxval_hot);
}
- AuraEffectList const& mHealingGet= victim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED);
+ // Check for table values
+ SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
+ float coeff = 0;
+ float factorMod = 1.0f;
+ if (bonus)
+ coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
+ else
+ {
+ // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
+ if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
+ {
+ healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f));
+ return healamount;
+ }
+ }
+
+ // Default calculation
+ if (TakenAdvertisedBenefit)
+ {
+ if (!bonus || coeff < 0)
+ coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
+
+ factorMod *= CalculateLevelPenalty(spellProto) * int32(stack);
+ if (Player* modOwner = GetSpellModOwner())
+ {
+ coeff *= 100.0f;
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ coeff /= 100.0f;
+ }
+
+ // Earthliving - 0.45% of normal hot coeff
+ if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[1] & 0x80000)
+ factorMod *= 0.45f;
+
+ TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
+ }
+
+ AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED);
for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
- if (GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
+ if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
AddPctN(TakenTotalMod, (*i)->GetAmount());
- heal = (int32(heal) + TakenTotal) * TakenTotalMod;
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ switch (spellProto->Effects[i].ApplyAuraName)
+ {
+ // Bonus healing does not apply to these spells
+ case SPELL_AURA_PERIODIC_LEECH:
+ case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
+ TakenTotal = 0;
+ break;
+ }
+ if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
+ TakenTotal = 0;
+ }
+
+ float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod;
return uint32(std::max(heal, 0.0f));
}
-int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
+int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
{
int32 AdvertisedBenefit = 0;
@@ -11470,13 +11415,15 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
return AdvertisedBenefit;
}
-int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* victim)
+int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask)
{
int32 AdvertisedBenefit = 0;
- AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_HEALING);
+
+ AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING);
for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
if (((*i)->GetMiscValue() & schoolMask) != 0)
AdvertisedBenefit += (*i)->GetAmount();
+
return AdvertisedBenefit;
}
@@ -11503,7 +11450,7 @@ bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo)
return false;
uint32 shoolMask = spellInfo->GetSchoolMask();
- if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
+ if (spellInfo->Id != 42292 && spellInfo->Id != 59752)
{
// If m_immuneToSchool type contain this school type, IMMUNE damage.
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
@@ -11544,7 +11491,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
}
// Spells that don't have effectMechanics.
- if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic)
+ if (spellInfo->Mechanic)
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
@@ -11557,16 +11504,19 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
{
// State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately
- if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i))
+ if (!spellInfo->Effects[i].IsEffect())
+ continue;
+ if (!IsImmunedToSpellEffect(spellInfo, i))
{
immuneToAllEffects = false;
break;
}
}
+
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
return true;
- if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
+ if (spellInfo->Id != 42292 && spellInfo->Id != 59752)
{
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
@@ -11584,8 +11534,9 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
- if (!spellInfo)
+ if (!spellInfo || !spellInfo->Effects[index].IsEffect())
return false;
+
// If m_immuneToEffect type contain this effect type, IMMUNE effect.
uint32 effect = spellInfo->Effects[index].Effect;
SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
@@ -11619,21 +11570,17 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons
return false;
}
-void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attType, SpellInfo const* spellProto)
+uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto)
{
- if (!victim)
- return;
-
- if (*pdamage == 0)
- return;
+ if (!victim || pdamage == 0)
+ return 0;
uint32 creatureTypeMask = victim->GetCreatureTypeMask();
- // Taken/Done fixed damage bonus auras
+ // Done fixed damage bonus auras
int32 DoneFlatBenefit = 0;
- int32 TakenFlatBenefit = 0;
- // ..done (for creature type by mask) in taken
+ // ..done
AuraEffectList const& mDamageDoneCreature = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
@@ -11679,38 +11626,27 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
DoneFlatBenefit += int32(APbonus/14.0f * GetAPMultiplier(attType, normalized));
}
- // ..taken
- AuraEffectList const& mDamageTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
- for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
- if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask())
- TakenFlatBenefit += (*i)->GetAmount();
-
- if (attType != RANGED_ATTACK)
- TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN);
- else
- TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN);
-
- // Done/Taken total percent damage auras
+ // Done total percent damage auras
float DoneTotalMod = 1.0f;
- float TakenTotalMod = 1.0f;
- // ..done
- AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
- {
- if (spellProto)
+ // 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 ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
+ AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
{
- if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
- else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
- else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
+ {
+ if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
}
}
- }
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
@@ -11798,18 +11734,60 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
break;
}
+ float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
+
+ // apply spellmod to Done damage
+ if (spellProto)
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
+
+ // bonus result can be negative
+ return uint32(std::max(tmpDamage, 0.0f));
+}
+
+uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto)
+{
+ if (pdamage == 0)
+ return 0;
+
+ int32 TakenFlatBenefit = 0;
+ float TakenTotalCasterMod = 0.0f;
+
+ // get all auras from caster that allow the spell to ignore resistance (sanctified wrath)
+ SpellSchoolMask attackSchoolMask = spellProto ? spellProto->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL;
+ AuraEffectList const& IgnoreResistAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
+ for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i)
+ {
+ if ((*i)->GetMiscValue() & attackSchoolMask)
+ TakenTotalCasterMod += (float((*i)->GetAmount()));
+ }
+
// ..taken
- TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask());
+ AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
+ for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
+ if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask())
+ TakenFlatBenefit += (*i)->GetAmount();
- // From caster spells
- AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
- for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
- if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ if (attType != RANGED_ATTACK)
+ TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN);
+ else
+ TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN);
+
+ // Taken total percent damage auras
+ float TakenTotalMod = 1.0f;
+
+ // ..taken
+ TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask());
// .. taken pct (special attacks)
if (spellProto)
{
+ // 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() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
+ AddPctN(TakenTotalMod, (*i)->GetAmount());
+
// Mod damage from spell mechanic
uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
@@ -11819,7 +11797,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
if (mechanicMask)
{
- AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
+ 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())))
AddPctN(TakenTotalMod, (*i)->GetAmount());
@@ -11827,7 +11805,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
}
// .. taken pct: dummy auras
- AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
+ AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
switch ((*i)->GetSpellInfo()->SpellIconID)
@@ -11836,9 +11814,9 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
case 2109:
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
{
- if (victim->GetTypeId() != TYPEID_PLAYER)
+ if (GetTypeId() != TYPEID_PLAYER)
continue;
- float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
+ float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
@@ -11846,38 +11824,46 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
}
// .. taken pct: class scripts
- /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
- {
- switch ((*i)->GetMiscValue())
- {
- }
- }*/
+ //*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ //for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
+ //{
+ // switch ((*i)->GetMiscValue())
+ // {
+ // }
+ //}*/
if (attType != RANGED_ATTACK)
{
- AuraEffectList const& mModMeleeDamageTakenPercent = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
+ AuraEffectList const& mModMeleeDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
AddPctN(TakenTotalMod, (*i)->GetAmount());
}
else
{
- AuraEffectList const& mModRangedDamageTakenPercent = victim->GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
+ AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
AddPctN(TakenTotalMod, (*i)->GetAmount());
}
- float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod;
-
- // apply spellmod to Done damage
- if (spellProto)
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
+ float tmpDamage = 0.0f;
- tmpDamage = (tmpDamage + TakenFlatBenefit) * TakenTotalMod;
+ if (TakenTotalCasterMod)
+ {
+ if (TakenFlatBenefit < 0)
+ {
+ if (TakenTotalMod < 1)
+ tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod));
+ else
+ tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
+ }
+ else if (TakenTotalMod < 1)
+ tmpDamage = ((CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod));
+ }
+ if (!tmpDamage)
+ tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
// bonus result can be negative
- *pdamage = uint32(std::max(tmpDamage, 0.0f));
+ return uint32(std::max(tmpDamage, 0.0f));
}
void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
@@ -12217,7 +12203,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const
}
// function based on function Unit::CanAttack from 13850 client
-bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const
+bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj) const
{
ASSERT(target);
@@ -12235,8 +12221,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
return false;
- // can't attack invisible (ignore stealth for aoe spells)
- if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
+ // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
+ if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea())))
return false;
// can't attack dead
@@ -12625,7 +12611,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
break;
}
default:
- sLog->outError("Unit::UpdateSpeed: Unsupported move type (%d)", mtype);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::UpdateSpeed: Unsupported move type (%d)", mtype);
return;
}
@@ -12642,7 +12628,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
{
// Set creature speed rate from CreatureInfo
if (GetTypeId() == TYPEID_UNIT)
- speed *= ToCreature()->GetCreatureTemplate()->speed_walk;
+ speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
// TODO: possible affect only on MOVE_RUN
@@ -12732,7 +12718,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8+4+2+4+4+4+4+4+4+4);
break;
default:
- sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
return;
}
@@ -12783,7 +12769,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE, 16);
break;
default:
- sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
return;
}
data.append(GetPackGUID());
@@ -12797,11 +12783,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
void Unit::setDeathState(DeathState s)
{
- // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
- // it can be used to check creation of death items (such as soul shards).
- m_deathState = s;
-
- if (s != ALIVE && s != JUST_ALIVED)
+ if (s != ALIVE && s != JUST_RESPAWNED)
{
CombatStop();
DeleteThreatList();
@@ -12844,8 +12826,10 @@ void Unit::setDeathState(DeathState s)
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
zoneScript->OnUnitDeath(this);
}
- else if (s == JUST_ALIVED)
- RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
+ else if (s == JUST_RESPAWNED)
+ RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
+
+ m_deathState = s;
}
/*########################################
@@ -12964,8 +12948,7 @@ void Unit::TauntFadeOut(Unit* taunter)
return;
}
- //m_ThreatManager.tauntFadeOut(taunter);
- target = m_ThreatManager.getHostilTarget();
+ target = creature->SelectVictim(); // might have more taunt auras remaining
if (target && target != taunter)
{
@@ -13049,7 +13032,7 @@ Unit* Creature::SelectVictim()
else
return NULL;
- if (target && _IsTargetAcceptable(target))
+ if (target && _IsTargetAcceptable(target) && canCreatureAttack(target))
{
SetInFront(target);
return target;
@@ -13075,7 +13058,7 @@ Unit* Creature::SelectVictim()
{
target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE);
- if (target && _IsTargetAcceptable(target))
+ if (target && _IsTargetAcceptable(target) && canCreatureAttack(target))
return target;
}
@@ -13257,7 +13240,7 @@ void Unit::ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell);
- if (!(spellProto->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && spellProto->SpellFamilyName)
+ if (!(spellProto->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && ((GetTypeId() == TYPEID_PLAYER && spellProto->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))
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
@@ -13444,7 +13427,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
{
if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
- sLog->outError("ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
+ sLog->outError(LOG_FILTER_UNITS, "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
return false;
}
@@ -13509,7 +13492,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co
{
if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
- sLog->outError("attempt to access non-existing modifier value from UnitMods!");
+ sLog->outError(LOG_FILTER_UNITS, "attempt to access non-existing modifier value from UnitMods!");
return 0.0f;
}
@@ -13539,7 +13522,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const
{
if (unitMod >= UNIT_MOD_END)
{
- sLog->outError("attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
+ sLog->outError(LOG_FILTER_UNITS, "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
return 0.0f;
}
@@ -13820,7 +13803,7 @@ void Unit::RemoveFromWorld()
if (GetCharmerGUID())
{
- sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u has charmer guid when removed from world", GetEntry());
ASSERT(false);
}
@@ -13828,7 +13811,7 @@ void Unit::RemoveFromWorld()
{
if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
{
- sLog->outCrash("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry());
ASSERT(false);
}
}
@@ -14458,7 +14441,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask);
- uint32 newDamage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
+ uint32 newDamage = SpellDamageBonusDone(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
+ newDamage = target->SpellDamageBonusTaken(this, spellInfo, newDamage, SPELL_DIRECT_DAMAGE);
CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo);
DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
SendSpellNonMeleeDamageLog(&damageInfo);
@@ -14534,6 +14518,11 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
if (procSpell && (triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check
takeCharges = true;
break;
+ case SPELL_AURA_SPELL_MAGNET:
+ // Skip Melee hits and targets with magnet aura
+ if (procSpell && (triggeredByAura->GetBase()->GetUnitOwner()->ToUnit() == ToUnit())) // Magnet
+ takeCharges = true;
+ break;
case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT:
case SPELL_AURA_MOD_POWER_COST_SCHOOL:
// Skip melee hits and spells ws wrong school or zero cost
@@ -14762,6 +14751,7 @@ void Unit::StopMoving()
return;
Movement::MoveSplineInit init(*this);
+ init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset());
init.SetFacing(GetOrientation());
init.Launch();
}
@@ -14985,7 +14975,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply)
ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED, -val, apply);
}
-uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime)
+uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const
{
// Not apply this to creature casted spells with casttime == 0
if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
@@ -15058,20 +15048,21 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp
if (AreaEffect)
CastingTime /= 2;
- // -5% of total per any additional effect
- for (uint8 i = 0; i < effects; ++i)
+ // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
+ for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (CastingTime > 175)
- {
- CastingTime -= 175;
- }
- else
+ if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
+ (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
{
- CastingTime = 0;
+ CastingTime /= 2;
break;
}
}
+ // -5% of total per any additional effect
+ for (uint8 i = 0; i < effects; ++i)
+ CastingTime *= 0.95f;
+
return CastingTime;
}
@@ -15102,6 +15093,29 @@ void Unit::UpdateAuraForGroup(uint8 slot)
}
}
+float Unit::CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const
+{
+ // Damage over Time spells bonus calculation
+ float DotFactor = 1.0f;
+ if (damagetype == DOT)
+ {
+
+ int32 DotDuration = spellInfo->GetDuration();
+ if (!spellInfo->IsChanneled() && DotDuration > 0)
+ DotFactor = DotDuration / 15000.0f;
+
+ if (uint32 DotTicks = spellInfo->GetMaxTicks())
+ DotFactor /= DotTicks;
+ }
+
+ int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
+ // Distribute Damage over multiple effects, reduce by AoE
+ CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
+
+ // As wowwiki says: C = (Cast Time / 3.5)
+ return (CastingTime / 3500.0f) * DotFactor;
+}
+
float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
{
if (!normalized || GetTypeId() != TYPEID_PLAYER)
@@ -15226,7 +15240,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
if (!pet->InitStatsForLevel(level))
{
- sLog->outError("Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry());
return false;
}
@@ -15404,7 +15418,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
damageSpellId = 43594;
break;
default:
- sLog->outError("Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id);
return false;
}
@@ -15566,7 +15580,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (!spiritOfRedemption)
{
- sLog->outStaticDebug("SET JUST_DIED");
+ sLog->outDebug(LOG_FILTER_UNITS, "SET JUST_DIED");
victim->setDeathState(JUST_DIED);
}
@@ -15591,7 +15605,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// only if not player and not controlled by player pet. And not at BG
if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
{
- sLog->outStaticDebug("We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
+ sLog->outDebug(LOG_FILTER_UNITS, "We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false);
// durability lost message
WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);
@@ -15611,7 +15625,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
}
else // creature died
{
- sLog->outStaticDebug("DealDamageNotPlayer");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageNotPlayer");
if (!creature->isPet())
{
@@ -15663,9 +15677,14 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
// handle player kill only if not suicide (spirit of redemption for example)
if (player && this != victim)
+ {
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
pvp->HandleKill(player, victim);
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
+ bf->HandleKill(player, victim);
+ }
+
//if (victim->GetTypeId() == TYPEID_PLAYER)
// if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
// pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
@@ -15946,7 +15965,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (this == charmer)
{
- sLog->outCrash("Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow());
return false;
}
@@ -15955,14 +15974,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport())
{
- sLog->outCrash("Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow());
return false;
}
// Already charmed
if (GetCharmerGUID())
{
- sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
return false;
}
@@ -15987,7 +16006,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
// StopCastingCharm may remove a possessed pet?
if (!IsInWorld())
{
- sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
return false;
}
@@ -16087,7 +16106,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
charmer = GetCharmer();
if (charmer != GetCharmer()) // one aura overrides another?
{
-// sLog->outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD,
+// sLog->outFatal(LOG_FILTER_UNITS, "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD,
// GetGUID(), GetCharmerGUID(), charmer->GetGUID());
// ASSERT(false);
return;
@@ -16165,7 +16184,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (GetCharmInfo())
GetCharmInfo()->SetPetNumber(0, true);
else
- sLog->outError("Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
+ sLog->outError(LOG_FILTER_UNITS, "Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
}
}
break;
@@ -16250,7 +16269,7 @@ Creature* Unit::GetVehicleCreatureBase() const
uint64 Unit::GetTransGUID() const
{
if (GetVehicle())
- return GetVehicle()->GetBase()->GetGUID();
+ return GetVehicleBase()->GetGUID();
if (GetTransport())
return GetTransport()->GetGUID();
@@ -16970,12 +16989,12 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
if (!valid)
{
- sLog->outErrorDb("Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
return false;
}
if (IsInMap(caster))
- caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, true, NULL, NULL, origCasterGUID);
+ caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID);
else // This can happen during Player::_LoadAuras
{
int32 bp0 = seatId;
@@ -16985,7 +17004,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
else
{
if (IsInMap(caster))
- caster->CastSpell(target, spellEntry, true, NULL, NULL, origCasterGUID);
+ caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID);
else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID);
}
@@ -16993,7 +17012,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
Creature* creature = ToCreature();
if (creature && creature->IsAIEnabled)
- creature->AI()->DoAction(EVENT_SPELLCLICK);
+ creature->AI()->OnSpellClick(clicker);
return true;
}
@@ -17113,11 +17132,12 @@ void Unit::_ExitVehicle(Position const* exitPosition)
Vehicle* vehicle = m_vehicle;
m_vehicle = NULL;
- SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
+ SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
Position pos;
- if (!exitPosition) // Exit position not specified
- vehicle->GetBase()->GetPosition(&pos);
+ if (!exitPosition) // Exit position not specified
+ vehicle->GetBase()->GetPosition(&pos); // This should use passenger's current position, leaving it as it is now
+ // because we calculate positions incorrect (sometimes under map)
else
pos = *exitPosition;
@@ -17132,14 +17152,17 @@ void Unit::_ExitVehicle(Position const* exitPosition)
SendMessageToSet(&data, false);
}
- SendMonsterMoveExitVehicle(&pos);
- Relocate(&pos);
+ Movement::MoveSplineInit init(*this);
+ init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
+ init.SetFacing(GetOrientation());
+ init.SetTransportExit();
+ init.Launch();
+
+ //GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above)
if (Player* player = ToPlayer())
player->ResummonPetTemporaryUnSummonedIfAny();
- SendMovementFlagUpdate();
-
if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
if (((Minion*)vehicle->GetBase())->GetOwner() == this)
vehicle->Dismiss();
@@ -17255,6 +17278,9 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
else if (turn)
UpdateOrientation(orientation);
+ // code block for underwater state update
+ UpdateUnderwaterState(GetMap(), x, y, z);
+
return (relocated || turn);
}
@@ -17399,39 +17425,44 @@ void Unit::StopAttackFaction(uint32 faction_id)
void Unit::OutDebugInfo() const
{
- sLog->outError("Unit::OutDebugInfo");
- sLog->outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName());
- sLog->outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
- sLog->outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::OutDebugInfo");
+ sLog->outInfo(LOG_FILTER_UNITS, "GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName());
+ sLog->outInfo(LOG_FILTER_UNITS, "OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
+ sLog->outInfo(LOG_FILTER_UNITS, "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
if (IsInWorld())
- sLog->outString("Mapid %u", GetMapId());
+ sLog->outInfo(LOG_FILTER_UNITS, "Mapid %u", GetMapId());
- sLog->outStringInLine("Summon Slot: ");
+ std::ostringstream o;
+ o << "Summon Slot: ";
for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
- sLog->outStringInLine(UI64FMTD", ", m_SummonSlot[i]);
- sLog->outString();
+ o << m_SummonSlot[i] << ", ";
+
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
+ o.str("");
- sLog->outStringInLine("Controlled List: ");
+ o << "Controlled List: ";
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
- sLog->outStringInLine(UI64FMTD", ", (*itr)->GetGUID());
- sLog->outString();
+ o << (*itr)->GetGUID() << ", ";
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
+ o.str("");
- sLog->outStringInLine("Aura List: ");
+ o << "Aura List: ";
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
- sLog->outStringInLine("%u, ", itr->first);
- sLog->outString();
+ o << itr->first << ", ";
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
+ o.str("");
if (IsVehicle())
{
- sLog->outStringInLine("Passenger List: ");
+ o << "Passenger List: ";
for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger))
- sLog->outStringInLine(UI64FMTD", ", passenger->GetGUID());
- sLog->outString();
+ o << passenger->GetGUID() << ", ";
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
}
if (GetVehicle())
- sLog->outString("On vehicle %u.", GetVehicleBase()->GetEntry());
+ sLog->outInfo(LOG_FILTER_UNITS, "On vehicle %u.", GetVehicleBase()->GetEntry());
}
uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
@@ -17532,6 +17563,7 @@ void Unit::SetInFront(Unit const* target)
void Unit::SetFacingTo(float ori)
{
Movement::MoveSplineInit init(*this);
+ init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset());
init.SetFacing(ori);
init.Launch();
}
@@ -17559,7 +17591,7 @@ bool Unit::SetWalk(bool enable)
return true;
}
-bool Unit::SetDisableGravity(bool disable)
+bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/)
{
if (disable == IsLevitating())
return false;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index b47c5a78dd5..6770ad94c23 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -465,7 +465,7 @@ enum DeathState
JUST_DIED = 1,
CORPSE = 2,
DEAD = 3,
- JUST_ALIVED = 4,
+ JUST_RESPAWNED = 4,
};
enum UnitState
@@ -708,7 +708,7 @@ enum MovementFlags
MOVEMENTFLAG_MASK_TURNING =
MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT,
- MOVEMENTFLAG_MASK_MOVING_FLY =
+ MOVEMENTFLAG_MASK_MOVING_FLY =
MOVEMENTFLAG_FLYING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING,
//! TODO if needed: add more flags to this masks that are exclusive to players
@@ -736,19 +736,6 @@ enum MovementFlags2
MOVEMENTFLAG2_UNK16 = 0x00008000,
};
-enum SplineFlags
-{
- SPLINEFLAG_WALKMODE = 0x00001000,
- SPLINEFLAG_FLYING = 0x00002000,
- SPLINEFLAG_TRANSPORT = 0x00800000,
- SPLINEFLAG_EXIT_VEHICLE = 0x01000000,
-};
-
-enum SplineType
-{
- SPLINETYPE_FACING_ANGLE = 4,
-};
-
enum UnitTypeMask
{
UNIT_MASK_NONE = 0x00000000,
@@ -807,8 +794,8 @@ public:
m_dispeller(_dispeller), m_dispellerSpellId(_dispellerSpellId), m_chargesRemoved(_chargesRemoved) {}
Unit* GetDispeller() { return m_dispeller; }
- uint32 GetDispellerSpellId() { return m_dispellerSpellId; }
- uint8 GetRemovedCharges() { return m_chargesRemoved; }
+ uint32 GetDispellerSpellId() const { return m_dispellerSpellId; }
+ uint8 GetRemovedCharges() const { return m_chargesRemoved; }
void SetRemovedCharges(uint8 amount)
{
m_chargesRemoved = amount;
@@ -977,24 +964,6 @@ struct SpellPeriodicAuraLogInfo
uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition);
-enum UnitAnimationState
-{
- ANIMATION_ON_GROUND = 0,
- ANIMATION_SWIMMING = 1,
- ANIMATION_HOVER = 2,
- ANIMATION_FLYING = 3,
-};
-
-struct MonsterMoveData
-{
- MonsterMoveData() : SplineFlag(0), AnimationState(ANIMATION_ON_GROUND), Time(0), SpeedZ(0.0f) {}
- Position DestLocation;
- uint32 SplineFlag;
- UnitAnimationState AnimationState; // Only used with SPLINEFLAG_ANIMATIONTIER
- uint32 Time;
- float SpeedZ; // Only used with SPLINEFLAG_TRAJECTORY
-};
-
#define MAX_DECLINED_NAME_CASES 5
struct DeclinedName
@@ -1351,10 +1320,10 @@ class Unit : public WorldObject
uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); }
bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); }
- bool HealthBelowPct(int32 pct) const { return GetHealth() * uint64(100) < GetMaxHealth() * uint64(pct); }
- bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return (int32(GetHealth()) - damage) * int64(100) < GetMaxHealth() * int64(pct); }
- bool HealthAbovePct(int32 pct) const { return GetHealth() * uint64(100) > GetMaxHealth() * uint64(pct); }
- bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return (GetHealth() + heal) * uint64(100) > GetMaxHealth() * uint64(pct); }
+ bool HealthBelowPct(int32 pct) const { return GetHealth() < CountPctFromMaxHealth(pct); }
+ bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
+ bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); }
+ bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); }
float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; }
uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); }
uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); }
@@ -1574,13 +1543,14 @@ class Unit : public WorldObject
bool isTargetableForAttack(bool checkFakeDeath = true) const;
bool IsValidAttackTarget(Unit const* target) const;
- bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const;
+ bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = NULL) const;
bool IsValidAssistTarget(Unit const* target) const;
bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const;
virtual bool IsInWater() const;
virtual bool IsUnderWater() const;
+ virtual void UpdateUnderwaterState(Map* m, float x, float y, float z);
bool isInAccessiblePlaceFor(Creature const* c) const;
void SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false);
@@ -1629,9 +1599,7 @@ class Unit : public WorldObject
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false);
//void SetFacing(float ori, WorldObject* obj = NULL);
- void SendMonsterMoveExitVehicle(Position const* newPos);
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
- void SendMonsterMoveTransport(Unit* vehicleOwner);
void SendMovementFlagUpdate();
/*! These methods send the same packet to the client in apply and unapply case.
@@ -1648,7 +1616,7 @@ class Unit : public WorldObject
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);}
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
virtual bool SetWalk(bool enable);
- virtual bool SetDisableGravity(bool disable);
+ virtual bool SetDisableGravity(bool disable, bool packetOnly = false);
bool SetHover(bool enable);
void SetInFront(Unit const* target);
@@ -1671,6 +1639,7 @@ class Unit : public WorldObject
virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet
uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); }
+ void SetOwnerGUID(uint64 owner);
uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); }
void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); }
uint64 GetMinionGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); }
@@ -2034,12 +2003,20 @@ class Unit : public WorldObject
void UnsummonAllTotems();
Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo);
Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL);
- int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask);
- int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask);
- int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* victim);
- int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* victim);
- uint32 SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
- uint32 SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
+
+ int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask);
+ int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask);
+ uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1);
+ uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1);
+ int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask);
+ int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask);
+ uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
+ uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
+
+ uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL);
+ uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage,WeaponAttackType attType, SpellInfo const *spellProto = NULL);
+
+
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;
@@ -2051,8 +2028,8 @@ class Unit : public WorldObject
void SetContestedPvP(Player* attackedPlayer = NULL);
- void MeleeDamageBonus(Unit* victim, uint32 *damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL);
- uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime);
+ uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const;
+ float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const;
uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;
@@ -2320,6 +2297,7 @@ class Unit : public WorldObject
Vehicle* m_vehicleKit;
uint32 m_unitTypeMask;
+ LiquidTypeEntry const* _lastLiquid;
bool IsAlwaysVisibleFor(WorldObject const* seer) const;
bool IsAlwaysDetectableFor(WorldObject const* seer) const;
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index f3d6e8abc79..710821f2f24 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -28,6 +28,7 @@
#include "ZoneScript.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
+#include "MoveSplineInit.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry)
{
@@ -285,9 +286,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
// return; // Something went wrong in the spellsystem
//}
- // This is not good, we have to send update twice
- accessory->SendMovementFlagUpdate();
-
if (GetBase()->GetTypeId() == TYPEID_UNIT)
sScriptMgr->OnInstallAccessory(this, accessory);
}
@@ -341,7 +339,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
}
}
- if (seat->second.SeatInfo->m_flags && !(seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_UNK1))
+ if (seat->second.SeatInfo->m_flags && !(seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING))
unit->AddUnitState(UNIT_STATE_ONVEHICLE);
unit->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
@@ -352,6 +350,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
unit->m_movementInfo.t_pos.m_orientation = 0;
unit->m_movementInfo.t_time = 0; // 1 for player
unit->m_movementInfo.t_seat = seat->first;
+ unit->m_movementInfo.t_guid = _me->GetGUID();
if (_me->GetTypeId() == TYPEID_UNIT
&& unit->GetTypeId() == TYPEID_PLAYER
@@ -366,7 +365,12 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
unit->SendClearTarget(); // SMSG_BREAK_TARGET
unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
// also adds MOVEMENTFLAG_ROOT
- unit->SendMonsterMoveTransport(_me); // SMSG_MONSTER_MOVE_TRANSPORT
+ Movement::MoveSplineInit init(*unit);
+ init.DisableTransportPathTransformations();
+ init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
+ init.SetFacing(0.0f);
+ init.SetTransportEnter();
+ init.Launch();
if (_me->GetTypeId() == TYPEID_UNIT)
{
@@ -374,7 +378,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, true);
// update all passenger's positions
- RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation());
+ //Passenger's spline OR vehicle movement will update positions
+ //RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation());
}
}
@@ -453,11 +458,12 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
void Vehicle::Dismiss()
{
+ if (GetBase()->GetTypeId() != TYPEID_UNIT)
+ return;
+
sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow());
Uninstall();
- _me->DestroyForNearbyPlayers();
- _me->CombatStop();
- _me->AddObjectToRemoveList();
+ GetBase()->ToCreature()->DespawnOrUnsummon();
}
void Vehicle::InitMovementInfoForBase()
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 213be5a21fe..95fc2364256 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -25,6 +25,8 @@
struct VehicleEntry;
class Unit;
+typedef std::set<uint64> GuidSet;
+
class Vehicle
{
public:
@@ -53,6 +55,7 @@ class Vehicle
void RelocatePassengers(float x, float y, float z, float ang);
void RemoveAllPassengers();
void Dismiss();
+ void TeleportVehicle(float x, float y, float z, float ang);
bool IsVehicleInUse() { return Seats.begin() != Seats.end(); }
SeatMap Seats;
@@ -65,6 +68,7 @@ class Vehicle
Unit* _me;
VehicleEntry const* _vehicleInfo;
+ GuidSet vehiclePlayers;
uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
};
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index a8492726e75..bead65bbfdd 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -210,8 +210,8 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
mGameEvent.clear();
- sLog->outErrorDb(">> Loaded 0 game events. DB table `game_event` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 game events. DB table `game_event` is empty.");
+
return;
}
@@ -223,7 +223,7 @@ void GameEventMgr::LoadFromDB()
uint8 event_id = fields[0].GetUInt8();
if (event_id == 0)
{
- sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used.");
+ sLog->outError(LOG_FILTER_SQL, "`game_event` game event entry 0 is reserved and can't be used.");
continue;
}
@@ -241,7 +241,7 @@ void GameEventMgr::LoadFromDB()
if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
{
- sLog->outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id);
continue;
}
@@ -249,7 +249,7 @@ void GameEventMgr::LoadFromDB()
{
if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
{
- sLog->outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id);
pGameEvent.holiday_id = HOLIDAY_NONE;
}
}
@@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
- sLog->outString("Loading Game Event Saves Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data...");
{
uint32 oldMSTime = getMSTime();
@@ -273,8 +273,8 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
+
}
else
{
@@ -287,7 +287,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id);
continue;
}
@@ -298,7 +298,7 @@ void GameEventMgr::LoadFromDB()
}
else
{
- sLog->outErrorDb("game_event_save includes event save for non-worldevent id %u", event_id);
+ sLog->outError(LOG_FILTER_SQL, "game_event_save includes event save for non-worldevent id %u", event_id);
continue;
}
@@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
- sLog->outString("Loading Game Event Prerequisite Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data...");
{
uint32 oldMSTime = getMSTime();
@@ -319,8 +319,8 @@ void GameEventMgr::LoadFromDB()
QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite");
if (!result)
{
- sLog->outString(">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
+
}
else
{
@@ -333,7 +333,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -342,14 +342,14 @@ void GameEventMgr::LoadFromDB()
uint16 prerequisite_event = fields[1].GetUInt32();
if (prerequisite_event >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event);
continue;
}
mGameEvent[event_id].prerequisite_events.insert(prerequisite_event);
}
else
{
- sLog->outErrorDb("game_event_prerequisiste includes event entry for non-worldevent id %u", event_id);
+ sLog->outError(LOG_FILTER_SQL, "game_event_prerequisiste includes event entry for non-worldevent id %u", event_id);
continue;
}
@@ -357,12 +357,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
- sLog->outString("Loading Game Event Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data...");
{
uint32 oldMSTime = getMSTime();
@@ -372,8 +372,8 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
+
}
else
{
@@ -389,7 +389,7 @@ void GameEventMgr::LoadFromDB()
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size()))
{
- sLog->outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
- sLog->outString("Loading Game Event GO Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data...");
{
uint32 oldMSTime = getMSTime();
@@ -415,8 +415,8 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
+
}
else
{
@@ -432,7 +432,7 @@ void GameEventMgr::LoadFromDB()
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size()))
{
- sLog->outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -443,12 +443,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Model/Equipment Change Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data...");
{
uint32 oldMSTime = getMSTime();
@@ -458,8 +457,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
}
else
{
@@ -473,7 +471,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventModelEquip.size())
{
- sLog->outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -488,7 +486,7 @@ void GameEventMgr::LoadFromDB()
{
if (!sObjectMgr->GetEquipmentInfo(newModelEquipSet.equipment_id))
{
- sLog->outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
+ sLog->outError(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
guid, newModelEquipSet.equipment_id);
continue;
}
@@ -500,12 +498,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -514,8 +511,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
}
else
{
@@ -530,7 +526,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventCreatureQuests.size())
{
- sLog->outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -541,12 +537,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event GO Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -555,8 +550,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
}
else
{
@@ -571,7 +565,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventGameObjectQuests.size())
{
- sLog->outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -582,12 +576,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Quest Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -596,8 +589,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
}
else
{
@@ -613,7 +605,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -625,12 +617,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -639,8 +630,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
}
else
{
@@ -654,7 +644,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -667,12 +657,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Condition Save Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data...");
{
uint32 oldMSTime = getMSTime();
@@ -681,8 +670,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
}
else
{
@@ -696,7 +684,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -707,7 +695,7 @@ void GameEventMgr::LoadFromDB()
}
else
{
- sLog->outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition);
+ sLog->outError(LOG_FILTER_SQL, "game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition);
continue;
}
@@ -715,12 +703,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event NPCflag Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data...");
{
uint32 oldMSTime = getMSTime();
@@ -729,8 +716,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
}
else
{
@@ -745,7 +731,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -755,12 +741,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Seasonal Quest Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations...");
{
uint32 oldMSTime = getMSTime();
@@ -769,8 +754,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
}
else
{
@@ -784,13 +768,13 @@ void GameEventMgr::LoadFromDB()
if (!sObjectMgr->GetQuestTemplate(questId))
{
- sLog->outErrorDb("`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId);
continue;
}
if (eventEntry >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry);
continue;
}
@@ -799,12 +783,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Vendor Additions Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data...");
{
uint32 oldMSTime = getMSTime();
@@ -813,8 +796,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
}
else
{
@@ -827,7 +809,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventVendors.size())
{
- sLog->outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -865,12 +847,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Battleground Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data...");
{
uint32 oldMSTime = getMSTime();
@@ -879,8 +860,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
}
else
{
@@ -893,7 +873,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -903,12 +883,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Pool Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data...");
{
uint32 oldMSTime = getMSTime();
@@ -918,8 +897,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
}
else
{
@@ -935,13 +913,13 @@ void GameEventMgr::LoadFromDB()
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size()))
{
- sLog->outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
if (!sPoolMgr->CheckPool(entry))
{
- sLog->outErrorDb("Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry);
continue;
}
@@ -952,8 +930,7 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
}
@@ -1015,7 +992,7 @@ void GameEventMgr::StartArenaSeason()
if (!result)
{
- sLog->outError("ArenaSeason (%u) must be an existant Arena Season", season);
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "ArenaSeason (%u) must be an existant Arena Season", season);
return;
}
@@ -1024,13 +1001,13 @@ void GameEventMgr::StartArenaSeason()
if (eventId >= mGameEvent.size())
{
- sLog->outError("EventEntry %u for ArenaSeason (%u) does not exists", eventId, season);
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "EventEntry %u for ArenaSeason (%u) does not exists", eventId, season);
return;
}
StartEvent(eventId, true);
- sLog->outString("Arena Season %u started...", season);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Arena Season %u started...", season);
+
}
uint32 GameEventMgr::Update() // return the next event delay in ms
@@ -1043,7 +1020,7 @@ uint32 GameEventMgr::Update() // return the next e
{
// must do the activating first, and after that the deactivating
// so first queue it
- //sLog->outErrorDb("Checking event %u", itr);
+ //sLog->outError(LOG_FILTER_SQL, "Checking event %u", itr);
if (CheckOneGameEvent(itr))
{
// if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so
@@ -1099,13 +1076,13 @@ uint32 GameEventMgr::Update() // return the next e
nextEventDelay = 0;
for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
StopEvent(*itr);
- sLog->outDetail("Next game event check in %u seconds.", nextEventDelay + 1);
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Next game event check in %u seconds.", nextEventDelay + 1);
return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call
}
void GameEventMgr::UnApplyEvent(uint16 event_id)
{
- sLog->outDetail("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
//! Run SAI scripts with SMART_EVENT_GAME_EVENT_END
RunSmartAIScripts(event_id, false);
// un-spawn positive event tagged objects
@@ -1124,8 +1101,6 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
UpdateEventNPCVendor(event_id, false);
// update bg holiday
UpdateBattlegroundSettings();
- // check for seasonal quest reset.
- sWorld->ResetEventSeasonalQuests(event_id);
}
void GameEventMgr::ApplyNewEvent(uint16 event_id)
@@ -1139,7 +1114,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
break;
}
- sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
//! Run SAI scripts with SMART_EVENT_GAME_EVENT_END
RunSmartAIScripts(event_id, true);
@@ -1160,6 +1135,8 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
UpdateEventNPCVendor(event_id, true);
// update bg holiday
UpdateBattlegroundSettings();
+ // check for seasonal quest reset.
+ sWorld->ResetEventSeasonalQuests(event_id);
}
void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
@@ -1211,7 +1188,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventCreatureGuids.size());
return;
}
@@ -1238,7 +1215,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventGameobjectGuids.size());
return;
}
@@ -1271,7 +1248,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size()))
{
- sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",
internal_event_id, mGameEventPoolIds.size());
return;
}
@@ -1286,7 +1263,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventCreatureGuids.size());
return;
}
@@ -1308,7 +1285,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventGameobjectGuids.size());
return;
}
@@ -1329,7 +1306,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
}
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size()))
{
- sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size());
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size());
return;
}
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index 9a99a28c7aa..81a132a40d8 100755
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -290,7 +290,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
return NULL;
}
- sLog->outStaticDebug("Deleting Corpse and spawned bones.");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Deleting Corpse and spawned bones.");
// Map can be NULL
Map* map = corpse->FindMap();
diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h
index 92a7a24571e..0a1b41eb292 100755
--- a/src/server/game/Globals/ObjectAccessor.h
+++ b/src/server/game/Globals/ObjectAccessor.h
@@ -155,14 +155,14 @@ class ObjectAccessor
CellCoord p = Trinity::ComputeCellCoord(x, y);
if (!p.IsCoordValid())
{
- sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
+ sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
return NULL;
}
CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!q.IsCoordValid())
{
- sLog->outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
+ sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
}
@@ -191,6 +191,7 @@ class ObjectAccessor
// ACCESS LIKE THAT IS NOT THREAD SAFE
static Pet* FindPet(uint64);
static Player* FindPlayer(uint64);
+ static Creature* FindCreature(uint64);
static Unit* FindUnit(uint64);
static Player* FindPlayerByName(const char* name);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 9dea557f650..08a76008fde 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -296,8 +296,7 @@ void ObjectMgr::LoadCreatureLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItemsLocales()
@@ -333,8 +332,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointOfInterestLocales()
@@ -360,8 +358,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplates()
@@ -388,8 +385,7 @@ void ObjectMgr::LoadCreatureTemplates()
if (!result)
{
- sLog->outString(">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
return;
}
@@ -491,8 +487,7 @@ void ObjectMgr::LoadCreatureTemplates()
for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
CheckCreatureTemplate(&itr->second);
- sLog->outString(">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplateAddons()
@@ -504,8 +499,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (!result)
{
- sLog->outString(">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
return;
}
@@ -518,7 +512,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (!sObjectMgr->GetCreatureTemplate(entry))
{
- sLog->outErrorDb("Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry);
continue;
}
@@ -538,7 +532,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr)));
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr)));
continue;
}
creatureAddon.auras[i++] = uint32(atol(*itr));
@@ -548,14 +542,14 @@ void ObjectMgr::LoadCreatureTemplateAddons()
{
if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount);
creatureAddon.mount = 0;
}
}
if (!sEmotesStore.LookupEntry(creatureAddon.emote))
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote);
creatureAddon.emote = 0;
}
@@ -563,8 +557,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
@@ -582,7 +575,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
if (!difficultyInfo)
{
- sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
continue;
}
@@ -593,20 +586,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
ok2 = false;
if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end())
{
- sLog->outErrorDb("Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.",
cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1);
continue;
}
if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end())
{
- sLog->outErrorDb("Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end())
{
- sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
@@ -617,51 +610,51 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
if (cInfo->unit_class != difficultyInfo->unit_class)
{
- sLog->outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
continue;
}
if (cInfo->npcflag != difficultyInfo->npcflag)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_class != difficultyInfo->trainer_class)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_race != difficultyInfo->trainer_race)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_type != difficultyInfo->trainer_type)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_spell != difficultyInfo->trainer_spell)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (!difficultyInfo->AIName.empty())
{
- sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (difficultyInfo->ScriptID)
{
- sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
@@ -673,11 +666,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_A);
if (!factionTemplate)
- sLog->outErrorDb("Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A);
factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_H);
if (!factionTemplate)
- sLog->outErrorDb("Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H);
// used later for scale
CreatureDisplayInfoEntry const* displayScaleEntry = NULL;
@@ -687,7 +680,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
const_cast<CreatureTemplate*>(cInfo)->Modelid1 = 0;
}
else if (!displayScaleEntry)
@@ -695,7 +688,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry);
}
if (cInfo->Modelid2)
@@ -703,7 +696,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
const_cast<CreatureTemplate*>(cInfo)->Modelid2 = 0;
}
else if (!displayScaleEntry)
@@ -711,7 +704,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
}
if (cInfo->Modelid3)
@@ -719,7 +712,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
const_cast<CreatureTemplate*>(cInfo)->Modelid3 = 0;
}
else if (!displayScaleEntry)
@@ -727,7 +720,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry);
}
if (cInfo->Modelid4)
@@ -735,7 +728,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
const_cast<CreatureTemplate*>(cInfo)->Modelid4 = 0;
}
else if (!displayScaleEntry)
@@ -743,11 +736,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
}
if (!displayScaleEntry)
- sLog->outErrorDb("Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry);
for (int k = 0; k < MAX_KILL_CREDIT; ++k)
{
@@ -755,7 +748,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
if (!GetCreatureTemplate(cInfo->KillCredit[k]))
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0;
}
}
@@ -763,13 +756,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
}
if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
}
@@ -780,30 +773,30 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME;
if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
- sLog->outErrorDb("Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type);
const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
}
// must exist or used hidden but used in data horse case
if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM)
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family);
const_cast<CreatureTemplate*>(cInfo)->family = 0;
}
if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType);
const_cast<CreatureTemplate*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
}
if (cInfo->HoverHeight < 0.0f)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f;
}
@@ -812,7 +805,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId);
if (!vehId)
{
- sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0;
}
}
@@ -821,21 +814,21 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
if (!spellDataId)
- sLog->outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId);
}
for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
{
- sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
}
}
if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
}
@@ -843,7 +836,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
if (!GetEquipmentInfo(cInfo->equipmentId))
{
- sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId);
const_cast<CreatureTemplate*>(cInfo)->equipmentId = 0;
}
}
@@ -859,13 +852,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
if (cInfo->expansion > (MAX_CREATURE_BASE_HP - 1))
{
- sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
}
if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
{
- sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
}
@@ -881,8 +874,7 @@ void ObjectMgr::LoadCreatureAddons()
if (!result)
{
- sLog->outString(">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
return;
}
@@ -896,7 +888,7 @@ void ObjectMgr::LoadCreatureAddons()
CreatureData const* creData = GetCreatureData(guid);
if (!creData)
{
- sLog->outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid);
continue;
}
@@ -906,7 +898,7 @@ void ObjectMgr::LoadCreatureAddons()
if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id)
{
const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE;
- sLog->outErrorDb("Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
}
creatureAddon.mount = fields[2].GetUInt32();
@@ -922,7 +914,7 @@ void ObjectMgr::LoadCreatureAddons()
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
- sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
continue;
}
creatureAddon.auras[i++] = uint32(atol(*itr));
@@ -932,14 +924,14 @@ void ObjectMgr::LoadCreatureAddons()
{
if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
{
- sLog->outErrorDb("Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
creatureAddon.mount = 0;
}
}
if (!sEmotesStore.LookupEntry(creatureAddon.emote))
{
- sLog->outErrorDb("Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
creatureAddon.emote = 0;
}
@@ -947,8 +939,7 @@ void ObjectMgr::LoadCreatureAddons()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid)
@@ -986,8 +977,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!result)
{
- sLog->outString(">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
return;
}
@@ -1013,7 +1003,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!dbcItem)
{
- sLog->outErrorDb("Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.",
+ sLog->outError(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.",
equipmentInfo.ItemEntry[i], i+1, entry);
equipmentInfo.ItemEntry[i] = 0;
continue;
@@ -1029,7 +1019,7 @@ void ObjectMgr::LoadEquipmentTemplates()
dbcItem->InventoryType != INVTYPE_THROWN &&
dbcItem->InventoryType != INVTYPE_RANGEDRIGHT)
{
- sLog->outErrorDb("Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.",
+ sLog->outError(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.",
equipmentInfo.ItemEntry[i], i+1, entry);
equipmentInfo.ItemEntry[i] = 0;
}
@@ -1039,8 +1029,7 @@ void ObjectMgr::LoadEquipmentTemplates()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId)
@@ -1097,7 +1086,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display
{
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
if (!minfo_tmp)
- sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
+ sLog->outError(LOG_FILTER_SQL, "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
else
{
// Model ID changed
@@ -1117,8 +1106,7 @@ void ObjectMgr::LoadCreatureModelInfo()
if (!result)
{
- sLog->outString(">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
return;
}
@@ -1141,17 +1129,17 @@ void ObjectMgr::LoadCreatureModelInfo()
// Checks
if (!sCreatureDisplayInfoStore.LookupEntry(modelId))
- sLog->outErrorDb("Table `creature_model_info` has model for not existed display id (%u).", modelId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has model for not existed display id (%u).", modelId);
if (modelInfo.gender > GENDER_NONE)
{
- sLog->outErrorDb("Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId);
modelInfo.gender = GENDER_MALE;
}
if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender))
{
- sLog->outErrorDb("Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
modelInfo.modelid_other_gender = 0;
}
@@ -1162,8 +1150,7 @@ void ObjectMgr::LoadCreatureModelInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadLinkedRespawn()
@@ -1176,8 +1163,8 @@ void ObjectMgr::LoadLinkedRespawn()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
+
return;
}
@@ -1198,7 +1185,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* slave = GetCreatureData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1206,7 +1193,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* master = GetCreatureData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1214,14 +1201,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1235,7 +1222,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* slave = GetCreatureData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1243,7 +1230,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* master = GetGOData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1251,14 +1238,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1272,7 +1259,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* slave = GetGOData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1280,7 +1267,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* master = GetGOData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1288,14 +1275,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1309,7 +1296,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* slave = GetGOData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1317,7 +1304,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* master = GetCreatureData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1325,14 +1312,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1348,8 +1335,7 @@ void ObjectMgr::LoadLinkedRespawn()
}
while (result->NextRow());
- sLog->outString(">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
@@ -1374,13 +1360,13 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
return false;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
return false;
}
@@ -1408,8 +1394,8 @@ void ObjectMgr::LoadCreatures()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 creatures. DB table `creature` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures. DB table `creature` is empty.");
+
return;
}
@@ -1433,7 +1419,7 @@ void ObjectMgr::LoadCreatures()
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
- sLog->outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
continue;
}
@@ -1463,19 +1449,19 @@ void ObjectMgr::LoadCreatures()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid);
continue;
}
if (data.spawnMask & ~spawnMasks[data.mapid])
- sLog->outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end())
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id);
ok = false;
}
@@ -1488,7 +1474,7 @@ void ObjectMgr::LoadCreatures()
{
if (!GetEquipmentInfo(data.equipmentId))
{
- sLog->outErrorDb("Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
data.equipmentId = -1;
}
}
@@ -1496,19 +1482,19 @@ void ObjectMgr::LoadCreatures()
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
if (!mapEntry || !mapEntry->IsDungeon())
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id);
}
if (data.spawndist < 0.0f)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
else if (data.movementType == RANDOM_MOTION_TYPE)
{
if (data.spawndist == 0.0f)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
data.movementType = IDLE_MOTION_TYPE;
}
}
@@ -1516,14 +1502,14 @@ void ObjectMgr::LoadCreatures()
{
if (data.spawndist != 0.0f)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
}
if (data.phaseMask == 0)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
@@ -1535,8 +1521,7 @@ void ObjectMgr::LoadCreatures()
} while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
@@ -1606,7 +1591,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
GameObject* go = new GameObject;
if (!go->LoadGameObjectFromDB(guid, map))
{
- sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry);
+ sLog->outError(LOG_FILTER_GENERAL, "AddGOData: cannot add gameobject entry %u to map", entry);
delete go;
return 0;
}
@@ -1641,7 +1626,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
Creature* creature = new Creature;
if (!creature->LoadCreatureFromDB(guid, map))
{
- sLog->outError("AddCreature: cannot add creature entry %u to map", guid);
+ sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", guid);
delete creature;
return false;
}
@@ -1693,7 +1678,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
Creature* creature = new Creature;
if (!creature->LoadCreatureFromDB(guid, map))
{
- sLog->outError("AddCreature: cannot add creature entry %u to map", entry);
+ sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", entry);
delete creature;
return 0;
}
@@ -1718,8 +1703,8 @@ void ObjectMgr::LoadGameobjects()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
+
return;
}
@@ -1742,7 +1727,7 @@ void ObjectMgr::LoadGameobjects()
GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry);
if (!gInfo)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
continue;
}
@@ -1754,14 +1739,14 @@ void ObjectMgr::LoadGameobjects()
case GAMEOBJECT_TYPE_SPELL_FOCUS:
break;
default:
- sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
break;
}
}
if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
{
- sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
continue;
}
@@ -1782,13 +1767,13 @@ void ObjectMgr::LoadGameobjects()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
continue;
}
if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction())
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
}
data.animprogress = fields[12].GetUInt8();
@@ -1797,7 +1782,7 @@ void ObjectMgr::LoadGameobjects()
uint32 go_state = fields[13].GetUInt8();
if (go_state >= MAX_GO_STATE)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
continue;
}
data.go_state = GOState(go_state);
@@ -1805,7 +1790,7 @@ void ObjectMgr::LoadGameobjects()
data.spawnMask = fields[14].GetUInt8();
if (data.spawnMask & ~spawnMasks[data.mapid])
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
data.phaseMask = fields[15].GetUInt16();
int16 gameEvent = fields[16].GetInt8();
@@ -1813,25 +1798,25 @@ void ObjectMgr::LoadGameobjects()
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
continue;
}
if (data.rotation3 < -1.0f || data.rotation3 > 1.0f)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
continue;
}
if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation))
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id);
continue;
}
if (data.phaseMask == 0)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
@@ -1840,8 +1825,7 @@ void ObjectMgr::LoadGameobjects()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
@@ -1872,71 +1856,6 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
}
}
-void ObjectMgr::LoadCreatureRespawnTimes()
-{
- uint32 oldMSTime = getMSTime();
-
- uint32 count = 0;
-
- PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CREATURE_RESPAWNS));
- if (!result)
- {
- sLog->outString(">> Loaded 0 creature respawn time.");
- sLog->outString();
- return;
- }
-
- do
- {
- Field* fields = result->Fetch();
-
- uint32 loguid = fields[0].GetUInt32();
- uint32 respawn_time = fields[1].GetUInt32();
- uint32 instance = fields[2].GetUInt32();
-
- _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)] = time_t(respawn_time);
-
- ++count;
- } while (result->NextRow());
-
- sLog->outString(">> Loaded %lu creature respawn times in %u ms", (unsigned long)_creatureRespawnTimes.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-void ObjectMgr::LoadGameobjectRespawnTimes()
-{
- uint32 oldMSTime = getMSTime();
-
- // Remove outdated data
- CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE respawnTime <= UNIX_TIMESTAMP(NOW())");
-
- uint32 count = 0;
-
- PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_GO_RESPAWNS));
- if (!result)
- {
- sLog->outString(">> Loaded 0 gameobject respawn times. DB table `gameobject_respawn` is empty!");
- sLog->outString();
- return;
- }
-
- do
- {
- Field* fields = result->Fetch();
-
- uint32 loguid = fields[0].GetUInt32();
- uint32 respawn_time = fields[1].GetUInt32();
- uint32 instance = fields[2].GetUInt32();
-
- _goRespawnTimes[MAKE_PAIR64(loguid, instance)] = time_t(respawn_time);
-
- ++count;
- } while (result->NextRow());
-
- sLog->outString();
- sLog->outString(">> Loaded %lu gameobject respawn times in %u ms", (unsigned long)_goRespawnTimes.size(), GetMSTimeDiffToNow(oldMSTime));
-}
-
Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const
{
uint64 guid = MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER);
@@ -2074,8 +1993,7 @@ void ObjectMgr::LoadItemLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemTemplates()
@@ -2111,14 +2029,13 @@ void ObjectMgr::LoadItemTemplates()
// 118 119 120 121 122 123 124 125
"TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, "
// 126 127 128 129 130 131 132 133
- "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, "
+ "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, "
// 134 135 136
- "FoodType, minMoneyLoot, maxMoneyLoot FROM item_template");
+ "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom FROM item_template");
if (!result)
{
- sLog->outString(">> Loaded 0 item templates. DB table `item_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty.");
return;
}
@@ -2230,7 +2147,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.GemProperties = fields[126].GetUInt32();
itemTemplate.RequiredDisenchantSkill = uint32(fields[127].GetInt16());
itemTemplate.ArmorDamageModifier = fields[128].GetFloat();
- itemTemplate.Duration = fields[129].GetInt32();
+ itemTemplate.Duration = fields[129].GetUInt32();
itemTemplate.ItemLimitCategory = uint32(fields[130].GetInt16());
itemTemplate.HolidayId = fields[131].GetUInt32();
itemTemplate.ScriptId = sObjectMgr->GetScriptId(fields[132].GetCString());
@@ -2238,6 +2155,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.FoodType = uint32(fields[134].GetUInt8());
itemTemplate.MinMoneyLoot = fields[135].GetUInt32();
itemTemplate.MaxMoneyLoot = fields[136].GetUInt32();
+ itemTemplate.FlagsCu = fields[137].GetUInt32();
// Checks
@@ -2247,61 +2165,61 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Class != dbcitem->Class)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class);
if (enforceDBCAttributes)
itemTemplate.Class = dbcitem->Class;
}
if (itemTemplate.Unk0 != dbcitem->Unk0)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0);
if (enforceDBCAttributes)
itemTemplate.Unk0 = dbcitem->Unk0;
}
if (itemTemplate.Material != dbcitem->Material)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material);
if (enforceDBCAttributes)
itemTemplate.Material = dbcitem->Material;
}
if (itemTemplate.InventoryType != dbcitem->InventoryType)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType);
if (enforceDBCAttributes)
itemTemplate.InventoryType = dbcitem->InventoryType;
}
if (itemTemplate.DisplayInfoID != dbcitem->DisplayId)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId);
if (enforceDBCAttributes)
itemTemplate.DisplayInfoID = dbcitem->DisplayId;
}
if (itemTemplate.Sheath != dbcitem->Sheath)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath);
if (enforceDBCAttributes)
itemTemplate.Sheath = dbcitem->Sheath;
}
}
else
- sLog->outErrorDb("Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry);
if (itemTemplate.Class >= MAX_ITEM_CLASS)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class);
itemTemplate.Class = ITEM_CLASS_MISC;
}
if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class])
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class);
itemTemplate.SubClass = 0;// exist for all item classes
}
if (itemTemplate.Quality >= MAX_ITEM_QUALITY)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality);
itemTemplate.Quality = ITEM_QUALITY_NORMAL;
}
@@ -2309,36 +2227,36 @@ void ObjectMgr::LoadItemTemplates()
{
if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE))
if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0)
- sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY);
if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY)
- sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.",
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.",
entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY);
}
else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY)
{
if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE))
if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0)
- sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY);
}
if (itemTemplate.BuyCount <= 0)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount);
itemTemplate.BuyCount = 1;
}
if (itemTemplate.InventoryType >= MAX_INVTYPE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType);
itemTemplate.InventoryType = INVTYPE_NON_EQUIP;
}
if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill);
itemTemplate.RequiredSkill = 0;
}
@@ -2358,60 +2276,60 @@ void ObjectMgr::LoadItemTemplates()
if (req)
{
if (!(itemTemplate.AllowableClass & CLASSMASK_ALL_PLAYABLE))
- sLog->outErrorDb("Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass);
if (!(itemTemplate.AllowableRace & RACEMASK_ALL_PLAYABLE))
- sLog->outErrorDb("Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace);
}
}
if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell))
{
- sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell);
itemTemplate.RequiredSpell = 0;
}
if (itemTemplate.RequiredReputationRank >= MAX_REPUTATION_RANK)
- sLog->outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank);
if (itemTemplate.RequiredReputationFaction)
{
if (!sFactionStore.LookupEntry(itemTemplate.RequiredReputationFaction))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction);
itemTemplate.RequiredReputationFaction = 0;
}
if (itemTemplate.RequiredReputationRank == MIN_REPUTATION_RANK)
- sLog->outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry);
}
if (itemTemplate.MaxCount < -1)
{
- sLog->outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount);
itemTemplate.MaxCount = -1;
}
if (itemTemplate.Stackable == 0)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable);
itemTemplate.Stackable = 1;
}
else if (itemTemplate.Stackable < -1)
{
- sLog->outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable);
itemTemplate.Stackable = -1;
}
if (itemTemplate.ContainerSlots > MAX_BAG_SIZE)
{
- sLog->outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE);
itemTemplate.ContainerSlots = MAX_BAG_SIZE;
}
if (itemTemplate.StatsCount > MAX_ITEM_PROTO_STATS)
{
- sLog->outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS);
itemTemplate.StatsCount = MAX_ITEM_PROTO_STATS;
}
@@ -2420,7 +2338,7 @@ void ObjectMgr::LoadItemTemplates()
// for ItemStatValue != 0
if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
itemTemplate.ItemStat[j].ItemStatType = 0;
}
@@ -2428,7 +2346,7 @@ void ObjectMgr::LoadItemTemplates()
{
case ITEM_MOD_SPELL_HEALING_DONE:
case ITEM_MOD_SPELL_DAMAGE_DONE:
- sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
break;
default:
break;
@@ -2439,7 +2357,7 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType);
itemTemplate.Damage[j].DamageType = 0;
}
}
@@ -2450,7 +2368,7 @@ void ObjectMgr::LoadItemTemplates()
// spell_1
if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
itemTemplate.Spells[1].SpellId = 0;
@@ -2460,14 +2378,14 @@ void ObjectMgr::LoadItemTemplates()
// spell_2 have learning spell
if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
else if (!itemTemplate.Spells[1].SpellId)
{
- sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
@@ -2476,7 +2394,7 @@ void ObjectMgr::LoadItemTemplates()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId);
if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
@@ -2484,7 +2402,7 @@ void ObjectMgr::LoadItemTemplates()
// allowed only in special format
else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884))
{
- sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
@@ -2496,13 +2414,13 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
itemTemplate.Spells[j].SpellId = 0;
itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
else if (itemTemplate.Spells[j].SpellId != 0)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId);
itemTemplate.Spells[j].SpellId = 0;
}
}
@@ -2514,7 +2432,7 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
itemTemplate.Spells[j].SpellId = 0;
itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
@@ -2524,13 +2442,13 @@ void ObjectMgr::LoadItemTemplates()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId);
if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
itemTemplate.Spells[j].SpellId = 0;
}
// allowed only in special format
else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884))
{
- sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
itemTemplate.Spells[j].SpellId = 0;
}
}
@@ -2538,17 +2456,17 @@ void ObjectMgr::LoadItemTemplates()
}
if (itemTemplate.Bonding >= MAX_BIND_TYPE)
- sLog->outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding);
if (itemTemplate.PageText && !GetPageText(itemTemplate.PageText))
- sLog->outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText);
if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID))
- sLog->outErrorDb("Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID);
if (itemTemplate.Sheath >= MAX_SHEATHETYPE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath);
itemTemplate.Sheath = SHEATHETYPE_NONE;
}
@@ -2560,28 +2478,28 @@ void ObjectMgr::LoadItemTemplates()
else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomProperty)))
{
- sLog->outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty);
itemTemplate.RandomProperty = 0;
}
}
if (itemTemplate.RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomSuffix)))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix);
itemTemplate.RandomSuffix = 0;
}
if (itemTemplate.ItemSet && !sItemSetStore.LookupEntry(itemTemplate.ItemSet))
{
- sLog->outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet);
itemTemplate.ItemSet = 0;
}
if (itemTemplate.Area && !GetAreaEntryByAreaID(itemTemplate.Area))
- sLog->outErrorDb("Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area);
if (itemTemplate.Map && !sMapStore.LookupEntry(itemTemplate.Map))
- sLog->outErrorDb("Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map);
if (itemTemplate.BagFamily)
{
@@ -2595,7 +2513,7 @@ void ObjectMgr::LoadItemTemplates()
ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1);
if (!bf)
{
- sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry);
itemTemplate.BagFamily &= ~mask;
continue;
}
@@ -2605,7 +2523,7 @@ void ObjectMgr::LoadItemTemplates()
CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate.ItemId);
if (!ctEntry)
{
- sLog->outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry);
itemTemplate.BagFamily &= ~mask;
}
}
@@ -2613,38 +2531,44 @@ void ObjectMgr::LoadItemTemplates()
}
if (itemTemplate.TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate.TotemCategory))
- sLog->outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory);
for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j)
{
if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color);
itemTemplate.Socket[j].Color = 0;
}
}
if (itemTemplate.GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate.GemProperties))
- sLog->outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties);
if (itemTemplate.FoodType >= MAX_PET_DIET)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType);
itemTemplate.FoodType = 0;
}
if (itemTemplate.ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate.ItemLimitCategory))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory);
itemTemplate.ItemLimitCategory = 0;
}
if (itemTemplate.HolidayId && !sHolidaysStore.LookupEntry(itemTemplate.HolidayId))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId);
itemTemplate.HolidayId = 0;
}
+ if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry);
+ itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME;
+ }
+
++count;
}
while (result->NextRow());
@@ -2670,10 +2594,9 @@ void ObjectMgr::LoadItemTemplates()
}
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
- sLog->outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
- sLog->outString(">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry)
@@ -2708,8 +2631,7 @@ void ObjectMgr::LoadItemSetNameLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
} while (result->NextRow());
- sLog->outString(">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemSetNames()
@@ -2731,14 +2653,13 @@ void ObjectMgr::LoadItemSetNames()
if (setEntry->itemId[i])
itemSetItems.insert(setEntry->itemId[i]);
}
-
+
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT `entry`, `name`, `InventoryType` FROM `item_set_names`");
if (!result)
{
- sLog->outString(">> Loaded 0 item set names. DB table `item_set_names` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty.");
return;
}
@@ -2752,7 +2673,7 @@ void ObjectMgr::LoadItemSetNames()
uint32 entry = fields[0].GetUInt32();
if (itemSetItems.find(entry) == itemSetItems.end())
{
- sLog->outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
continue;
}
@@ -2762,7 +2683,7 @@ void ObjectMgr::LoadItemSetNames()
uint32 invType = fields[2].GetUInt8();
if (invType >= MAX_INVTYPE)
{
- sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
+ sLog->outError(LOG_FILTER_SQL, "Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
invType = INVTYPE_NON_EQUIP;
}
@@ -2781,19 +2702,18 @@ void ObjectMgr::LoadItemSetNames()
pProto = sObjectMgr->GetItemTemplate(entry);
if (pProto)
{
- sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry);
ItemSetNameEntry &data = _itemSetNameStore[entry];
data.name = pProto->Name1;
data.InventoryType = pProto->InventoryType;
++count;
}
else
- sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry);
}
}
- sLog->outString(">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleTemplateAccessories()
@@ -2809,8 +2729,8 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
+
return;
}
@@ -2827,19 +2747,19 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
if (!sObjectMgr->GetCreatureTemplate(uiEntry))
{
- sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
continue;
}
if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
{
- sLog->outErrorDb("Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
continue;
}
if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end())
{
- sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
continue;
}
@@ -2849,8 +2769,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleAccessories()
@@ -2866,8 +2785,7 @@ void ObjectMgr::LoadVehicleAccessories()
if (!result)
{
- sLog->outString(">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
return;
}
@@ -2884,7 +2802,7 @@ void ObjectMgr::LoadVehicleAccessories()
if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
{
- sLog->outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
continue;
}
@@ -2894,8 +2812,7 @@ void ObjectMgr::LoadVehicleAccessories()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetLevelInfo()
@@ -2907,8 +2824,8 @@ void ObjectMgr::LoadPetLevelInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
+
return;
}
@@ -2921,7 +2838,7 @@ void ObjectMgr::LoadPetLevelInfo()
uint32 creature_id = fields[0].GetUInt32();
if (!sObjectMgr->GetCreatureTemplate(creature_id))
{
- sLog->outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id);
+ sLog->outError(LOG_FILTER_SQL, "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id);
continue;
}
@@ -2929,17 +2846,17 @@ void ObjectMgr::LoadPetLevelInfo()
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog->outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
else
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
continue;
}
else if (current_level < 1)
{
- sLog->outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level);
continue;
}
@@ -2972,7 +2889,7 @@ void ObjectMgr::LoadPetLevelInfo()
// fatal error if no level 1 data
if (!pInfo || pInfo[0].health == 0)
{
- sLog->outErrorDb("Creature %u does not have pet stats data for Level 1!", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Creature %u does not have pet stats data for Level 1!", itr->first);
exit(1);
}
@@ -2981,14 +2898,13 @@ void ObjectMgr::LoadPetLevelInfo()
{
if (pInfo[level].health == 0)
{
- sLog->outErrorDb("Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level);
pInfo[level] = pInfo[level-1];
}
}
}
- sLog->outString(">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
@@ -3010,7 +2926,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3
else
{
if (count < -1)
- sLog->outErrorDb("Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
+ sLog->outError(LOG_FILTER_SQL, "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
uint32 RaceClass = (race_) | (class_ << 8);
bool doneOne = false;
@@ -3032,7 +2948,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3
}
if (!found)
- sLog->outErrorDb("Item %u specified to be removed from original create info not found in dbc!", itemId);
+ sLog->outError(LOG_FILTER_SQL, "Item %u specified to be removed from original create info not found in dbc!", itemId);
if (!doneOne)
doneOne = true;
@@ -3054,8 +2970,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outString();
- sLog->outErrorDb(">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
+
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
exit(1);
}
else
@@ -3077,39 +2993,39 @@ void ObjectMgr::LoadPlayerInfo()
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
continue;
}
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
if (!rEntry)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
continue;
}
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
continue;
}
if (!sChrClassesStore.LookupEntry(current_class))
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
continue;
}
// accept DB data only for valid position (and non instanceable)
if (!MapManager::IsValidMapCoord(mapId, positionX, positionY, positionZ, orientation))
{
- sLog->outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
continue;
}
if (sMapStore.LookupEntry(mapId)->Instanceable())
{
- sLog->outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
+ sLog->outError(LOG_FILTER_SQL, "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
continue;
}
@@ -3129,13 +3045,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate items
- sLog->outString("Loading Player Create Items Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3
@@ -3143,8 +3058,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outString(">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
}
else
{
@@ -3157,14 +3071,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class);
continue;
}
@@ -3172,7 +3086,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!GetItemTemplate(item_id))
{
- sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
+ sLog->outError(LOG_FILTER_SQL, "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
continue;
}
@@ -3180,7 +3094,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!amount)
{
- sLog->outErrorDb("Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class);
+ sLog->outError(LOG_FILTER_SQL, "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class);
continue;
}
@@ -3201,13 +3115,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate spells
- sLog->outString("Loading Player Create Spell Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3216,8 +3129,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
+
}
else
{
@@ -3230,14 +3143,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class);
continue;
}
@@ -3258,13 +3171,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate actions
- sLog->outString("Loading Player Create Action Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3273,8 +3185,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
+
}
else
{
@@ -3287,14 +3199,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class);
continue;
}
@@ -3305,13 +3217,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Loading levels data (class only dependent)
- sLog->outString("Loading Player Create Level HP/Mana Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3320,8 +3231,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
+
exit(1);
}
@@ -3334,14 +3245,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_class = fields[0].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class);
continue;
}
uint8 current_level = fields[1].GetUInt8(); // Can't be > than STRONG_MAX_LEVEL (hardcoded level maximum) due to var type
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
continue;
}
@@ -3372,7 +3283,7 @@ void ObjectMgr::LoadPlayerInfo()
// fatal error if no level 1 data
if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0)
{
- sLog->outErrorDb("Class %i Level 1 does not have health/mana data!", class_);
+ sLog->outError(LOG_FILTER_SQL, "Class %i Level 1 does not have health/mana data!", class_);
exit(1);
}
@@ -3381,18 +3292,17 @@ void ObjectMgr::LoadPlayerInfo()
{
if (pClassInfo->levelInfo[level].basehealth == 0)
{
- sLog->outErrorDb("Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level);
pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1];
}
}
}
- sLog->outString(">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading levels data (class/race dependent)
- sLog->outString("Loading Player Create Level Stats Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3401,8 +3311,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
+
exit(1);
}
@@ -3415,14 +3325,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `player_levelstats` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `player_levelstats` table, ignoring.", current_class);
continue;
}
@@ -3430,10 +3340,10 @@ void ObjectMgr::LoadPlayerInfo()
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog->outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
else
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
continue;
@@ -3485,7 +3395,7 @@ void ObjectMgr::LoadPlayerInfo()
// fatal error if no level 1 data
if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
{
- sLog->outErrorDb("Race %i Class %i Level 1 does not have stats data!", race, class_);
+ sLog->outError(LOG_FILTER_SQL, "Race %i Class %i Level 1 does not have stats data!", race, class_);
exit(1);
}
@@ -3494,19 +3404,18 @@ void ObjectMgr::LoadPlayerInfo()
{
if (pInfo->levelInfo[level].stats[0] == 0)
{
- sLog->outErrorDb("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level);
pInfo->levelInfo[level] = pInfo->levelInfo[level-1];
}
}
}
}
- sLog->outString(">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading xp per level data
- sLog->outString("Loading Player Create XP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3519,8 +3428,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
+
exit(1);
}
@@ -3536,10 +3445,10 @@ void ObjectMgr::LoadPlayerInfo()
if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog->outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level);
else
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
continue;
@@ -3555,13 +3464,12 @@ void ObjectMgr::LoadPlayerInfo()
{
if (_playerXPperLevel[level] == 0)
{
- sLog->outErrorDb("Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level);
_playerXPperLevel[level] = _playerXPperLevel[level-1]+100;
}
}
- sLog->outString(">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -3718,8 +3626,8 @@ void ObjectMgr::LoadQuests()
" FROM quest_template");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
+
return;
}
@@ -3748,18 +3656,18 @@ void ObjectMgr::LoadQuests()
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
if (qinfo->GetQuestMethod() >= 3)
- sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
{
- sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
qinfo->GetQuestId(), qinfo->Flags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20);
qinfo->Flags &= QUEST_TRINITY_FLAGS_DB_ALLOWED;
}
if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY)
{
- sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
qinfo->Flags &= ~QUEST_FLAGS_DAILY;
}
@@ -3767,7 +3675,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
- sLog->outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
@@ -3776,7 +3684,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
- sLog->outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
@@ -3788,7 +3696,7 @@ void ObjectMgr::LoadQuests()
{
if (uint32 id = qinfo->RewardChoiceItemId[j])
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest ignore this data
}
@@ -3800,7 +3708,7 @@ void ObjectMgr::LoadQuests()
{
if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort))
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
qinfo->GetQuestId(), qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client
}
@@ -3811,7 +3719,7 @@ void ObjectMgr::LoadQuests()
QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort));
if (!qSort)
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
qinfo->GetQuestId(), qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
}
@@ -3820,7 +3728,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredSkillId != skill_id)
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).",
qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id);
//override, and force proper value here?
}
@@ -3832,7 +3740,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
qinfo->RequiredClasses = 0;
}
}
@@ -3841,7 +3749,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces);
qinfo->RequiredRaces = 0;
}
}
@@ -3850,7 +3758,7 @@ void ObjectMgr::LoadQuests()
{
if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId))
{
- sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSkillId` = %u but this skill does not exist",
qinfo->GetQuestId(), qinfo->RequiredSkillId);
}
}
@@ -3859,7 +3767,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue())
{
- sLog->outErrorDb("Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue());
// no changes, quest can't be done for this requirement
}
@@ -3868,77 +3776,77 @@ void ObjectMgr::LoadQuests()
if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2))
{
- sLog->outErrorDb("Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1))
{
- sLog->outErrorDb("Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
{
- sLog->outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
{
- sLog->outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap)
{
- sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
{
- sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue);
// no changes, quest can't be done for this requirement
}
if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredFactionValue1);
// warning
}
if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredFactionValue2);
// warning
}
if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredMinRepValue);
// warning
}
if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredMaxRepValue);
// warning
}
if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId))
{
- sLog->outErrorDb("Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId());
qinfo->RewardTitleId = 0;
// quest can't reward this title
@@ -3948,20 +3856,20 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId))
{
- sLog->outErrorDb("Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->SourceItemId, qinfo->SourceItemId);
qinfo->SourceItemId = 0; // quest can't be done for this requirement
}
else if (qinfo->SourceItemIdCount == 0)
{
- sLog->outErrorDb("Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.",
qinfo->GetQuestId(), qinfo->SourceItemId);
qinfo->SourceItemIdCount = 1; // update to 1 for allow quest work for backward compatibility with DB
}
}
else if (qinfo->SourceItemIdCount>0)
{
- sLog->outErrorDb("Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.",
qinfo->GetQuestId(), qinfo->SourceItemIdCount);
qinfo->SourceItemIdCount=0; // no quest work changes in fact
}
@@ -3971,13 +3879,13 @@ void ObjectMgr::LoadQuests()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid);
qinfo->SourceSpellid = 0; // quest can't be done for this requirement
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
- sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.",
qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid);
qinfo->SourceSpellid = 0; // quest can't be done for this requirement
}
@@ -3990,7 +3898,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredItemCount[j] == 0)
{
- sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest can't be done for this requirement
}
@@ -3999,14 +3907,14 @@ void ObjectMgr::LoadQuests()
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest
}
}
else if (qinfo->RequiredItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]);
qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest
}
@@ -4019,7 +3927,7 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
// no changes, quest can't be done for this requirement
}
@@ -4028,7 +3936,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredSourceItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemCount[j]);
// no changes, quest ignore this data
}
@@ -4043,7 +3951,7 @@ void ObjectMgr::LoadQuests()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
continue;
}
@@ -4065,7 +3973,7 @@ void ObjectMgr::LoadQuests()
{
if (!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1);
+ sLog->outError(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1);
// this will prevent quest completing without objective
const_cast<Quest*>(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -4073,7 +3981,7 @@ void ObjectMgr::LoadQuests()
}
else
{
- sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1, id);
// no changes, quest can't be done for this requirement
}
@@ -4086,14 +3994,14 @@ void ObjectMgr::LoadQuests()
int32 id = qinfo->RequiredNpcOrGo[j];
if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id))
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, uint32(-id));
qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement
}
if (id > 0 && !sObjectMgr->GetCreatureTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, uint32(id));
qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement
}
@@ -4106,14 +4014,14 @@ void ObjectMgr::LoadQuests()
if (!qinfo->RequiredNpcOrGoCount[j])
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest can be incorrectly done, but we already report this
}
}
else if (qinfo->RequiredNpcOrGoCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredNpcOrGoCount[j]);
// no changes, quest ignore this data
}
@@ -4126,21 +4034,21 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(), j+1, id, id);
qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this
}
if (!qinfo->RewardChoiceItemCount[j])
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest can't be done
}
}
else if (qinfo->RewardChoiceItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]);
// no changes, quest ignore this data
}
@@ -4153,21 +4061,21 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(), j+1, id, id);
qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item
}
if (!qinfo->RewardItemIdCount[j])
{
- sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes
}
}
else if (qinfo->RewardItemIdCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemIdCount[j]);
// no changes, quest ignore this data
}
@@ -4179,18 +4087,18 @@ void ObjectMgr::LoadQuests()
{
if (abs(qinfo->RewardFactionValueId[j]) > 9)
{
- sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]);
}
if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j]))
{
- sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]);
qinfo->RewardFactionId[j] = 0; // quest will not reward this
}
}
else if (qinfo->RewardFactionValueIdOverride[j] != 0)
{
- sLog->outErrorDb("Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionValueIdOverride[j]);
// no changes, quest ignore this data
}
@@ -4202,21 +4110,21 @@ void ObjectMgr::LoadQuests()
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.",
qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
qinfo->RewardSpell = 0; // no spell reward will display for this quest
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
qinfo->RewardSpell = 0; // no spell reward will display for this quest
}
else if (GetTalentSpellCost(qinfo->RewardSpell))
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
qinfo->RewardSpell = 0; // no spell reward will display for this quest
}
@@ -4228,21 +4136,21 @@ void ObjectMgr::LoadQuests()
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast);
qinfo->RewardSpellCast = 0; // no spell will be casted on player
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
- sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast);
qinfo->RewardSpellCast = 0; // no spell will be casted on player
}
else if (GetTalentSpellCost(qinfo->RewardSpellCast))
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast);
qinfo->RewardSpellCast = 0; // no spell will be casted on player
}
@@ -4252,7 +4160,7 @@ void ObjectMgr::LoadQuests()
{
if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId))
{
- sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId);
qinfo->RewardMailTemplateId = 0; // no mail will send to player
qinfo->RewardMailDelay = 0; // no mail will send to player
@@ -4260,7 +4168,7 @@ void ObjectMgr::LoadQuests()
else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end())
{
std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId);
- sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second);
qinfo->RewardMailTemplateId = 0; // no mail will send to player
qinfo->RewardMailDelay = 0; // no mail will send to player
@@ -4274,7 +4182,7 @@ void ObjectMgr::LoadQuests()
QuestMap::iterator qNextItr = _questTemplates.find(qinfo->NextQuestIdChain);
if (qNextItr == _questTemplates.end())
{
- sLog->outErrorDb("Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.",
qinfo->GetQuestId(), qinfo->NextQuestIdChain, qinfo->NextQuestIdChain);
qinfo->NextQuestIdChain = 0;
}
@@ -4287,7 +4195,7 @@ void ObjectMgr::LoadQuests()
{
if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end())
{
- sLog->outErrorDb("Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
}
else
{
@@ -4300,7 +4208,7 @@ void ObjectMgr::LoadQuests()
QuestMap::iterator qNextItr = _questTemplates.find(abs(qinfo->GetNextQuestId()));
if (qNextItr == _questTemplates.end())
{
- sLog->outErrorDb("Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
}
else
{
@@ -4339,7 +4247,7 @@ void ObjectMgr::LoadQuests()
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -4347,8 +4255,7 @@ void ObjectMgr::LoadQuests()
}
}
- sLog->outString(">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestLocales()
@@ -4396,8 +4303,7 @@ void ObjectMgr::LoadQuestLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadScripts(ScriptsType type)
@@ -4415,7 +4321,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use.
return;
- sLog->outString("Loading %s...", tableName.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str());
scripts->clear(); // need for reload support
@@ -4425,8 +4331,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (!result)
{
- sLog->outString(">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
return;
}
@@ -4457,19 +4362,19 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
{
- sLog->outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.ChatType, tmp.id);
continue;
}
if (!tmp.Talk.TextID)
{
- sLog->outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.TextID, tmp.id);
continue;
}
if (tmp.Talk.TextID < MIN_DB_SCRIPT_STRING_ID || tmp.Talk.TextID >= MAX_DB_SCRIPT_STRING_ID)
{
- sLog->outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.TextID, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id);
continue;
}
@@ -4481,7 +4386,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID))
{
- sLog->outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",
tableName.c_str(), tmp.Emote.EmoteID, tmp.id);
continue;
}
@@ -4492,14 +4397,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID))
{
- sLog->outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
tableName.c_str(), tmp.TeleportTo.MapID, tmp.id);
continue;
}
if (!Trinity::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation))
{
- sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id);
continue;
}
@@ -4511,14 +4416,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID);
if (!quest)
{
- sLog->outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
continue;
}
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",
tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
// this will prevent quest completing without objective
@@ -4529,21 +4434,21 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
{
- sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
tableName.c_str(), tmp.QuestExplored.Distance, tmp.id);
continue;
}
if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
{
- sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE);
continue;
}
if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) < INTERACTION_DISTANCE)
{
- sLog->outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE);
continue;
}
@@ -4555,7 +4460,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry))
{
- sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",
tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id);
continue;
}
@@ -4567,7 +4472,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid);
if (!data)
{
- sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id);
continue;
}
@@ -4575,7 +4480,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
if (!info)
{
- sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id);
continue;
}
@@ -4586,7 +4491,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
info->type == GAMEOBJECT_TYPE_BUTTON ||
info->type == GAMEOBJECT_TYPE_TRAP)
{
- sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), info->entry, tmp.id);
continue;
}
@@ -4597,14 +4502,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!Trinity::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation))
{
- sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id);
continue;
}
if (!GetCreatureTemplate(tmp.TempSummonCreature.CreatureEntry))
{
- sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id);
continue;
}
@@ -4617,7 +4522,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid);
if (!data)
{
- sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",
tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
@@ -4625,14 +4530,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
if (!info)
{
- sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",
tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
if (info->type != GAMEOBJECT_TYPE_DOOR)
{
- sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject type (%u) non supported by command %s for script id %u",
tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
@@ -4644,13 +4549,13 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID))
{
- sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id);
continue;
}
if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1)
{
- sLog->outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
tableName.c_str(), tmp.RemoveAura.Flags, tmp.id);
continue;
}
@@ -4661,25 +4566,25 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID))
{
- sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.SpellID, tmp.id);
continue;
}
if (tmp.CastSpell.Flags > 4) // targeting type
{
- sLog->outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.Flags, tmp.id);
continue;
}
if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1)
{
- sLog->outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id);
continue;
}
else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry))
{
- sLog->outErrorDb("Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id);
continue;
}
@@ -4690,13 +4595,13 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!GetItemTemplate(tmp.CreateItem.ItemEntry))
{
- sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id);
continue;
}
if (!tmp.CreateItem.Amount)
{
- sLog->outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
tableName.c_str(), tmp.CreateItem.Amount, tmp.id);
continue;
}
@@ -4717,8 +4622,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
}
while (result->NextRow());
- sLog->outString(">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameObjectScripts()
@@ -4729,7 +4633,7 @@ void ObjectMgr::LoadGameObjectScripts()
for (ScriptMapMap::const_iterator itr = sGameObjectScripts.begin(); itr != sGameObjectScripts.end(); ++itr)
{
if (!GetGOData(itr->first))
- sLog->outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first);
}
}
@@ -4741,7 +4645,7 @@ void ObjectMgr::LoadQuestEndScripts()
for (ScriptMapMap::const_iterator itr = sQuestEndScripts.begin(); itr != sQuestEndScripts.end(); ++itr)
{
if (!GetQuestTemplate(itr->first))
- sLog->outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first);
}
}
@@ -4753,7 +4657,7 @@ void ObjectMgr::LoadQuestStartScripts()
for (ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr)
{
if (!GetQuestTemplate(itr->first))
- sLog->outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first);
}
}
@@ -4769,14 +4673,14 @@ void ObjectMgr::LoadSpellScripts()
if (!spellInfo)
{
- sLog->outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId);
continue;
}
uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
//check for correct spellEffect
if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY))
- sLog->outErrorDb("Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
}
}
@@ -4818,7 +4722,7 @@ void ObjectMgr::LoadEventScripts()
{
std::set<uint32>::const_iterator itr2 = evt_scripts.find(itr->first);
if (itr2 == evt_scripts.end())
- sLog->outErrorDb("Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u",
itr->first, SPELL_EFFECT_SEND_EVENT);
}
}
@@ -4849,7 +4753,7 @@ void ObjectMgr::LoadWaypointScripts()
}
for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr)
- sLog->outErrorDb("There is no waypoint which links to the waypoint script %u", *itr);
+ sLog->outError(LOG_FILTER_SQL, "There is no waypoint which links to the waypoint script %u", *itr);
}
void ObjectMgr::LoadSpellScriptNames()
@@ -4862,8 +4766,7 @@ void ObjectMgr::LoadSpellScriptNames()
if (!result)
{
- sLog->outString(">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
return;
}
@@ -4874,11 +4777,11 @@ void ObjectMgr::LoadSpellScriptNames()
Field* fields = result->Fetch();
- int32 spellId = fields[0].GetInt32();
+ int32 spellId = fields[0].GetInt32();
const char *scriptName = fields[1].GetCString();
bool allRanks = false;
- if (spellId <=0)
+ if (spellId <= 0)
{
allRanks = true;
spellId = -spellId;
@@ -4887,7 +4790,7 @@ void ObjectMgr::LoadSpellScriptNames()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
+ sLog->outError(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
continue;
}
@@ -4895,7 +4798,7 @@ void ObjectMgr::LoadSpellScriptNames()
{
if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId))
{
- sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
+ sLog->outError(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
while (spellInfo)
@@ -4910,8 +4813,7 @@ void ObjectMgr::LoadSpellScriptNames()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::ValidateSpellScripts()
@@ -4920,8 +4822,7 @@ void ObjectMgr::ValidateSpellScripts()
if (_spellScriptsStore.empty())
{
- sLog->outString(">> Validated 0 scripts.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts.");
return;
}
@@ -4941,7 +4842,7 @@ void ObjectMgr::ValidateSpellScripts()
bool valid = true;
if (!spellScript && !auraScript)
{
- sLog->outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
+ sLog->outError(LOG_FILTER_TSCR, "Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
valid = false;
}
if (spellScript)
@@ -4968,8 +4869,7 @@ void ObjectMgr::ValidateSpellScripts()
++count;
}
- sLog->outString(">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPageTexts()
@@ -4981,8 +4881,7 @@ void ObjectMgr::LoadPageTexts()
if (!result)
{
- sLog->outString(">> Loaded 0 page texts. DB table `page_text` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!");
return;
}
@@ -5006,13 +4905,12 @@ void ObjectMgr::LoadPageTexts()
{
PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPage);
if (itr2 == _pageTextStore.end())
- sLog->outErrorDb("Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage);
+ sLog->outError(LOG_FILTER_SQL, "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage);
}
}
- sLog->outString(">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PageText const* ObjectMgr::GetPageText(uint32 pageEntry)
@@ -5047,8 +4945,7 @@ void ObjectMgr::LoadPageTextLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadInstanceTemplate()
@@ -5060,8 +4957,7 @@ void ObjectMgr::LoadInstanceTemplate()
if (!result)
{
- sLog->outString(">> Loaded 0 instance templates. DB table `page_text` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!");
return;
}
@@ -5074,7 +4970,7 @@ void ObjectMgr::LoadInstanceTemplate()
if (!MapManager::IsValidMAP(mapID, true))
{
- sLog->outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
+ sLog->outError(LOG_FILTER_SQL, "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
continue;
}
@@ -5090,8 +4986,7 @@ void ObjectMgr::LoadInstanceTemplate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID)
@@ -5111,8 +5006,8 @@ void ObjectMgr::LoadInstanceEncounters()
QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 instance encounters, table is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 instance encounters, table is empty!");
+
return;
}
@@ -5128,13 +5023,13 @@ void ObjectMgr::LoadInstanceEncounters()
DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
if (!dungeonEncounter)
{
- sLog->outErrorDb("Table `instance_encounters` has an invalid encounter id %u, skipped!", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry);
continue;
}
if (lastEncounterDungeon && !sLFGDungeonStore.LookupEntry(lastEncounterDungeon))
{
- sLog->outErrorDb("Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon);
continue;
}
@@ -5143,7 +5038,7 @@ void ObjectMgr::LoadInstanceEncounters()
{
if (itr != dungeonLastBosses.end())
{
- sLog->outErrorDb("Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]);
continue;
}
@@ -5157,7 +5052,7 @@ void ObjectMgr::LoadInstanceEncounters()
CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry);
if (!creatureInfo)
{
- sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
@@ -5166,12 +5061,12 @@ void ObjectMgr::LoadInstanceEncounters()
case ENCOUNTER_CREDIT_CAST_SPELL:
if (!sSpellMgr->GetSpellInfo(creditEntry))
{
- sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
break;
default:
- sLog->outErrorDb("Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]);
continue;
}
@@ -5180,8 +5075,7 @@ void ObjectMgr::LoadInstanceEncounters()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const
@@ -5201,8 +5095,7 @@ void ObjectMgr::LoadGossipText()
int count = 0;
if (!result)
{
- sLog->outString(">> Loaded %u npc texts", count);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count);
return;
}
_gossipTextStore.rehash(result->GetRowCount());
@@ -5219,7 +5112,7 @@ void ObjectMgr::LoadGossipText()
uint32 Text_ID = fields[cic++].GetUInt32();
if (!Text_ID)
{
- sLog->outErrorDb("Table `npc_text` has record wit reserved id 0, ignore.");
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_text` has record wit reserved id 0, ignore.");
continue;
}
@@ -5241,8 +5134,7 @@ void ObjectMgr::LoadGossipText()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNpcTextLocales()
@@ -5284,8 +5176,7 @@ void ObjectMgr::LoadNpcTextLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
//not very fast function but it is called only once a day, or on starting-up
@@ -5296,7 +5187,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
time_t curTime = time(NULL);
tm* lt = localtime(&curTime);
uint64 basetime(curTime);
- sLog->outDetail("Returning mails current time: hour: %d, minute: %d, second: %d ", lt->tm_hour, lt->tm_min, lt->tm_sec);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Returning mails current time: hour: %d, minute: %d, second: %d ", lt->tm_hour, lt->tm_min, lt->tm_sec);
// Delete all old mails without item and without body immediately, if starting server
if (!serverUp)
@@ -5310,8 +5201,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outString(">> No expired mails found.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found.");
return; // any mails need to be returned or deleted
}
@@ -5414,8 +5304,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
}
while (result->NextRow());
- sLog->outString(">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestAreaTriggers()
@@ -5428,8 +5317,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
if (!result)
{
- sLog->outString(">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
return;
}
@@ -5447,7 +5335,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID);
continue;
}
@@ -5455,13 +5343,13 @@ void ObjectMgr::LoadQuestAreaTriggers()
if (!quest)
{
- sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
+ sLog->outError(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
continue;
}
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
+ sLog->outError(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -5473,8 +5361,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
} while (result->NextRow());
- sLog->outString(">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadTavernAreaTriggers()
@@ -5487,8 +5374,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
if (!result)
{
- sLog->outString(">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
return;
}
@@ -5505,15 +5391,14 @@ void ObjectMgr::LoadTavernAreaTriggers()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
_tavernAreaTriggerStore.insert(Trigger_ID);
} while (result->NextRow());
- sLog->outString(">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAreaTriggerScripts()
@@ -5525,8 +5410,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
if (!result)
{
- sLog->outString(">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
return;
}
@@ -5544,14 +5428,13 @@ void ObjectMgr::LoadAreaTriggerScripts()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
_areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName);
} while (result->NextRow());
- sLog->outString(">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team)
@@ -5646,7 +5529,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
mount_id = mount_info->GetRandomValidModelId();
if (!mount_id)
{
- sLog->outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
+ sLog->outError(LOG_FILTER_SQL, "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
return false;
}
}
@@ -5669,8 +5552,7 @@ void ObjectMgr::LoadGraveyardZones()
if (!result)
{
- sLog->outString(">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
return;
}
@@ -5689,35 +5571,34 @@ void ObjectMgr::LoadGraveyardZones()
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
if (!entry)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId);
continue;
}
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
if (!areaEntry)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId);
continue;
}
if (areaEntry->zone != 0)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId);
continue;
}
if (team != 0 && team != HORDE && team != ALLIANCE)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team);
continue;
}
if (!AddGraveYardLink(safeLocId, zoneId, team, false))
- sLog->outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
} while (result->NextRow());
- sLog->outString(">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team)
@@ -5744,7 +5625,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
{
if (z > -500)
{
- sLog->outError("ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
+ sLog->outError(LOG_FILTER_GENERAL, "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
return GetDefaultGraveYard(team);
}
}
@@ -5763,7 +5644,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
if (graveLow == graveUp && !map->IsBattleArena())
{
- sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
return GetDefaultGraveYard(team);
}
@@ -5789,7 +5670,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId);
if (!entry)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId);
continue;
}
@@ -5907,7 +5788,7 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
GraveYardContainer::iterator graveUp = GraveYardStore.upper_bound(zoneId);
if (graveLow == graveUp)
{
- //sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
+ //sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
return;
}
@@ -5962,8 +5843,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if (!result)
{
- sLog->outString(">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
return;
}
@@ -5988,20 +5868,20 @@ void ObjectMgr::LoadAreaTriggerTeleports()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId);
if (!mapEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId);
continue;
}
if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0)
{
- sLog->outErrorDb("Area trigger (ID:%u) target coordinates not provided.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) target coordinates not provided.", Trigger_ID);
continue;
}
@@ -6009,8 +5889,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
} while (result->NextRow());
- sLog->outString(">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAccessRequirements()
@@ -6023,8 +5902,7 @@ void ObjectMgr::LoadAccessRequirements()
QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
if (!result)
{
- sLog->outString(">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
return;
}
@@ -6056,7 +5934,7 @@ void ObjectMgr::LoadAccessRequirements()
ItemTemplate const* pProto = GetItemTemplate(ar.item);
if (!pProto)
{
- sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty);
+ sLog->outError(LOG_FILTER_GENERAL, "Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty);
ar.item = 0;
}
}
@@ -6066,7 +5944,7 @@ void ObjectMgr::LoadAccessRequirements()
ItemTemplate const* pProto = GetItemTemplate(ar.item2);
if (!pProto)
{
- sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty);
+ sLog->outError(LOG_FILTER_GENERAL, "Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty);
ar.item2 = 0;
}
}
@@ -6075,7 +5953,7 @@ void ObjectMgr::LoadAccessRequirements()
{
if (!GetQuestTemplate(ar.quest_A))
{
- sLog->outErrorDb("Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_A, mapid, difficulty);
+ sLog->outError(LOG_FILTER_SQL, "Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_A, mapid, difficulty);
ar.quest_A = 0;
}
}
@@ -6084,7 +5962,7 @@ void ObjectMgr::LoadAccessRequirements()
{
if (!GetQuestTemplate(ar.quest_H))
{
- sLog->outErrorDb("Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_H, mapid, difficulty);
+ sLog->outError(LOG_FILTER_SQL, "Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_H, mapid, difficulty);
ar.quest_H = 0;
}
}
@@ -6093,7 +5971,7 @@ void ObjectMgr::LoadAccessRequirements()
{
if (!sAchievementStore.LookupEntry(ar.achievement))
{
- sLog->outErrorDb("Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar.achievement, mapid, difficulty);
+ sLog->outError(LOG_FILTER_SQL, "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar.achievement, mapid, difficulty);
ar.achievement = 0;
}
}
@@ -6101,8 +5979,7 @@ void ObjectMgr::LoadAccessRequirements()
_accessRequirementStore[requirement_ID] = ar;
} while (result->NextRow());
- sLog->outString(">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
/*
@@ -6216,7 +6093,7 @@ uint32 ObjectMgr::GenerateAuctionID()
{
if (_auctionId >= 0xFFFFFFFE)
{
- sLog->outError("Auctions ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Auctions ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return _auctionId++;
@@ -6226,7 +6103,7 @@ uint64 ObjectMgr::GenerateEquipmentSetGuid()
{
if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL))
{
- sLog->outError("EquipmentSet guid overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "EquipmentSet guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return _equipmentSetGuid++;
@@ -6236,7 +6113,7 @@ uint32 ObjectMgr::GenerateMailID()
{
if (_mailId >= 0xFFFFFFFE)
{
- sLog->outError("Mail ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Mail ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return _mailId++;
@@ -6247,74 +6124,54 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
switch (guidhigh)
{
case HIGHGUID_ITEM:
- if (_hiItemGuid >= 0xFFFFFFFE)
- {
- sLog->outError("Item guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!");
return _hiItemGuid++;
+ }
case HIGHGUID_UNIT:
- if (_hiCreatureGuid >= 0x00FFFFFE)
- {
- sLog->outError("Creature guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!");
return _hiCreatureGuid++;
+ }
case HIGHGUID_PET:
- if (_hiPetGuid >= 0x00FFFFFE)
- {
- sLog->outError("Pet guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!");
return _hiPetGuid++;
+ }
case HIGHGUID_VEHICLE:
- if (_hiVehicleGuid >= 0x00FFFFFF)
- {
- sLog->outError("Vehicle guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!");
return _hiVehicleGuid++;
+ }
case HIGHGUID_PLAYER:
- if (_hiCharGuid >= 0xFFFFFFFE)
- {
- sLog->outError("Players guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!");
return _hiCharGuid++;
+ }
case HIGHGUID_GAMEOBJECT:
- if (_hiGoGuid >= 0x00FFFFFE)
- {
- sLog->outError("Gameobject guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!");
return _hiGoGuid++;
+ }
case HIGHGUID_CORPSE:
- if (_hiCorpseGuid >= 0xFFFFFFFE)
- {
- sLog->outError("Corpse guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!");
return _hiCorpseGuid++;
+ }
case HIGHGUID_DYNAMICOBJECT:
- if (_hiDoGuid >= 0xFFFFFFFE)
- {
- sLog->outError("DynamicObject guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!");
return _hiDoGuid++;
+ }
case HIGHGUID_MO_TRANSPORT:
- if (_hiMoTransGuid >= 0xFFFFFFFE)
- {
- sLog->outError("MO Transport guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
+ {
+ ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!");
return _hiMoTransGuid++;
+ }
default:
- ASSERT(0);
+ ASSERT(false && "ObjectMgr::GenerateLowGuid - Unknown HIGHGUID type");
+ return 0;
}
-
- ASSERT(0);
- return 0;
}
void ObjectMgr::LoadGameObjectLocales()
@@ -6346,8 +6203,7 @@ void ObjectMgr::LoadGameObjectLocales()
AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -6355,7 +6211,7 @@ inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32
if (sLockStore.LookupEntry(dataN))
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId);
}
@@ -6364,7 +6220,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN,
if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN))
{
if (trapInfo->type != GAMEOBJECT_TYPE_TRAP)
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP);
}
}
@@ -6374,7 +6230,7 @@ inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint3
if (sSpellMgr->GetSpellInfo(dataN))
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
goInfo->entry, goInfo->type, N, dataN, dataN);
}
@@ -6383,7 +6239,7 @@ inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo, uint32
if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR))
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
// prevent client and server unexpected work
@@ -6396,7 +6252,7 @@ inline void CheckGONoDamageImmuneId(GameObjectTemplate* goTemplate, uint32 dataN
if (dataN <= 1)
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN);
}
inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -6405,7 +6261,7 @@ inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, ui
if (dataN <= 1)
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.",
goInfo->entry, goInfo->type, N, dataN);
}
@@ -6423,8 +6279,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (!result)
{
- sLog->outString(">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
return;
}
@@ -6508,7 +6363,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (got.spellFocus.focusId)
{
if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId))
- sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId);
}
@@ -6526,7 +6381,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (got.goober.pageId) // pageId
{
if (!GetPageText(got.goober.pageId))
- sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
entry, got.type, got.goober.pageId, got.goober.pageId);
}
CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11);
@@ -6551,7 +6406,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (got.moTransport.taxiPathId)
{
if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty())
- sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId);
}
break;
@@ -6593,8 +6448,7 @@ void ObjectMgr::LoadGameObjectTemplate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadExplorationBaseXP()
@@ -6605,8 +6459,8 @@ void ObjectMgr::LoadExplorationBaseXP()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
+
return;
}
@@ -6622,8 +6476,7 @@ void ObjectMgr::LoadExplorationBaseXP()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetBaseXP(uint8 level)
@@ -6631,7 +6484,7 @@ uint32 ObjectMgr::GetBaseXP(uint8 level)
return _baseXPTable[level] ? _baseXPTable[level] : 0;
}
-uint32 ObjectMgr::GetXPForLevel(uint8 level)
+uint32 ObjectMgr::GetXPForLevel(uint8 level) const
{
if (level < _playerXPperLevel.size())
return _playerXPperLevel[level];
@@ -6646,8 +6499,7 @@ void ObjectMgr::LoadPetNames()
if (!result)
{
- sLog->outString(">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
return;
}
@@ -6667,8 +6519,7 @@ void ObjectMgr::LoadPetNames()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetNumber()
@@ -6682,8 +6533,7 @@ void ObjectMgr::LoadPetNumber()
_hiPetNumber = fields[0].GetUInt32()+1;
}
- sLog->outString(">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
}
std::string ObjectMgr::GeneratePetName(uint32 entry)
@@ -6716,8 +6566,7 @@ void ObjectMgr::LoadCorpses()
PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES));
if (!result)
{
- sLog->outString(">> Loaded 0 corpses. DB table `corpse` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty.");
return;
}
@@ -6729,7 +6578,7 @@ void ObjectMgr::LoadCorpses()
CorpseType type = CorpseType(fields[13].GetUInt8());
if (type >= MAX_CORPSE_TYPE)
{
- sLog->outError("Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type);
+ sLog->outError(LOG_FILTER_GENERAL, "Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type);
continue;
}
@@ -6745,8 +6594,7 @@ void ObjectMgr::LoadCorpses()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationRewardRate()
@@ -6760,8 +6608,8 @@ void ObjectMgr::LoadReputationRewardRate()
if (!result)
{
- sLog->outErrorDb(">> Loaded `reputation_reward_rate`, table is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!");
+
return;
}
@@ -6780,25 +6628,25 @@ void ObjectMgr::LoadReputationRewardRate()
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId);
continue;
}
if (repRate.quest_rate < 0.0f)
{
- sLog->outErrorDb("Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId);
continue;
}
if (repRate.creature_rate < 0.0f)
{
- sLog->outErrorDb("Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId);
continue;
}
if (repRate.spell_rate < 0.0f)
{
- sLog->outErrorDb("Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId);
continue;
}
@@ -6808,8 +6656,7 @@ void ObjectMgr::LoadReputationRewardRate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationOnKill()
@@ -6829,8 +6676,8 @@ void ObjectMgr::LoadReputationOnKill()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
+
return;
}
@@ -6853,7 +6700,7 @@ void ObjectMgr::LoadReputationOnKill()
if (!GetCreatureTemplate(creature_id))
{
- sLog->outErrorDb("Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id);
continue;
}
@@ -6862,7 +6709,7 @@ void ObjectMgr::LoadReputationOnKill()
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1);
if (!factionEntry1)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1);
continue;
}
}
@@ -6872,7 +6719,7 @@ void ObjectMgr::LoadReputationOnKill()
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2);
if (!factionEntry2)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2);
continue;
}
}
@@ -6882,8 +6729,7 @@ void ObjectMgr::LoadReputationOnKill()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationSpilloverTemplate()
@@ -6897,8 +6743,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!result)
{
- sLog->outString(">> Loaded `reputation_spillover_template`, table is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty.");
return;
}
@@ -6927,13 +6772,13 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!factionEntry)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId);
continue;
}
if (factionEntry->team == 0)
{
- sLog->outErrorDb("Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId);
continue;
}
@@ -6945,19 +6790,19 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!factionSpillover)
{
- sLog->outErrorDb("Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId);
+ sLog->outError(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId);
continue;
}
if (factionSpillover->reputationListID < 0)
{
- sLog->outErrorDb("Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
+ sLog->outError(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
continue;
}
if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK)
{
- sLog->outErrorDb("Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]);
+ sLog->outError(LOG_FILTER_SQL, "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]);
continue;
}
}
@@ -6966,25 +6811,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]);
if (repTemplate.faction[0] && !factionEntry0)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]);
continue;
}
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]);
if (repTemplate.faction[1] && !factionEntry1)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]);
continue;
}
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]);
if (repTemplate.faction[2] && !factionEntry2)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]);
continue;
}
FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]);
if (repTemplate.faction[3] && !factionEntry3)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]);
continue;
}
@@ -6994,8 +6839,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointsOfInterest()
@@ -7011,8 +6855,8 @@ void ObjectMgr::LoadPointsOfInterest()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
+
return;
}
@@ -7032,7 +6876,7 @@ void ObjectMgr::LoadPointsOfInterest()
if (!Trinity::IsValidMapCoord(POI.x, POI.y))
{
- sLog->outErrorDb("Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y);
+ sLog->outError(LOG_FILTER_SQL, "Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y);
continue;
}
@@ -7041,8 +6885,7 @@ void ObjectMgr::LoadPointsOfInterest()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestPOI()
@@ -7058,8 +6901,8 @@ void ObjectMgr::LoadQuestPOI()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
+
return;
}
@@ -7113,8 +6956,7 @@ void ObjectMgr::LoadQuestPOI()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNPCSpellClickSpells()
@@ -7127,8 +6969,8 @@ void ObjectMgr::LoadNPCSpellClickSpells()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
+
return;
}
@@ -7142,7 +6984,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry);
if (!cInfo)
{
- sLog->outErrorDb("Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
continue;
}
@@ -7150,13 +6992,13 @@ void ObjectMgr::LoadNPCSpellClickSpells()
SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellinfo)
{
- sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
+ sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
continue;
}
uint8 userType = fields[3].GetUInt16();
if (userType >= SPELL_CLICK_USER_MAX)
- sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
+ sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
uint8 castFlags = fields[2].GetUInt8();
SpellClickInfo info;
@@ -7176,51 +7018,12 @@ void ObjectMgr::LoadNPCSpellClickSpells()
{
if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end())
{
- sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry);
+ sLog->outError(LOG_FILTER_SQL, "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry);
const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
}
}
- sLog->outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t)
-{
- if (!t)
- {
- // Delete only
- RemoveCreatureRespawnTime(loguid, instance);
- return;
- }
-
- // This function can be called from various map threads concurrently
- {
- _creatureRespawnTimesMutex.acquire();
- _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)] = t;
- _creatureRespawnTimesMutex.release();
- }
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
- stmt->setUInt32(0, loguid);
- stmt->setUInt32(1, uint32(t));
- stmt->setUInt32(2, instance);
- CharacterDatabase.Execute(stmt);
-}
-
-void ObjectMgr::RemoveCreatureRespawnTime(uint32 loguid, uint32 instance)
-{
- // This function can be called from various map threads concurrently
- {
- _creatureRespawnTimesMutex.acquire();
- _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)] = 0;
- _creatureRespawnTimesMutex.release();
- }
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
- stmt->setUInt32(0, loguid);
- stmt->setUInt32(1, instance);
- CharacterDatabase.Execute(stmt);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::DeleteCreatureData(uint32 guid)
@@ -7233,81 +7036,6 @@ void ObjectMgr::DeleteCreatureData(uint32 guid)
_creatureDataStore.erase(guid);
}
-void ObjectMgr::SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t)
-{
- if (!t)
- {
- // Delete only
- RemoveGORespawnTime(loguid, instance);
- return;
- }
-
- // This function can be called from different map threads concurrently
- {
- _goRespawnTimesMutex.acquire();
- _goRespawnTimes[MAKE_PAIR64(loguid, instance)] = t;
- _goRespawnTimesMutex.release();
- }
-
- PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN);
- stmt->setUInt32(0, loguid);
- stmt->setUInt64(1, uint64(t));
- stmt->setUInt32(2, instance);
- CharacterDatabase.Execute(stmt);
-}
-
-void ObjectMgr::RemoveGORespawnTime(uint32 loguid, uint32 instance)
-{
- // This function can be called from different map threads concurrently
- {
- _goRespawnTimesMutex.acquire();
- _goRespawnTimes[MAKE_PAIR64(loguid, instance)] = 0;
- _goRespawnTimesMutex.release();
- }
-
- PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN);
- stmt->setUInt32(0, loguid);
- stmt->setUInt32(1, instance);
- CharacterDatabase.Execute(stmt);
-}
-
-void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance)
-{
- // This function can be called from different map threads concurrently
- RespawnTimes::iterator next;
-
- {
- _goRespawnTimesMutex.acquire();
- for (RespawnTimes::iterator itr = _goRespawnTimes.begin(); itr != _goRespawnTimes.end(); itr = next)
- {
- next = itr;
- ++next;
-
- if (GUID_HIPART(itr->first) == instance)
- _goRespawnTimes.erase(itr);
- }
- _goRespawnTimesMutex.release();
- }
- {
- _creatureRespawnTimesMutex.acquire();
- for (RespawnTimes::iterator itr = _creatureRespawnTimes.begin(); itr != _creatureRespawnTimes.end(); itr = next)
- {
- next = itr;
- ++next;
-
- if (GUID_HIPART(itr->first) == instance)
- _creatureRespawnTimes.erase(itr);
- }
- _creatureRespawnTimesMutex.release();
- }
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE);
- stmt->setUInt32(0, instance);
- CharacterDatabase.Execute(stmt);
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE);
- stmt->setUInt32(0, instance);
- CharacterDatabase.Execute(stmt);
-}
-
void ObjectMgr::DeleteGOData(uint32 guid)
{
// remove mapid*cellid -> guid_set map
@@ -7344,8 +7072,8 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
+
return;
}
@@ -7361,7 +7089,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
if (_questTemplates.find(quest) == _questTemplates.end())
{
- sLog->outErrorDb("Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id);
continue;
}
@@ -7373,8 +7101,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameobjectQuestRelations()
@@ -7385,9 +7112,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
{
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
- sLog->outErrorDb("Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
- sLog->outErrorDb("Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7399,9 +7126,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
{
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
- sLog->outErrorDb("Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
- sLog->outErrorDb("Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7413,9 +7140,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
{
CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
- sLog->outErrorDb("Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
- sLog->outErrorDb("Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7427,9 +7154,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
{
CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
- sLog->outErrorDb("Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
- sLog->outErrorDb("Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7443,8 +7170,7 @@ void ObjectMgr::LoadReservedPlayersNames()
if (!result)
{
- sLog->outString(">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
return;
}
@@ -7459,7 +7185,7 @@ void ObjectMgr::LoadReservedPlayersNames()
std::wstring wstr;
if (!Utf8toWStr (name, wstr))
{
- sLog->outError("Table `reserved_name` have invalid name: %s", name.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Table `reserved_name` have invalid name: %s", name.c_str());
continue;
}
@@ -7470,8 +7196,7 @@ void ObjectMgr::LoadReservedPlayersNames()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::IsReservedName(const std::string& name) const
@@ -7624,8 +7349,7 @@ void ObjectMgr::LoadGameObjectForQuests()
if (sObjectMgr->GetGameObjectTemplates()->empty())
{
- sLog->outString(">> Loaded 0 GameObjects for quests");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests");
return;
}
@@ -7673,8 +7397,7 @@ void ObjectMgr::LoadGameObjectForQuests()
}
}
- sLog->outString(">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
@@ -7688,7 +7411,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
{
if (end_value >= start_value)
{
- sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
return false;
}
@@ -7701,7 +7424,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
{
if (start_value >= end_value)
{
- sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
return false;
}
}
@@ -7720,10 +7443,10 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (!result)
{
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
- sLog->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
- sLog->outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
+
return false;
}
@@ -7737,12 +7460,12 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (entry == 0)
{
- sLog->outErrorDb("Table `%s` contain reserved entry 0, ignored.", table);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` contain reserved entry 0, ignored.", table);
continue;
}
else if (entry < start_value || entry >= end_value)
{
- sLog->outErrorDb("Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value);
continue;
}
@@ -7750,7 +7473,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (!data.Content.empty())
{
- sLog->outErrorDb("Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry);
continue;
}
@@ -7762,11 +7485,10 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
} while (result->NextRow());
if (min_value == MIN_TRINITY_STRING_ID)
- sLog->outString(">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outString(">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
return true;
}
@@ -7781,9 +7503,9 @@ const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx)
}
if (entry > 0)
- sLog->outErrorDb("Entry %i not found in `trinity_string` table.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Entry %i not found in `trinity_string` table.", entry);
else
- sLog->outErrorDb("Trinity string entry %i not found in DB.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Trinity string entry %i not found in DB.", entry);
return "<error>";
}
@@ -7797,8 +7519,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
+
return;
}
@@ -7813,7 +7535,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry);
if (!fArea)
{
- sLog->outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "AreaId %u defined in `skill_fishing_base_level` does not exist", entry);
continue;
}
@@ -7822,8 +7544,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names)
@@ -7906,8 +7627,8 @@ void ObjectMgr::LoadGameTele()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
+
return;
}
@@ -7930,13 +7651,13 @@ void ObjectMgr::LoadGameTele()
if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation))
{
- sLog->outErrorDb("Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str());
continue;
}
if (!Utf8toWStr(gt.name, gt.wnameLow))
{
- sLog->outErrorDb("Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id);
+ sLog->outError(LOG_FILTER_SQL, "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id);
continue;
}
@@ -7948,8 +7669,7 @@ void ObjectMgr::LoadGameTele()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@@ -8047,8 +7767,8 @@ void ObjectMgr::LoadMailLevelRewards()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
+
return;
}
@@ -8065,25 +7785,25 @@ void ObjectMgr::LoadMailLevelRewards()
if (level > MAX_LEVEL)
{
- sLog->outErrorDb("Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
continue;
}
if (!(raceMask & RACEMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
continue;
}
if (!sMailTemplateStore.LookupEntry(mailTemplateId))
{
- sLog->outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
continue;
}
if (!GetCreatureTemplate(senderEntry))
{
- sLog->outErrorDb("Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
continue;
}
@@ -8093,8 +7813,7 @@ void ObjectMgr::LoadMailLevelRewards()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
@@ -8105,32 +7824,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry);
return;
}
if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry);
return;
}
SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell);
if (!spellinfo)
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell);
return;
}
if (!SpellMgr::IsSpellValid(spellinfo))
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell);
return;
}
if (GetTalentSpellCost(spell))
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell);
return;
}
@@ -8158,7 +7877,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY
&& spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER)
{
- sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
continue;
}
@@ -8190,8 +7909,8 @@ void ObjectMgr::LoadTrainerSpell()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 Trainers. DB table `npc_trainer` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!");
+
return;
}
@@ -8214,8 +7933,7 @@ void ObjectMgr::LoadTrainerSpell()
}
while (result->NextRow());
- sLog->outString(">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors)
@@ -8271,8 +7989,8 @@ void ObjectMgr::LoadVendors()
QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC");
if (!result)
{
- sLog->outString();
- sLog->outErrorDb(">> Loaded 0 Vendors. DB table `npc_vendor` is empty!");
+
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!");
return;
}
@@ -8305,8 +8023,7 @@ void ObjectMgr::LoadVendors()
}
while (result->NextRow());
- sLog->outString(">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenu()
@@ -8319,8 +8036,8 @@ void ObjectMgr::LoadGossipMenu()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
+
return;
}
@@ -8337,7 +8054,7 @@ void ObjectMgr::LoadGossipMenu()
if (!GetGossipText(gMenu.text_id))
{
- sLog->outErrorDb("Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id);
continue;
}
@@ -8347,8 +8064,7 @@ void ObjectMgr::LoadGossipMenu()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItems()
@@ -8366,8 +8082,8 @@ void ObjectMgr::LoadGossipMenuItems()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
+
return;
}
@@ -8393,16 +8109,16 @@ void ObjectMgr::LoadGossipMenuItems()
if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
}
if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
gMenuItem.ActionPoiId = 0;
}
@@ -8411,8 +8127,7 @@ void ObjectMgr::LoadGossipMenuItems()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/)
@@ -8464,7 +8179,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
return false;
}
@@ -8475,7 +8190,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
if (skip_vendors)
skip_vendors->insert(vendor_entry);
@@ -8488,7 +8203,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
return false;
}
@@ -8497,7 +8212,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
return false;
}
@@ -8506,7 +8221,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
return false;
}
else if (maxcount == 0 && incrtime > 0)
@@ -8514,7 +8229,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
return false;
}
@@ -8527,7 +8242,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
else
- sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
return false;
}
@@ -8536,7 +8251,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (player)
ChatHandler(player).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
else
- sLog->outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
return false;
}
@@ -8575,8 +8290,8 @@ void ObjectMgr::LoadScriptNames()
if (!result)
{
- sLog->outString();
- sLog->outErrorDb(">> Loaded empty set of Script Names!");
+
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!");
return;
}
@@ -8590,8 +8305,7 @@ void ObjectMgr::LoadScriptNames()
while (result->NextRow());
std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end());
- sLog->outString(">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetScriptId(const char *name)
@@ -8623,7 +8337,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
case SCRIPT_COMMAND_TALK:
{
if (!GetTrinityStringLocale (itrM->second.Talk.TextID))
- sLog->outErrorDb("Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first);
if (ids.find(itrM->second.Talk.TextID) != ids.end())
ids.erase(itrM->second.Talk.TextID);
@@ -8649,7 +8363,7 @@ void ObjectMgr::LoadDbScriptStrings()
CheckScripts(ScriptsType(type), ids);
for (std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr)
- sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr);
+ sLog->outError(LOG_FILTER_SQL, "Table `db_script_string` has unused string id %u", *itr);
}
bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
@@ -8658,7 +8372,7 @@ bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
// start/end reversed for negative values
if (start_value > MAX_DB_SCRIPT_STRING_ID || end_value >= start_value)
{
- sLog->outErrorDb("Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1);
return false;
}
@@ -8694,8 +8408,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
if (!result)
{
- sLog->outString(">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
return;
}
@@ -8716,13 +8429,13 @@ void ObjectMgr::LoadCreatureClassLevelStats()
stats.BaseArmor = fields[6].GetInt16();
if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
- sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class);
+ sLog->outError(LOG_FILTER_SQL, "Creature base stats for level %u has invalid class %u", Level, Class);
for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i)
{
if (stats.BaseHealth[i] < 1)
{
- sLog->outErrorDb("Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i);
+ sLog->outError(LOG_FILTER_SQL, "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i);
stats.BaseHealth[i] = 1;
}
}
@@ -8739,12 +8452,11 @@ void ObjectMgr::LoadCreatureClassLevelStats()
for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl)
{
if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end())
- sLog->outErrorDb("Missing base stats for creature class %u level %u", itr->second.unit_class, lvl);
+ sLog->outError(LOG_FILTER_SQL, "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl);
}
}
- sLog->outString(">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeAchievements()
@@ -8755,8 +8467,8 @@ void ObjectMgr::LoadFactionChangeAchievements()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
+
return;
}
@@ -8770,9 +8482,9 @@ void ObjectMgr::LoadFactionChangeAchievements()
uint32 horde = fields[1].GetUInt32();
if (!sAchievementStore.LookupEntry(alliance))
- sLog->outErrorDb("Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance);
else if (!sAchievementStore.LookupEntry(horde))
- sLog->outErrorDb("Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde);
else
FactionChange_Achievements[alliance] = horde;
@@ -8780,8 +8492,7 @@ void ObjectMgr::LoadFactionChangeAchievements()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeItems()
@@ -8792,8 +8503,7 @@ void ObjectMgr::LoadFactionChangeItems()
if (!result)
{
- sLog->outString(">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
return;
}
@@ -8807,9 +8517,9 @@ void ObjectMgr::LoadFactionChangeItems()
uint32 horde = fields[1].GetUInt32();
if (!GetItemTemplate(alliance))
- sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance);
else if (!GetItemTemplate(horde))
- sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde);
else
FactionChange_Items[alliance] = horde;
@@ -8817,8 +8527,7 @@ void ObjectMgr::LoadFactionChangeItems()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeSpells()
@@ -8829,8 +8538,8 @@ void ObjectMgr::LoadFactionChangeSpells()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
+
return;
}
@@ -8844,9 +8553,9 @@ void ObjectMgr::LoadFactionChangeSpells()
uint32 horde = fields[1].GetUInt32();
if (!sSpellMgr->GetSpellInfo(alliance))
- sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
else if (!sSpellMgr->GetSpellInfo(horde))
- sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
else
FactionChange_Spells[alliance] = horde;
@@ -8854,8 +8563,7 @@ void ObjectMgr::LoadFactionChangeSpells()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeReputations()
@@ -8866,8 +8574,7 @@ void ObjectMgr::LoadFactionChangeReputations()
if (!result)
{
- sLog->outString(">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
return;
}
@@ -8881,9 +8588,9 @@ void ObjectMgr::LoadFactionChangeReputations()
uint32 horde = fields[1].GetUInt32();
if (!sFactionStore.LookupEntry(alliance))
- sLog->outErrorDb("Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance);
else if (!sFactionStore.LookupEntry(horde))
- sLog->outErrorDb("Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde);
else
FactionChange_Reputation[alliance] = horde;
@@ -8891,8 +8598,7 @@ void ObjectMgr::LoadFactionChangeReputations()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 0f2b2382007..da0d37cf27a 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -367,8 +367,6 @@ struct CellObjectGuids
typedef UNORDERED_MAP<uint32/*cell_id*/, CellObjectGuids> CellObjectGuidsMap;
typedef UNORDERED_MAP<uint32/*(mapid, spawnMode) pair*/, CellObjectGuidsMap> MapObjectGuids;
-typedef UNORDERED_MAP<uint64/*(instance, guid) pair*/, time_t> RespawnTimes;
-
// Trinity string ranges
#define MIN_TRINITY_STRING_ID 1 // 'trinity_string'
#define MAX_TRINITY_STRING_ID 2000000000
@@ -615,14 +613,14 @@ class ObjectMgr
Player* GetPlayerByLowGUID(uint32 lowguid) const;
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
- GameObjectTemplateContainer const* GetGameObjectTemplates() { return &_gameObjectTemplateStore; }
+ GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; }
int LoadReferenceVendor(int32 vendor, int32 item_id, std::set<uint32> *skip_vendors);
void LoadGameObjectTemplate();
void AddGameobjectInfo(GameObjectTemplate* goinfo);
CreatureTemplate const* GetCreatureTemplate(uint32 entry);
- CreatureTemplateContainer const* GetCreatureTemplates() { return &_creatureTemplateStore; }
+ CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; }
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId);
CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID);
static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL);
@@ -631,7 +629,7 @@ class ObjectMgr
CreatureAddon const* GetCreatureAddon(uint32 lowguid);
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
ItemTemplate const* GetItemTemplate(uint32 entry);
- ItemTemplateContainer const* GetItemTemplateStore() { return &_itemTemplateStore; }
+ ItemTemplateContainer const* GetItemTemplateStore() const { return &_itemTemplateStore; }
ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId)
{
@@ -789,13 +787,13 @@ class ObjectMgr
void LoadQuests();
void LoadQuestRelations()
{
- sLog->outString("Loading GO Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data...");
LoadGameobjectQuestRelations();
- sLog->outString("Loading GO End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data...");
LoadGameobjectInvolvedRelations();
- sLog->outString("Loading Creature Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data...");
LoadCreatureQuestRelations();
- sLog->outString("Loading Creature End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data...");
LoadCreatureInvolvedRelations();
}
void LoadGameobjectQuestRelations();
@@ -854,13 +852,11 @@ class ObjectMgr
void LoadCreatures();
void LoadLinkedRespawn();
bool SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid);
- void LoadCreatureRespawnTimes();
void LoadCreatureAddons();
void LoadCreatureModelInfo();
void LoadEquipmentTemplates();
void LoadGameObjectLocales();
void LoadGameobjects();
- void LoadGameobjectRespawnTimes();
void LoadItemTemplates();
void LoadItemLocales();
void LoadItemSetNames();
@@ -916,7 +912,7 @@ class ObjectMgr
std::string GeneratePetName(uint32 entry);
uint32 GetBaseXP(uint8 level);
- uint32 GetXPForLevel(uint8 level);
+ uint32 GetXPForLevel(uint8 level) const;
int32 GetFishingBaseSkillLevel(uint32 entry) const
{
@@ -1025,15 +1021,6 @@ class ObjectMgr
return &itr->second;
}
- bool IsGoOfSpecificEntrySpawned(uint32 entry) const
- {
- for (GameObjectDataContainer::const_iterator it = _gameObjectDataStore.begin(); it != _gameObjectDataStore.end(); ++it)
- if (it->second.id == entry)
- return true;
-
- return false;
- }
-
GameObjectData const* GetGOData(uint32 guid) const
{
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid);
@@ -1057,36 +1044,6 @@ class ObjectMgr
void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance);
void DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid);
- time_t GetLinkedRespawnTime(uint64 guid, uint32 instance)
- {
- uint64 linkedGuid = GetLinkedRespawnGuid(guid);
- switch (GUID_HIPART(linkedGuid))
- {
- case HIGHGUID_UNIT:
- return GetCreatureRespawnTime(GUID_LOPART(linkedGuid), instance);
- case HIGHGUID_GAMEOBJECT:
- return GetGORespawnTime(GUID_LOPART(linkedGuid), instance);
- default:
- return 0;
- }
- }
-
- time_t GetCreatureRespawnTime(uint32 loguid, uint32 instance)
- {
- TRINITY_GUARD(ACE_Thread_Mutex, _creatureRespawnTimesMutex);
- return _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)];
- }
- void SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t);
- void RemoveCreatureRespawnTime(uint32 loguid, uint32 instance);
- time_t GetGORespawnTime(uint32 loguid, uint32 instance)
- {
- TRINITY_GUARD(ACE_Thread_Mutex, _goRespawnTimesMutex);
- return _goRespawnTimes[MAKE_PAIR64(loguid, instance)];
- }
- void SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t);
- void RemoveGORespawnTime(uint32 loguid, uint32 instance);
- void DeleteRespawnTimeForInstance(uint32 instance);
-
// grid objects
void AddCreatureToGrid(uint32 guid, CreatureData const* data);
void RemoveCreatureFromGrid(uint32 guid, CreatureData const* data);
@@ -1141,7 +1098,7 @@ class ObjectMgr
void LoadScriptNames();
ScriptNameContainer &GetScriptNames() { return _scriptNamesStore; }
- const char * GetScriptName(uint32 id) { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
+ const char * GetScriptName(uint32 id) const { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
uint32 GetScriptId(const char *name);
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
@@ -1316,10 +1273,6 @@ class ObjectMgr
TrinityStringLocaleContainer _trinityStringLocaleStore;
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore;
PointOfInterestLocaleContainer _pointOfInterestLocaleStore;
- RespawnTimes _creatureRespawnTimes;
- ACE_Thread_Mutex _creatureRespawnTimesMutex;
- RespawnTimes _goRespawnTimes;
- ACE_Thread_Mutex _goRespawnTimesMutex;
CacheVendorItemContainer _cacheVendorItemStore;
CacheTrainerSpellContainer _cacheTrainerSpellStore;
diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h
index 08b66f6bb35..ad888b26dd3 100755
--- a/src/server/game/Grids/GridStates.h
+++ b/src/server/game/Grids/GridStates.h
@@ -32,7 +32,7 @@ class GridState
{
if (i_Magic != MAGIC_TESTVAL)
{
- sLog->outError("!!! GridState: Magic value gone !!!");
+ sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
return false;
}
return true;
@@ -40,6 +40,7 @@ class GridState
void setMagic() { i_Magic = MAGIC_TESTVAL; }
unsigned int i_Magic;
#endif
+ virtual ~GridState() {};
virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0;
};
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index ec79db769da..072db578220 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -943,7 +943,7 @@ namespace Trinity
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
- if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range))
+ if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -972,7 +972,7 @@ namespace Trinity
return;
// too far
- if (!u->IsWithinDistInMap(i_enemy, i_range))
+ if (!u->IsWithinDistInMap(i_funit, i_range))
return;
// only if see assisted creature's enemy
@@ -1287,7 +1287,7 @@ namespace Trinity
AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) {}
bool operator() (WorldObject* go)
{
- return m_pObject->IsWithinDist(go, m_fRange, false);
+ return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->InSamePhase(go);
}
private:
const WorldObject* m_pObject;
@@ -1325,11 +1325,16 @@ namespace Trinity
{
public:
UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID = 0) : _present(present), _spellId(spellId), _casterGUID(casterGUID) {}
- bool operator()(Unit* unit)
+ bool operator()(Unit* unit) const
{
return unit->HasAura(_spellId, _casterGUID) == _present;
}
+ bool operator()(WorldObject* object) const
+ {
+ return object->ToUnit() && object->ToUnit()->HasAura(_spellId, _casterGUID) == _present;
+ }
+
private:
bool _present;
uint32 _spellId;
diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
index 40b3863679b..e3cda4dd76d 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
@@ -251,9 +251,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->getSource()->InSamePhase(i_phaseMask))
- if (i_check(itr->getSource()))
- i_objects.push_back(itr->getSource());
+ if (i_check(itr->getSource()))
+ i_objects.push_back(itr->getSource());
}
template<class Check>
@@ -263,9 +262,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->getSource()->InSamePhase(i_phaseMask))
- if (i_check(itr->getSource()))
- i_objects.push_back(itr->getSource());
+ if (i_check(itr->getSource()))
+ i_objects.push_back(itr->getSource());
}
template<class Check>
@@ -275,9 +273,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->getSource()->InSamePhase(i_phaseMask))
- if (i_check(itr->getSource()))
- i_objects.push_back(itr->getSource());
+ if (i_check(itr->getSource()))
+ i_objects.push_back(itr->getSource());
}
template<class Check>
@@ -287,9 +284,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->getSource()->InSamePhase(i_phaseMask))
- if (i_check(itr->getSource()))
- i_objects.push_back(itr->getSource());
+ if (i_check(itr->getSource()))
+ i_objects.push_back(itr->getSource());
}
template<class Check>
@@ -299,9 +295,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->getSource()->InSamePhase(i_phaseMask))
- if (i_check(itr->getSource()))
- i_objects.push_back(itr->getSource());
+ if (i_check(itr->getSource()))
+ i_objects.push_back(itr->getSource());
}
// Gameobject searchers
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 519a53ad184..3b2d59dd998 100755
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -94,7 +94,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
{
T* obj = new T;
uint32 guid = *i_guid;
- //sLog->outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
+ //sLog->outInfo(LOG_FILTER_GENERAL, "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
if (!obj->LoadFromDB(guid, map))
{
delete obj;
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index c7648bf1ccc..fda04effbf5 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -34,6 +34,7 @@
#include "MapInstanced.h"
#include "Util.h"
#include "LFGMgr.h"
+#include "UpdateFieldFlags.h"
Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
@@ -58,7 +59,7 @@ Loot* Roll::getLoot()
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
-m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
+m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -72,7 +73,7 @@ Group::~Group()
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Group::~Group: battleground group being deleted.");
if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
- else sLog->outError("Group::~Group: battleground group is not linked to the correct battleground.");
+ else sLog->outError(LOG_FILTER_GENERAL, "Group::~Group: battleground group is not linked to the correct battleground.");
}
Rolls::iterator itr;
while (!RollId.empty())
@@ -103,7 +104,7 @@ bool Group::Create(Player* leader)
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
- m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
+ m_groupType = (isBGGroup() || isBFGroup()) ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
@@ -115,7 +116,7 @@ bool Group::Create(Player* leader)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -231,7 +232,7 @@ void Group::ConvertToLFG()
{
m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1);
m_lootMethod = NEED_BEFORE_GREED;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -250,7 +251,7 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -273,7 +274,7 @@ bool Group::AddInvite(Player* player)
if (!player || player->GetGroupInvite())
return false;
Group* group = player->GetGroup();
- if (group && group->isBGGroup())
+ if (group && (group->isBGGroup() || group->isBFGroup()))
group = player->GetOriginalGroup();
if (group)
return false;
@@ -370,8 +371,8 @@ bool Group::AddMember(Player* player)
if (player)
{
player->SetGroupInvite(NULL);
- if (player->GetGroup() && isBGGroup()) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
- player->SetBattlegroundRaid(this, subGroup);
+ if (player->GetGroup() && (isBGGroup() || isBFGroup())) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
+ player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
player->SetOriginalGroup(this, subGroup);
else //if player is not in group, then call set group
@@ -390,7 +391,7 @@ bool Group::AddMember(Player* player)
}
// insert into the table if we're not a battleground group
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER);
@@ -409,7 +410,7 @@ bool Group::AddMember(Player* player)
if (player)
{
- if (!IsLeader(player->GetGUID()) && !isBGGroup())
+ if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
@@ -437,6 +438,51 @@ bool Group::AddMember(Player* player)
if (isRaidGroup())
player->UpdateForQuestWorldObjects();
+ {
+ // Broadcast new player group member fields to rest of the group
+ player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+
+ UpdateData groupData;
+ WorldPacket groupDataPacket;
+
+ // Broadcast group members' fields to player
+ for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ if (itr->getSource() == player)
+ continue;
+
+ if (Player* member = itr->getSource())
+ {
+ if (player->HaveAtClient(member))
+ {
+ member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ member->BuildValuesUpdateBlockForPlayer(&groupData, player);
+ member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ }
+
+ if (member->HaveAtClient(player))
+ {
+ UpdateData newData;
+ WorldPacket newDataPacket;
+ player->BuildValuesUpdateBlockForPlayer(&newData, member);
+ if (newData.HasData())
+ {
+ newData.BuildPacket(&newDataPacket);
+ member->SendDirectMessage(&newDataPacket);
+ }
+ }
+ }
+ }
+
+ if (groupData.HasData())
+ {
+ groupData.BuildPacket(&groupDataPacket);
+ player->SendDirectMessage(&groupDataPacket);
+ }
+
+ player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ }
+
if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING);
}
@@ -454,15 +500,15 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
return m_memberSlots.size();
- // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
- if (GetMembersCount() > ((isBGGroup() || isLFGGroup()) ? 1u : 2u))
+ // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
+ if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (player)
{
// Battleground group handling
- if (isBGGroup())
- player->RemoveFromBattlegroundRaid();
+ if (isBGGroup() || isBFGroup())
+ player->RemoveFromBattlegroundOrBattlefieldRaid();
else
// Regular group
{
@@ -493,13 +539,13 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
// Remove player from group in DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
-
- stmt->setUInt32(0, GUID_LOPART(guid));
-
- CharacterDatabase.Execute(stmt);
-
- DelinkMember(guid);
+ if (!isBGGroup() && !isBFGroup())
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
+ stmt->setUInt32(0, GUID_LOPART(guid));
+ CharacterDatabase.Execute(stmt);
+ DelinkMember(guid);
+ }
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player)
@@ -525,7 +571,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
roll->playerVote.erase(itr2);
- CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, MAX_ROLL_TYPE);
+ CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE);
}
// Update subgroups
@@ -590,7 +636,7 @@ void Group::ChangeLeader(uint64 guid)
sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid);
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
// Remove the groups permanent instance bindings
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
@@ -650,8 +696,8 @@ void Group::Disband(bool hideDestroy /* = false */)
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
- if (isBGGroup())
- player->RemoveFromBattlegroundRaid();
+ if (isBGGroup() || isBFGroup())
+ player->RemoveFromBattlegroundOrBattlefieldRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -695,7 +741,7 @@ void Group::Disband(bool hideDestroy /* = false */)
RemoveAllInvites();
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -732,7 +778,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1));
data << uint64(r.itemGUID); // guid of rolled item
data << uint32(mapid); // 3.3.3 mapid
- data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
+ data << uint32(r.itemSlot); // itemslot
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
data << uint32(r.itemRandomSuffix); // randomSuffix
data << uint32(r.itemRandomPropId); // item random property ID
@@ -759,7 +805,7 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
WorldPacket data(SMSG_LOOT_START_ROLL, (8 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
data << uint64(r.itemGUID); // guid of rolled item
data << uint32(mapId); // 3.3.3 mapid
- data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
+ data << uint32(r.itemSlot); // itemslot
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
data << uint32(r.itemRandomSuffix); // randomSuffix
data << uint32(r.itemRandomPropId); // item random property ID
@@ -773,20 +819,20 @@ void Group::SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p,
p->GetSession()->SendPacket(&data);
}
-void Group::SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
+void Group::SendLootRoll(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
- data << uint64(SourceGuid); // guid of the item rolled
- data << uint32(0); // unknown, maybe amount of players
- data << uint64(TargetGuid);
- data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
- data << uint32(r.itemRandomSuffix); // randomSuffix
- data << uint32(r.itemRandomPropId); // Item random property ID
- data << uint8(RollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
- data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
- data << uint8(0); // auto pass on NeedBeforeGreed loot because player cannot use the object
+ data << uint64(sourceGuid); // guid of the item rolled
+ data << uint32(roll.itemSlot); // slot
+ data << uint64(targetGuid);
+ data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
+ data << uint32(roll.itemRandomSuffix); // randomSuffix
+ data << uint32(roll.itemRandomPropId); // Item random property ID
+ data << uint8(rollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
+ data << uint8(rollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
+ data << uint8(0); // 1: "You automatically passed on: %s because you cannot loot that item." - Possibly used in need befor greed
- for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
+ for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayer(itr->first);
if (!p || !p->GetSession())
@@ -797,19 +843,19 @@ void Group::SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber,
}
}
-void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
+void Group::SendLootRollWon(uint64 sourceGuid, uint64 targetGuid, uint8 rollNumber, uint8 rollType, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
- data << uint64(SourceGuid); // guid of the item rolled
- data << uint32(0); // unknown, maybe amount of players
- data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
- data << uint32(r.itemRandomSuffix); // randomSuffix
- data << uint32(r.itemRandomPropId); // Item random property
- data << uint64(TargetGuid); // guid of the player who won.
- data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL
- data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL
+ data << uint64(sourceGuid); // guid of the item rolled
+ data << uint32(roll.itemSlot); // slot
+ data << uint32(roll.itemid); // the itemEntryId for the item that shall be rolled for
+ data << uint32(roll.itemRandomSuffix); // randomSuffix
+ data << uint32(roll.itemRandomPropId); // Item random property
+ data << uint64(targetGuid); // guid of the player who won.
+ data << uint8(rollNumber); // rollnumber realted to SMSG_LOOT_ROLL
+ data << uint8(rollType); // rollType related to SMSG_LOOT_ROLL
- for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
+ for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
Player* p = ObjectAccessor::FindPlayer(itr->first);
if (!p || !p->GetSession())
@@ -820,11 +866,11 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb
}
}
-void Group::SendLootAllPassed(uint32 numberOfPlayers, Roll const& roll)
+void Group::SendLootAllPassed(Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
data << uint64(roll.itemGUID); // Guid of the item rolled
- data << uint32(numberOfPlayers); // The number of players rolling for it
+ data << uint32(roll.itemSlot); // Item loot slot
data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
data << uint32(roll.itemRandomPropId); // Item random property ID
data << uint32(roll.itemRandomSuffix); // Item random suffix ID
@@ -949,6 +995,64 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
else
i->is_underthreshold = true;
}
+
+ for (i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
+ {
+ if (!i->follow_loot_rules)
+ continue;
+
+ item = sObjectMgr->GetItemTemplate(i->itemid);
+ if (!item)
+ {
+ //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
+ continue;
+ }
+
+ uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ Roll* r = new Roll(newitemGUID, *i);
+
+ //a vector is filled with only near party members
+ for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* member = itr->getSource();
+ if (!member || !member->GetSession())
+ continue;
+
+ if (i->AllowedForPlayer(member))
+ {
+ if (member->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
+ {
+ r->totalPlayersRolling++;
+ r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
+ }
+ }
+ }
+
+ if (r->totalPlayersRolling > 0)
+ {
+ r->setLoot(loot);
+ r->itemSlot = itemSlot;
+
+ loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
+
+ SendLootStartRoll(60000, pLootedObject->GetMapId(), *r);
+
+ RollId.push_back(r);
+
+ if (Creature* creature = pLootedObject->ToCreature())
+ {
+ creature->m_groupLootTimer = 60000;
+ creature->lootingGroupLowGUID = GetLowGUID();
+ }
+ else if (GameObject* go = pLootedObject->ToGameObject())
+ {
+ go->m_groupLootTimer = 60000;
+ go->lootingGroupLowGUID = GetLowGUID();
+ }
+ }
+ else
+ delete r;
+ }
}
void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
@@ -1033,6 +1137,66 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
else
i->is_underthreshold = true;
}
+
+ for (std::vector<LootItem>::iterator i = loot->quest_items.begin(); i != loot->quest_items.end(); ++i, ++itemSlot)
+ {
+ if (!i->follow_loot_rules)
+ continue;
+
+ item = sObjectMgr->GetItemTemplate(i->itemid);
+ uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
+ Roll* r = new Roll(newitemGUID, *i);
+
+ for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* playerToRoll = itr->getSource();
+ if (!playerToRoll || !playerToRoll->GetSession())
+ continue;
+
+ bool allowedForPlayer = i->AllowedForPlayer(playerToRoll);
+ if (allowedForPlayer && playerToRoll->IsWithinDistInMap(lootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
+ {
+ r->totalPlayersRolling++;
+ r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
+ }
+ }
+
+ if (r->totalPlayersRolling > 0)
+ {
+ r->setLoot(loot);
+ r->itemSlot = itemSlot;
+
+ loot->quest_items[itemSlot - loot->items.size()].is_blocked = true;
+
+ //Broadcast Pass and Send Rollstart
+ for (Roll::PlayerVote::const_iterator itr = r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
+ {
+ Player* p = ObjectAccessor::FindPlayer(itr->first);
+ if (!p || !p->GetSession())
+ continue;
+
+ if (itr->second == PASS)
+ SendLootRoll(newitemGUID, p->GetGUID(), 128, ROLL_PASS, *r);
+ else
+ SendLootStartRollToPlayer(60000, lootedObject->GetMapId(), p, p->CanRollForItemInLFG(item, lootedObject) == EQUIP_ERR_OK, *r);
+ }
+
+ RollId.push_back(r);
+
+ if (Creature* creature = lootedObject->ToCreature())
+ {
+ creature->m_groupLootTimer = 60000;
+ creature->lootingGroupLowGUID = GetLowGUID();
+ }
+ else if (GameObject* go = lootedObject->ToGameObject())
+ {
+ go->m_groupLootTimer = 60000;
+ go->lootingGroupLowGUID = GetLowGUID();
+ }
+ }
+ else
+ delete r;
+ }
}
void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject)
@@ -1067,7 +1231,7 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject)
}
}
-void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers, uint8 Choice)
+void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice)
{
Rolls::iterator rollI = GetRoll(Guid);
if (rollI == RollId.end())
@@ -1108,7 +1272,7 @@ void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers
}
if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
- CountTheRoll(rollI, NumberOfPlayers);
+ CountTheRoll(rollI);
}
//called when roll timer expires
@@ -1117,7 +1281,7 @@ void Group::EndRoll(Loot* pLoot)
for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();)
{
if ((*itr)->getLoot() == pLoot) {
- CountTheRoll(itr, GetMembersCount()); //i don't have to edit player votes, who didn't vote ... he will pass
+ CountTheRoll(itr); //i don't have to edit player votes, who didn't vote ... he will pass
itr = RollId.begin();
}
else
@@ -1125,7 +1289,7 @@ void Group::EndRoll(Loot* pLoot)
}
}
-void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
+void Group::CountTheRoll(Rolls::iterator rollI)
{
Roll* roll = *rollI;
if (!roll->isValid()) // is loot already deleted ?
@@ -1165,7 +1329,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul);
ItemPosCountVec dest;
- LootItem* item = &(roll->getLoot()->items[roll->itemSlot]);
+ LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
if (msg == EQUIP_ERR_OK)
{
@@ -1214,7 +1378,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
{
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul);
- LootItem* item = &(roll->getLoot()->items[roll->itemSlot]);
+ LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
if (rollvote == GREED)
{
@@ -1248,10 +1412,10 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
}
else
{
- SendLootAllPassed(NumberOfPlayers, *roll);
+ SendLootAllPassed(*roll);
// remove is_blocked so that the item is lootable by all players
- LootItem* item = &(roll->getLoot()->items[roll->itemSlot]);
+ LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
if (item)
item->is_blocked = false;
}
@@ -1347,7 +1511,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
Player* member = ObjectAccessor::FindPlayer(citr->guid);
uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
- onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
+ onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr->name;
data << uint64(citr->guid); // guid
@@ -1438,7 +1602,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
SubGroupCounterIncrease(group);
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1489,7 +1653,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
SubGroupCounterDecrease(prevSubGroup);
// Preserve new sub group in database for non-raid groups
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1684,7 +1848,7 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
@@ -1708,7 +1872,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
@@ -1744,7 +1908,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
- if (isBGGroup())
+ if (isBGGroup() || isBFGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -1859,7 +2023,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, bool load)
{
- if (!save || isBGGroup())
+ if (!save || isBGGroup() || isBFGroup())
return NULL;
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
@@ -1927,7 +2091,7 @@ void Group::BroadcastGroupUpdate(void)
{
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
- sLog->outStaticDebug("-- Forced group value update for '%s'", pp->GetName());
+ sLog->outDebug(LOG_FILTER_GENERAL, "-- Forced group value update for '%s'", pp->GetName());
}
}
}
@@ -1989,6 +2153,11 @@ bool Group::isBGGroup() const
return m_bgGroup != NULL;
}
+bool Group::isBFGroup() const
+{
+ return m_bfGroup != NULL;
+}
+
bool Group::IsCreated() const
{
return GetMembersCount() > 0;
@@ -2076,20 +2245,6 @@ bool Group::HasFreeSlotSubGroup(uint8 subgroup) const
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE);
}
-Group::MemberSlotList const& Group::GetMemberSlots() const
-{
- return m_memberSlots;
-}
-
-GroupReference* Group::GetFirstMember()
-{
- return m_memberMgr.getFirst();
-}
-
-uint32 Group::GetMembersCount() const
-{
- return m_memberSlots.size();
-}
uint8 Group::GetMemberGroup(uint64 guid) const
{
@@ -2104,6 +2259,11 @@ void Group::SetBattlegroundGroup(Battleground* bg)
m_bgGroup = bg;
}
+void Group::SetBattlefieldGroup(Battlefield *bg)
+{
+ m_bfGroup = bg;
+}
+
void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 03f946cd3b6..de622a16301 100755
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -26,6 +26,8 @@
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Player.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
class Creature;
class GroupReference;
@@ -205,6 +207,7 @@ class Group
bool isLFGGroup() const;
bool isRaidGroup() const;
bool isBGGroup() const;
+ bool isBFGroup() const;
bool IsCreated() const;
uint64 GetLeaderGUID() const;
uint64 GetGUID() const;
@@ -230,15 +233,18 @@ class Group
bool SameSubGroup(Player const* member1, Player const* member2) const;
bool HasFreeSlotSubGroup(uint8 subgroup) const;
- MemberSlotList const& GetMemberSlots() const;
- GroupReference* GetFirstMember();
- uint32 GetMembersCount() const;
+ MemberSlotList const& GetMemberSlots() const { return m_memberSlots; }
+ GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); }
+ GroupReference const* GetFirstMember() const { return m_memberMgr.getFirst(); }
+ uint32 GetMembersCount() const { return m_memberSlots.size(); }
+
uint8 GetMemberGroup(uint64 guid) const;
void ConvertToLFG();
void ConvertToRaid();
void SetBattlegroundGroup(Battleground* bg);
+ void SetBattlefieldGroup(Battlefield* bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(uint64 guid, uint8 group);
@@ -276,14 +282,14 @@ class Group
void SendLootStartRollToPlayer(uint32 countDown, uint32 mapId, Player* p, bool canNeed, Roll const& r);
void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
- void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
+ void SendLootAllPassed(Roll const& roll);
void SendLooter(Creature* creature, Player* pLooter);
void GroupLoot(Loot* loot, WorldObject* pLootedObject);
void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject);
void MasterLoot(Loot* loot, WorldObject* pLootedObject);
Rolls::iterator GetRoll(uint64 Guid);
- void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers);
- void CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers, uint8 Choise);
+ void CountTheRoll(Rolls::iterator roll);
+ void CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choise);
void EndRoll(Loot* loot);
// related to disenchant rolls
@@ -322,6 +328,7 @@ class Group
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battleground* m_bgGroup;
+ Battlefield* m_bfGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index f372f08c941..77b3a304f6b 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -46,7 +46,7 @@ uint32 GroupMgr::GenerateNewGroupDbStoreId()
if (newStorageId == NextGroupDbStoreId)
{
- sLog->outError("Group storage ID overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Group storage ID overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
@@ -84,7 +84,7 @@ uint32 GroupMgr::GenerateGroupId()
{
if (NextGroupId >= 0xFFFFFFFE)
{
- sLog->outError("Group guid overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Group guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return NextGroupId++;
@@ -125,8 +125,7 @@ void GroupMgr::LoadGroups()
", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
if (!result)
{
- sLog->outString(">> Loaded 0 group definitions. DB table `groups` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!");
return;
}
@@ -151,11 +150,10 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outString("Loading Group members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group members...");
{
uint32 oldMSTime = getMSTime();
@@ -169,8 +167,7 @@ void GroupMgr::LoadGroups()
QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
if (!result)
{
- sLog->outString(">> Loaded 0 group members. DB table `group_member` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!");
return;
}
@@ -184,17 +181,16 @@ void GroupMgr::LoadGroups()
if (group)
group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8());
else
- sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32());
+ sLog->outError(LOG_FILTER_GENERAL, "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32());
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outString("Loading Group instance saves...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
@@ -203,8 +199,7 @@ void GroupMgr::LoadGroups()
"LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid");
if (!result)
{
- sLog->outString(">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
return;
}
@@ -218,14 +213,14 @@ void GroupMgr::LoadGroups()
MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16());
if (!mapEntry || !mapEntry->IsDungeon())
{
- sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16());
+ sLog->outError(LOG_FILTER_SQL, "Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16());
continue;
}
uint32 diff = fields[4].GetUInt8();
if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
- sLog->outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
+ sLog->outError(LOG_FILTER_SQL, "Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
}
@@ -235,7 +230,6 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Groups/GroupRefManager.h b/src/server/game/Groups/GroupRefManager.h
index 9bcc05f8724..d9fef8611de 100755
--- a/src/server/game/Groups/GroupRefManager.h
+++ b/src/server/game/Groups/GroupRefManager.h
@@ -28,7 +28,8 @@ class GroupReference;
class GroupRefManager : public RefManager<Group, Player>
{
public:
- GroupReference* getFirst() { return ((GroupReference*) RefManager<Group, Player>::getFirst()); }
+ GroupReference* getFirst() { return ((GroupReference*)RefManager<Group, Player>::getFirst()); }
+ GroupReference const* getFirst() const { return ((GroupReference const*)RefManager<Group, Player>::getFirst()); }
};
#endif
diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h
index 2048fd9cb0d..7960dd21035 100755
--- a/src/server/game/Groups/GroupReference.h
+++ b/src/server/game/Groups/GroupReference.h
@@ -35,6 +35,7 @@ class GroupReference : public Reference<Group, Player>
GroupReference() : Reference<Group, Player>(), iSubGroup(0) {}
~GroupReference() { unlink(); }
GroupReference* next() { return (GroupReference*)Reference<Group, Player>::next(); }
+ GroupReference const* next() const { return (GroupReference const*)Reference<Group, Player>::next(); }
uint8 getSubGroup() const { return iSubGroup; }
void setSubGroup(uint8 pSubGroup) { iSubGroup = pSubGroup; }
};
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 889174420c6..4df77f874f3 100755
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -51,7 +51,7 @@ void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, Guil
data << uint32(errCode);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)");
}
void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode)
@@ -60,10 +60,9 @@ void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode
data << uint32(errCode);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (MSG_SAVE_GUILD_EMBLEM)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_SAVE_GUILD_EMBLEM)");
}
-///////////////////////////////////////////////////////////////////////////////
// LogHolder
Guild::LogHolder::~LogHolder()
{
@@ -337,21 +336,21 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields)
uint32 itemEntry = fields[15].GetUInt32();
if (slotId >= GUILD_BANK_MAX_SLOTS)
{
- sLog->outError("Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_GUILD, "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
return false;
}
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- sLog->outError("Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_GUILD, "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
return false;
}
Item* pItem = NewItemOrBag(proto);
if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry))
{
- sLog->outError("Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_GUILD, "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM);
stmt->setUInt32(0, m_guildId);
@@ -599,7 +598,7 @@ bool Guild::Member::LoadFromDB(Field* fields)
if (!m_zoneId)
{
- sLog->outError("Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid));
+ sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid));
m_zoneId = Player::GetZoneIdFromDB(m_guid);
}
return true;
@@ -610,12 +609,12 @@ bool Guild::Member::CheckStats() const
{
if (m_level < 1)
{
- sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid));
+ sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid));
return false;
}
if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES)
{
- sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid));
+ sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid));
return false;
}
return true;
@@ -1220,17 +1219,16 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/)
session->SendPacket(&data);
else
BroadcastPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_ROSTER)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_ROSTER)");
}
void Guild::HandleQuery(WorldSession* session)
{
WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, 8 * 32 + 200); // Guess size
-
data << uint32(m_id);
data << m_name;
- for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks
+ for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Always show 10 ranks
{
if (i < _GetRanksSize())
data << m_ranks[i].GetName();
@@ -1239,10 +1237,10 @@ void Guild::HandleQuery(WorldSession* session)
}
m_emblemInfo.WritePacket(data);
- data << uint32(0); // Something new in WotLK
-
+ data << uint32(_GetRanksSize()); // Amount of ranks
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)");
+
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)");
}
void Guild::HandleSetMOTD(WorldSession* session, const std::string& motd)
@@ -1451,7 +1449,7 @@ void Guild::HandleInviteMember(WorldSession* session, const std::string& name)
data << m_name;
pInvitee->GetSession()->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INVITE)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_INVITE)");
}
void Guild::HandleAcceptMember(WorldSession* session)
@@ -1724,7 +1722,7 @@ void Guild::SendInfo(WorldSession* session) const
data << m_accountsNumber; // Number of accounts
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INFO)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_INFO)");
}
void Guild::SendEventLog(WorldSession* session) const
@@ -1774,7 +1772,7 @@ void Guild::SendBankTabsInfo(WorldSession* session) const
data << uint8(0); // Do not send tab content
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
}
void Guild::SendBankTabText(WorldSession* session, uint8 tabId) const
@@ -1914,13 +1912,13 @@ bool Guild::LoadBankEventLogFromDB(Field* fields)
{
if (!isMoneyTab)
{
- sLog->outError("GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId);
+ sLog->outError(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId);
return false;
}
}
else if (isMoneyTab)
{
- sLog->outError("GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id);
+ sLog->outError(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id);
return false;
}
pLog->LoadEvent(new BankEventLogEntry(
@@ -1943,7 +1941,7 @@ bool Guild::LoadBankTabFromDB(Field* fields)
uint8 tabId = fields[1].GetUInt8();
if (tabId >= _GetPurchasedTabsSize())
{
- sLog->outError("Invalid tab (tabId: %u) in guild bank, skipped.", tabId);
+ sLog->outError(LOG_FILTER_GUILD, "Invalid tab (tabId: %u) in guild bank, skipped.", tabId);
return false;
}
return m_bankTabs[tabId]->LoadFromDB(fields);
@@ -1954,7 +1952,7 @@ bool Guild::LoadBankItemFromDB(Field* fields)
uint8 tabId = fields[12].GetUInt8();
if (tabId >= _GetPurchasedTabsSize())
{
- sLog->outError("Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.",
+ sLog->outError(LOG_FILTER_GUILD, "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.",
fields[14].GetUInt32(), fields[15].GetUInt32());
return false;
}
@@ -1972,7 +1970,7 @@ bool Guild::Validate()
bool broken_ranks = false;
if (_GetRanksSize() < GUILD_RANKS_MIN_COUNT || _GetRanksSize() > GUILD_RANKS_MAX_COUNT)
{
- sLog->outError("Guild %u has invalid number of ranks, creating new...", m_id);
+ sLog->outError(LOG_FILTER_GUILD, "Guild %u has invalid number of ranks, creating new...", m_id);
broken_ranks = true;
}
else
@@ -1982,7 +1980,7 @@ bool Guild::Validate()
RankInfo* rankInfo = GetRankInfo(rankId);
if (rankInfo->GetId() != rankId)
{
- sLog->outError("Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId);
+ sLog->outError(LOG_FILTER_GUILD, "Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId);
broken_ranks = true;
}
}
@@ -2533,7 +2531,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm
/*
if (pItemSrc->GetCount() == 0)
{
- sLog->outCrash("Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!",
+ sLog->outFatal(LOG_FILTER_GENERAL, "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!",
player->GetName(), player->GetGUIDLow(), pItemSrc->GetEntry(), tabId, slotId, destTabId, destSlotId, pItemSrc->GetEntry());
//return; // Commented out for now, uncomment when it's verified that this causes a crash!!
}
@@ -2643,7 +2641,7 @@ void Guild::_SendBankContent(WorldSession* session, uint8 tabId) const
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
}
}
@@ -2658,7 +2656,7 @@ void Guild::_SendBankMoneyUpdate(WorldSession* session) const
data << uint8(0); // No items
BroadcastPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
}
void Guild::_SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const
@@ -2718,7 +2716,7 @@ void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const
player->GetSession()->SendPacket(&data);
}
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
}
}
@@ -2742,5 +2740,5 @@ void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* par
BroadcastPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GUILD_EVENT");
+ sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent SMSG_GUILD_EVENT");
}
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index 106be2a605d..cebcf6040f9 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -43,7 +43,7 @@ uint32 GuildMgr::GenerateGuildId()
{
if (NextGuildId >= 0xFFFFFFFE)
{
- sLog->outError("Guild ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GUILD, "Guild ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return NextGuildId++;
@@ -93,7 +93,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const
void GuildMgr::LoadGuilds()
{
// 1. Load all guilds
- sLog->outString("Loading guilds definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions...");
{
uint32 oldMSTime = getMSTime();
@@ -105,8 +105,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild definitions. DB table `guild` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty.");
return;
}
else
@@ -128,13 +127,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 2. Load all guild ranks
- sLog->outString("Loading guild ranks...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild ranks...");
{
uint32 oldMSTime = getMSTime();
@@ -146,8 +144,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
}
else
{
@@ -164,13 +161,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 3. Load all guild members
- sLog->outString("Loading guild members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild members...");
{
uint32 oldMSTime = getMSTime();
@@ -189,8 +185,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild members. DB table `guild_member` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty.");
}
else
{
@@ -208,13 +203,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 4. Load all guild bank tab rights
- sLog->outString("Loading bank tab rights...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights...");
{
uint32 oldMSTime = getMSTime();
@@ -226,8 +220,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
}
else
{
@@ -244,13 +237,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 5. Load all event logs
- sLog->outString("Loading guild event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -261,8 +253,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
}
else
{
@@ -279,13 +270,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 6. Load all bank event logs
- sLog->outString("Loading guild bank event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -297,8 +287,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
}
else
{
@@ -315,13 +304,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 7. Load all guild bank tabs
- sLog->outString("Loading guild bank tabs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs...");
{
uint32 oldMSTime = getMSTime();
@@ -333,8 +321,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
}
else
{
@@ -351,13 +338,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 8. Fill all guild bank tabs
- sLog->outString("Filling bank tabs with items...");
+ sLog->outInfo(LOG_FILTER_GUILD, "Filling bank tabs with items...");
{
uint32 oldMSTime = getMSTime();
@@ -371,8 +357,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
}
else
{
@@ -389,13 +374,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 9. Validate loaded guild data
- sLog->outString("Validating data of loaded guilds...");
+ sLog->outInfo(LOG_FILTER_GUILD, "Validating data of loaded guilds...");
{
uint32 oldMSTime = getMSTime();
@@ -412,7 +396,6 @@ void GuildMgr::LoadGuilds()
}
}
- sLog->outString(">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index ef537cb6198..f86dacbc55e 100755
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
@@ -135,7 +135,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
}
else
{
- sLog->outError("Addon packet uncompress error :(");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Addon packet uncompress error :(");
return false;
}
return true;
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index d26f275b864..2ebcbce0661 100755
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -161,7 +161,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
etime *= MINUTE;
- switch(etime)
+ switch (etime)
{
case 1*MIN_AUCTION_TIME:
case 2*MIN_AUCTION_TIME:
@@ -247,11 +247,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
}
AH->item_guidlow = item->GetGUIDLow();
AH->item_template = item->GetEntry();
+ AH->itemCount = item->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
AH->bidder = 0;
@@ -261,7 +262,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- sLog->outDetail("CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(item);
auctionHouse->AddAuction(AH);
@@ -284,7 +285,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
Item* newItem = item->CloneItem(finalCount, _player);
if (!newItem)
{
- sLog->outError("CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry());
+ sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry());
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
return;
}
@@ -292,11 +293,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
}
AH->item_guidlow = newItem->GetGUIDLow();
AH->item_template = newItem->GetEntry();
+ AH->itemCount = newItem->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
AH->bidder = 0;
@@ -306,7 +308,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- sLog->outDetail("CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(newItem);
auctionHouse->AddAuction(AH);
@@ -520,18 +522,15 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
player->ModifyMoney(-int32(auctionCut));
}
- // Return the item by mail
- std::ostringstream msgAuctionCanceledOwner;
- msgAuctionCanceledOwner << auction->item_template << ":0:" << AUCTION_CANCELED << ":0:0";
// item will deleted or added to received mail list
- MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
.AddItem(pItem)
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
}
else
{
- sLog->outError("Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
return;
}
@@ -540,7 +539,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
{
SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
//this code isn't possible ... maybe there should be assert
- sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
return;
}
@@ -572,7 +571,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
recv_data >> outbiddedCount;
if (recv_data.size() != (16 + outbiddedCount * 4))
{
- sLog->outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4));
outbiddedCount = 0;
}
diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp
index 9a3e756dda3..49027bdf497 100755
--- a/src/server/game/Handlers/AuthHandler.cpp
+++ b/src/server/game/Handlers/AuthHandler.cpp
@@ -31,7 +31,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos)
if (!shortForm)
{
packet << uint32(queuePos); // Queue position
- packet << uint8(0); // Unk 3.3.0
+ packet << uint8(0); // Realm has a free character migration - bool
}
SendPacket(&packet);
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index a0c5268136b..475c1c42fca 100755
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -86,7 +86,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
- sLog->outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow());
return;
}
@@ -366,13 +366,13 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
GroupQueueInfo ginfo;
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
{
- sLog->outError("BattlegroundHandler: itrplayerstatus not found.");
+ sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: itrplayerstatus not found.");
return;
}
// if action == 1, then instanceId is required
if (!ginfo.IsInvitedToBGInstanceGUID && action == 1)
{
- sLog->outError("BattlegroundHandler: instance not found.");
+ sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: instance not found.");
return;
}
@@ -383,7 +383,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
if (!bg)
{
- sLog->outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: bg_template not found for type id %u.", bgTypeId);
return;
}
@@ -408,7 +408,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
if (_player->getLevel() > bg->GetMaxLevel())
{
- sLog->outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
_player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());
action = 0;
}
@@ -478,7 +478,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
break;
default:
- sLog->outError("Battleground port: unknown action %u", action);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Battleground port: unknown action %u", action);
break;
}
}
@@ -565,46 +565,6 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
}
}
-void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
-{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
-
- Battleground* bg = _player->GetBattleground();
-
- uint64 guid;
- recv_data >> guid;
-
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
- if (!unit)
- return;
-
- if (!unit->isSpiritService()) // it's not spirit service
- return;
-
- if (bg)
- sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
-}
-
-void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
-{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
-
- Battleground* bg = _player->GetBattleground();
-
- uint64 guid;
- recv_data >> guid;
-
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
- if (!unit)
- return;
-
- if (!unit->isSpiritService()) // it's not spirit service
- return;
-
- if (bg)
- bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
-}
-
void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
@@ -644,7 +604,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
arenatype = ARENA_TYPE_5v5;
break;
default:
- sLog->outError("Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot);
return;
}
@@ -652,7 +612,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
if (!bg)
{
- sLog->outError("Battleground: template bg (all arenas) not found");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: template bg (all arenas) not found");
return;
}
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index d1277d154cc..e83f0f55a44 100755
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -20,7 +20,7 @@
----- Opcodes Not Used yet -----
SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction()
-SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) <--- Structure unknown, using LOCKOUT_ADDED
+SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save)
----- Opcodes without Sniffs -----
SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ]
@@ -73,8 +73,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
}
else
{
- sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it);
- data << uint64(0) << uint64(0) << uint8(0) << uint8(0);
+ sLog->outError(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it);
+ data << uint64(0);
+ data << uint64(0);
+ data << uint8(0);
+ data << uint8(0);
+ data << uint8(0);
data.appendPackGUID(0);
}
}
@@ -95,9 +99,13 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
}
else
{
- sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it);
- data << uint64(0) << uint8(0) << uint32(0)
- << uint32(0) << uint32(0) << uint32(0);
+ sLog->outError(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it);
+ data << uint64(0);
+ data << uint8(0);
+ data << uint32(0);
+ data << uint32(0);
+ data << uint32(0);
+ data << uint32(0);
data.appendPackGUID(0);
}
}
@@ -243,7 +251,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
if (inviteCount != 1 || invitee != guid)
{
- sLog->outError("HandleCalendarAddEvent: [" UI64FMTD
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleCalendarAddEvent: [" UI64FMTD
"]: More than one invite (%d) or Invitee [" UI64FMTD
"] differs", guid, inviteCount, invitee);
return;
@@ -635,7 +643,7 @@ void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, Calenda
data << uint8(0) << uint8(0) << uint8(0) << uint8(0)
<< uint64(0) << uint32(0) << uint8(0);
- sLog->outError("SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it);
+ sLog->outError(LOG_FILTER_NETWORKIO, "SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it);
}
}
SendPacket(&data);
@@ -835,26 +843,6 @@ void WorldSession::SendCalendarClearPendingAction()
SendPacket(&data);
}
-void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
-{
- if (!save)
- return;
-
- uint64 guid = _player->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
- "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
-
- time_t cur_time = time_t(time(NULL));
-
- WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
- data << secsToTimeBitFields(cur_time);
- data << uint32(save->GetMapId());
- data << uint32(save->GetDifficulty());
- data << uint32(save->GetResetTime() - cur_time);
- data << uint64(save->GetInstanceId());
- SendPacket(&data);
-}
-
void WorldSession::SendCalendarCommandResult(CalendarError err, char const* param /*= NULL*/)
{
uint64 guid = _player->GetGUID();
@@ -898,3 +886,23 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
data << uint64(save->GetInstanceId());
SendPacket(&data);
}
+
+void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
+{
+ if (!save)
+ return;
+
+ uint64 guid = _player->GetGUID();
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
+ "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
+
+ time_t cur_time = time_t(time(NULL));
+
+ WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
+ data << secsToTimeBitFields(cur_time);
+ data << uint32(save->GetMapId());
+ data << uint32(save->GetDifficulty());
+ data << uint32(0); // Amount of seconds that has changed to the reset time
+ data << uint32(save->GetResetTime() - cur_time);
+ SendPacket(&data);
+}
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 2d70efd3305..8544266840f 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -215,7 +215,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
do
{
uint32 guidlow = (*result)[0].GetUInt32();
- sLog->outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId());
if (Player::BuildEnumData(result, &data))
{
_allowedCharsToLogin.insert(guidlow);
@@ -293,7 +293,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket(&data);
- sLog->outError("Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
return;
}
@@ -302,7 +302,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket(&data);
- sLog->outError("Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
return;
}
@@ -310,7 +310,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
if (raceEntry->expansion > Expansion())
{
data << (uint8)CHAR_CREATE_EXPANSION;
- sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
SendPacket(&data);
return;
}
@@ -319,7 +319,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
if (classEntry->expansion > Expansion())
{
data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
- sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
SendPacket(&data);
return;
}
@@ -348,7 +348,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
{
data << (uint8)CHAR_NAME_NO_NAME;
SendPacket(&data);
- sLog->outError("Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
return;
}
@@ -658,8 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
SendPacket(&data);
std::string IP_str = GetRemoteAddress();
- sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
- sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass());
@@ -687,7 +686,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sGuildMgr->GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
+ data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER);
SendPacket(&data);
return;
}
@@ -696,18 +695,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
+ data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN);
SendPacket(&data);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID);
-
stmt->setUInt32(0, GUID_LOPART(guid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (result)
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -719,22 +715,25 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
return;
std::string IP_str = GetRemoteAddress();
- sLog->outDetail("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
- sLog->outChar("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
sScriptMgr->OnPlayerDelete(guid);
sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
- if (sLog->IsOutCharDump()) // optimize GetPlayerDump call
+ if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ {
+ std::ostringstream ss;
+ ss << GetAccountId() << '_' << name.c_str();
+ sLog->outCharDump(ss.str().c_str(), dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ }
}
Player::DeleteFromDB(guid, GetAccountId());
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_SUCCESS;
+ data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
}
@@ -742,20 +741,20 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data)
{
if (PlayerLoading() || GetPlayer() != NULL)
{
- sLog->outError("Player tryes to login again, AccountId = %d", GetAccountId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player tryes to login again, AccountId = %d", GetAccountId());
return;
}
m_playerLoading = true;
uint64 playerGuid = 0;
- sLog->outStaticDebug("WORLD: Recvd Player Logon Message");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message");
recv_data >> playerGuid;
if (!CharCanLogin(GUID_LOPART(playerGuid)))
{
- sLog->outError("Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
KickPlayer();
return;
}
@@ -839,13 +838,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
data.put(0, linecount);
SendPacket(&data);
- sLog->outStaticDebug("WORLD: Sent motd (SMSG_MOTD)");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_MOTD)");
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION);
- sLog->outStaticDebug("WORLD: Sent server info");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent server info");
}
//QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow());
@@ -868,7 +867,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
else
{
// remove wrong guild data
- sLog->outError("Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
pCurrChar->SetInGuild(0);
}
}
@@ -1006,7 +1005,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
- sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
@@ -1020,7 +1019,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data)
{
- sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_ATWAR");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR");
uint32 repListID;
uint8 flag;
@@ -1034,7 +1033,7 @@ void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data)
//I think this function is never used :/ I dunno, but i guess this opcode not exists
void WorldSession::HandleSetFactionCheat(WorldPacket & /*recv_data*/)
{
- sLog->outError("WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
GetPlayer()->GetReputationMgr().SendStates();
}
@@ -1068,7 +1067,7 @@ void WorldSession::HandleTutorialReset(WorldPacket & /*recv_data*/)
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data)
{
- sLog->outStaticDebug("WORLD: Received CMSG_SET_WATCHED_FACTION");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION");
uint32 fact;
recv_data >> fact;
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
@@ -1076,7 +1075,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data)
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data)
{
- sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_INACTIVE");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE");
uint32 replistid;
uint8 inactive;
recv_data >> replistid >> inactive;
@@ -1086,14 +1085,14 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data)
void WorldSession::HandleShowingHelmOpcode(WorldPacket& recv_data)
{
- sLog->outStaticDebug("CMSG_SHOWING_HELM for %s", _player->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName());
recv_data.read_skip<uint8>(); // unknown, bool?
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
}
void WorldSession::HandleShowingCloakOpcode(WorldPacket& recv_data)
{
- sLog->outStaticDebug("CMSG_SHOWING_CLOAK for %s", _player->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName());
recv_data.read_skip<uint8>(); // unknown, bool?
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
}
@@ -1183,7 +1182,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
CharacterDatabase.Execute(stmt);
- sLog->outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(RESPONSE_SUCCESS);
@@ -1450,7 +1449,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
if (result)
{
std::string oldname = result->Fetch()[0].GetString();
- sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
@@ -1514,6 +1513,14 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
uint64 itemGuid;
recv_data.readPackGUID(itemGuid);
+ // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
+ if (itemGuid == 1)
+ {
+ // ignored slots saved as bit mask because we have no free special values for Items[i]
+ eqSet.IgnoreMask |= 1 << i;
+ continue;
+ }
+
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item && itemGuid) // cheating check 1
@@ -1555,6 +1562,10 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
+ // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
+ if (itemGuid == 1)
+ continue;
+
Item* item = _player->GetItemByGuid(itemGuid);
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 966eae598a6..880f2df86f7 100755
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -52,7 +52,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && AccountMgr::IsPlayerAccount(GetSecurity())
&& !ChatHandler(this).isValidChatMessage(msg.c_str()))
{
- sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
GetPlayer()->GetGUIDLow(), msg.c_str());
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
KickPlayer();
@@ -73,7 +73,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
if (type >= MAX_CHAT_MSG_TYPE)
{
- sLog->outError("CHAT: Wrong message type received: %u", type);
+ sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: Wrong message type received: %u", type);
recv_data.rfinish();
return;
}
@@ -474,7 +474,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
}
} break;
default:
- sLog->outError("CHAT: unknown message type %u, lang: %u", type, lang);
+ sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: unknown message type %u, lang: %u", type, lang);
break;
}
}
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index 6693cdfca27..78547d2d0f3 100755
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -80,7 +80,7 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recv_data)
if (sheathed >= MAX_SHEATH_STATE)
{
- sLog->outError("Unknown sheath state %u ??", sheathed);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Unknown sheath state %u ??", sheathed);
return;
}
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index 8afd9f3b978..1b3f71c8cf1 100755
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
@@ -42,8 +42,8 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
return;
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
- sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
- sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
time_t now = time(NULL);
player->duel->startTimer = now;
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index de8dc2b90f6..e0ff3933c3a 100755
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -84,7 +84,10 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
// restrict invite to GMs
if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->isGameMaster() && player->isGameMaster())
+ {
+ SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
+ }
// can't group with
if (!GetPlayer()->isGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
@@ -207,7 +210,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data)
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
- sLog->outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
@@ -280,7 +283,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
//can't uninvite yourself
if (guid == GetPlayer()->GetGUID())
{
- sLog->outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
@@ -330,7 +333,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
// can't uninvite yourself
if (GetPlayer()->GetName() == membername)
{
- sLog->outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
@@ -429,24 +432,20 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data)
group->SendUpdate();
}
-void WorldSession::HandleLootRoll(WorldPacket &recv_data)
+void WorldSession::HandleLootRoll(WorldPacket& recvData)
{
+ uint64 guid;
+ uint32 itemSlot;
+ uint8 rollType;
+ recvData >> guid; // guid of the item rolled
+ recvData >> itemSlot;
+ recvData >> rollType; // 0: pass, 1: need, 2: greed
+
Group* group = GetPlayer()->GetGroup();
if (!group)
- {
- recv_data.rfinish();
return;
- }
-
- uint64 Guid;
- uint32 NumberOfPlayers;
- uint8 rollType;
- recv_data >> Guid; //guid of the item rolled
- recv_data >> NumberOfPlayers;
- recv_data >> rollType; //0: pass, 1: need, 2: greed
- // everything's fine, do it
- group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType);
+ group->CountRollVote(GetPlayer()->GetGUID(), guid, rollType);
switch (rollType)
{
@@ -984,7 +983,7 @@ void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recv_data)
if (!GetPlayer()) // needed because STATUS_AUTHED
{
if (passOnLoot != 0)
- sLog->outError("CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!");
+ sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!");
return;
}
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index d537fc5b4aa..260220bb8d5 100755
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -284,7 +284,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
uint32 item;
recv_data >> item;
- sLog->outDetail("STORAGE: Item Query = %u", item);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Item Query = %u", item);
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
if (pProto)
@@ -423,7 +423,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
data << pProto->GemProperties;
data << pProto->RequiredDisenchantSkill;
data << pProto->ArmorDamageModifier;
- data << uint32(abs(pProto->Duration)); // added in 2.4.2.8209, duration (seconds)
+ data << pProto->Duration; // added in 2.4.2.8209, duration (seconds)
data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory
data << pProto->HolidayId; // Holiday.dbc?
SendPacket(&data);
@@ -444,7 +444,7 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
uint8 bag, slot;
recv_data >> bag >> slot;
- //sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
+ //sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Read bag = %u, slot = %u", bag, slot);
Item* pItem = _player->GetItemByPos(bag, slot);
if (pItem && pItem->GetTemplate()->PageText)
@@ -455,12 +455,12 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
if (msg == EQUIP_ERR_OK)
{
data.Initialize (SMSG_READ_ITEM_OK, 8);
- sLog->outDetail("STORAGE: Item page sent");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Item page sent");
}
else
{
data.Initialize(SMSG_READ_ITEM_FAILED, 8);
- sLog->outDetail("STORAGE: Unable to read item");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Unable to read item");
_player->SendEquipError(msg, pItem, NULL);
}
data << pItem->GetGUID();
@@ -479,7 +479,7 @@ void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recv_data)
recv_data >> itemid >> guid;
- sLog->outDetail("Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid));
}
@@ -561,7 +561,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
Item* pNewItem = pItem->CloneItem(count, _player);
if (!pNewItem)
{
- sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
@@ -880,7 +880,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
// next slot
++slot;
- sLog->outDetail("PLAYER: Buy bank bag slot, slot number = %u", slot);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "PLAYER: Buy bank bag slot, slot number = %u", slot);
BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot);
@@ -1349,6 +1349,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
_player->ToggleMetaGemsActive(slot, true); //turn on all metagems (except for target item)
+ _player->RemoveTradeableItem(itemTarget);
itemTarget->ClearSoulboundTradeable(_player); // clear tradeable flag
}
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 8e4b41a9be4..8259d0c4e9b 100755
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -220,16 +220,18 @@ void WorldSession::HandleLootOpcode(WorldPacket & recv_data)
GetPlayer()->InterruptNonMeleeSpells(false);
}
-void WorldSession::HandleLootReleaseOpcode(WorldPacket & recv_data)
+void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_RELEASE");
// cheaters can modify lguid to prevent correct apply loot release code and re-loot
// use internal stored guid
- recv_data.read_skip<uint64>(); // guid;
+ uint64 guid;
+ recvData >> guid;
if (uint64 lguid = GetPlayer()->GetLootGUID())
- DoLootRelease(lguid);
+ if (lguid == guid)
+ DoLootRelease(lguid);
}
void WorldSession::DoLootRelease(uint64 lguid)
@@ -470,16 +472,18 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (!loot)
return;
- if (slotid > loot->items.size())
+ if (slotid >= loot->items.size() + loot->quest_items.size())
{
sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)loot->items.size());
return;
}
- LootItem& item = loot->items[slotid];
+ LootItem& item = slotid >= loot->items.size() ? loot->quest_items[slotid - loot->items.size()] : loot->items[slotid];
ItemPosCountVec dest;
InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
+ if (item.follow_loot_rules && !item.AllowedForPlayer(target))
+ msg = EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if (msg != EQUIP_ERR_OK)
{
target->SendEquipError(msg, NULL, NULL, item.itemid);
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index c30cbaa622e..ae04444a118 100755
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -89,13 +89,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (!rc)
{
- sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
return;
}
- sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
if (player->GetGUID() == rc)
{
@@ -107,7 +107,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
uint32 reqmoney = cost + money;
- if (!player->HasEnoughMoney(reqmoney))
+ if (!player->HasEnoughMoney(reqmoney) && !player->isGameMaster())
{
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
return;
@@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
@@ -284,7 +284,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account);
}
}
@@ -479,7 +479,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
sender_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
+ GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
}
else if (!receive)
sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid);
@@ -573,8 +573,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
{
- // packet send mail count as uint8, prevent overflow
- if (mailsCount >= 254)
+ // Only first 50 mails are displayed
+ if (mailsCount >= 50)
{
realCount += 1;
continue;
@@ -586,7 +586,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
uint8 item_count = (*itr)->items.size(); // max count is MAX_MAIL_ITEMS (12)
- size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+7*3*4+4+4+4+4+4+4+1);
+ size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1);
if (data.wpos()+next_mail_size > maxPacketSize)
{
@@ -614,7 +614,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
}
data << uint32((*itr)->COD); // COD
- data << uint32(0); // probably changed in 3.3.3
+ data << uint32(0); // package (Package.dbc)
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
data << uint32((*itr)->money); // Gold
data << uint32((*itr)->checked); // flags
@@ -655,8 +655,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
data << uint8(0);
}
- realCount += 1;
- mailsCount += 1;
+ ++realCount;
+ ++mailsCount;
}
data.put<uint32>(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount
@@ -713,7 +713,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender);
bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK);
- sLog->outDetail("HandleMailCreateTextItem mailid=%u", mailId);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleMailCreateTextItem mailid=%u", mailId);
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false);
@@ -743,11 +743,12 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/)
if (_player->unReadMails > 0)
{
- data << uint32(0); // float
+ data << float(0); // float
data << uint32(0); // count
uint32 count = 0;
time_t now = time(NULL);
+ std::set<uint32> sentSenders;
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
Mail* m = (*itr);
@@ -759,36 +760,29 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/)
if (now < m->deliver_time)
continue;
- if (m->messageType)
- data << uint64(m->sender); // player guid
- else
- data << uint32(m->sender); // creature entry
+ // only send each mail sender once
+ if (sentSenders.count(m->sender))
+ continue;
- switch (m->messageType)
- {
- case MAIL_AUCTION:
- data << uint32(2);
- data << uint32(2);
- data << uint32(m->stationery);
- break;
- default:
- data << uint32(0);
- data << uint32(0);
- data << uint32(m->stationery);
- break;
- }
- data << uint32(0xC6000000); // float unk, time or something
+ data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid
+ data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries
+ data << uint32(m->messageType);
+ data << uint32(m->stationery);
+ data << float(m->deliver_time - now);
+ sentSenders.insert(m->sender);
++count;
if (count == 2) // do not display more than 2 mails
break;
}
+
data.put<uint32>(4, count);
}
else
{
- data << uint32(0xC7A8C000);
- data << uint32(0x00000000);
+ data << float(-DAY);
+ data << uint32(0);
}
+
SendPacket(&data);
}
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 35872f8c63f..80caee7d896 100755
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -51,6 +51,10 @@
#include "GameObjectAI.h"
#include "Group.h"
#include "AccountMgr.h"
+#include "Spell.h"
+#include "BattlegroundMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
{
@@ -429,6 +433,10 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message");
+ // Player have already logged out serverside, too late to cancel
+ if (!GetPlayer())
+ return;
+
LogoutRequest(0);
WorldPacket data(SMSG_LOGOUT_CANCEL_ACK, 0);
@@ -489,7 +497,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data)
uint32 newZone;
recv_data >> newZone;
- sLog->outDetail("WORLD: Recvd ZONE_UPDATE: %u", newZone);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone);
// use server size data
uint32 newzone, newarea;
@@ -725,7 +733,7 @@ void WorldSession::HandleBugOpcode(WorldPacket & recv_data)
void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
{
- sLog->outDetail("WORLD: Received CMSG_RECLAIM_CORPSE");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE");
uint64 guid;
recv_data >> guid;
@@ -762,7 +770,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
{
- sLog->outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE");
uint64 guid;
uint8 status;
@@ -933,7 +941,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
{
- sLog->outDetail("WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
uint32 type, timestamp, decompressedSize;
recv_data >> type >> timestamp >> decompressedSize;
@@ -958,7 +966,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
if (decompressedSize > 0xFFFF)
{
recv_data.rfinish(); // unnneded warning spam in this case
- sLog->outError("UAD: Account data packet too big, size %u", decompressedSize);
+ sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Account data packet too big, size %u", decompressedSize);
return;
}
@@ -969,7 +977,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
{
recv_data.rfinish(); // unnneded warning spam in this case
- sLog->outError("UAD: Failed to decompress account data");
+ sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data");
return;
}
@@ -988,7 +996,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
{
- sLog->outDetail("WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");
uint32 type;
recv_data >> type;
@@ -1034,10 +1042,10 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
uint32 action = ACTION_BUTTON_ACTION(packetData);
uint8 type = ACTION_BUTTON_TYPE(packetData);
- sLog->outDetail("BUTTON: %u ACTION: %u TYPE: %u", button, action, type);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "BUTTON: %u ACTION: %u TYPE: %u", button, action, type);
if (!packetData)
{
- sLog->outDetail("MISC: Remove action from button %u", button);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Remove action from button %u", button);
GetPlayer()->removeActionButton(button);
}
else
@@ -1046,19 +1054,19 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
{
case ACTION_BUTTON_MACRO:
case ACTION_BUTTON_CMACRO:
- sLog->outDetail("MISC: Added Macro %u into button %u", action, button);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Macro %u into button %u", action, button);
break;
case ACTION_BUTTON_EQSET:
- sLog->outDetail("MISC: Added EquipmentSet %u into button %u", action, button);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added EquipmentSet %u into button %u", action, button);
break;
case ACTION_BUTTON_SPELL:
- sLog->outDetail("MISC: Added Spell %u into button %u", action, button);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Spell %u into button %u", action, button);
break;
case ACTION_BUTTON_ITEM:
- sLog->outDetail("MISC: Added Item %u into button %u", action, button);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Item %u into button %u", action, button);
break;
default:
- sLog->outError("MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow());
return;
}
GetPlayer()->addActionButton(button, action, type);
@@ -1067,18 +1075,18 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/)
{
- sLog->outStaticDebug("WORLD: Player is watching cinema");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC");
}
void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/)
{
- sLog->outStaticDebug("WORLD: Which movie to play");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA");
}
void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data)
{
/* WorldSession::Update(getMSTime());*/
- sLog->outStaticDebug("WORLD: Time Lag/Synchronization Resent/Update");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_TIME_SKIPPED");
uint64 guid;
recv_data.readPackGUID(guid);
@@ -1100,7 +1108,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data)
void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data)
{
- sLog->outStaticDebug("WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
// no used
recv_data.rfinish(); // prevent warnings spam
@@ -1165,7 +1173,7 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
{
if (ActionBar != 0)
- sLog->outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar));
return;
}
@@ -1188,13 +1196,17 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
{
uint64 guid;
recv_data >> guid;
- sLog->outStaticDebug("Inspected guid is " UI64FMTD, guid);
+
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT");
_player->SetSelection(guid);
Player* player = ObjectAccessor::FindPlayer(guid);
- if (!player) // wrong player
+ if (!player)
+ {
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid);
return;
+ }
uint32 talent_points = 0x47;
uint32 guid_size = player->GetPackGUID().wpos();
@@ -1225,7 +1237,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
if (!player)
{
- sLog->outError("InspectHonorStats: WTF, player not found...");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid);
return;
}
@@ -1241,10 +1253,6 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
{
- // write in client console: worldport 469 452 6454 2536 180 or /console worldport 469 452 6454 2536 180
- // Received opcode CMSG_WORLD_TELEPORT
- // Time is ***, map=469, x=452.000000, y=6454.000000, z=2536.000000, orient=3.141593
-
uint32 time;
uint32 mapid;
float PositionX;
@@ -1259,20 +1267,20 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
recv_data >> PositionZ;
recv_data >> Orientation; // o (3.141593 = 180 degrees)
- //sLog->outDebug("Received opcode CMSG_WORLD_TELEPORT");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_WORLD_TELEPORT");
+
if (GetPlayer()->isInFlight())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
- sLog->outStaticDebug("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, mapid, PositionX, PositionY, PositionZ, Orientation);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName(), time, mapid, PositionX, PositionY, PositionZ, Orientation);
if (AccountMgr::IsAdminAccount(GetSecurity()))
GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation);
else
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Received worldport command from player %s", GetPlayer()->GetName());
}
void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
@@ -1413,7 +1421,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data)
if (WorldObject* target = _player->GetViewpoint())
_player->SetSeer(target);
else
- sLog->outError("Player %s requests non-existing seer " UI64FMTD, _player->GetName(), _player->GetUInt64Value(PLAYER_FARSIGHT));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s requests non-existing seer " UI64FMTD, _player->GetName(), _player->GetUInt64Value(PLAYER_FARSIGHT));
break;
default:
sLog->outDebug(LOG_FILTER_NETWORKIO, "Unhandled mode in CMSG_FAR_SIGHT: %u", apply);
@@ -1484,7 +1492,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
if (mode >= MAX_DUNGEON_DIFFICULTY)
{
- sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
@@ -1495,7 +1503,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
- sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", _player->GetName(), _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", _player->GetName(), _player->GetGUIDLow());
return;
}
@@ -1515,7 +1523,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
if (groupGuy->GetMap()->IsNonRaidDungeon())
{
- sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName(), groupGuy->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName(), groupGuy->GetGUIDLow());
return;
}
}
@@ -1541,7 +1549,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
if (mode >= MAX_RAID_DIFFICULTY)
{
- sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
@@ -1549,7 +1557,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
- sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
@@ -1572,7 +1580,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
if (groupGuy->GetMap()->IsRaid())
{
- sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
}
@@ -1681,12 +1689,64 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
data << uint32(PhaseShift);
SendPacket(&data);
}
+// Battlefield and Battleground
+void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
+
+ Battleground* bg = _player->GetBattleground();
+
+ uint64 guid;
+ recv_data >> guid;
+
+ Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ if (!unit)
+ return;
+
+ if (!unit->isSpiritService()) // it's not spirit service
+ return;
+
+ if (bg)
+ sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->SendAreaSpiritHealerQueryOpcode(_player,guid);
+}
+
+void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
+
+ Battleground* bg = _player->GetBattleground();
+
+ uint64 guid;
+ recv_data >> guid;
+
+ Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ if (!unit)
+ return;
+
+ if (!unit->isSpiritService()) // it's not spirit service
+ return;
+
+ if (bg)
+ bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+}
void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/)
{
if (_player->isInFlight())
return;
+ if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ {
+ // bf->PlayerAskToLeave(_player); FIXME
+ return;
+ }
+
AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2))
return;
@@ -1703,7 +1763,7 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket)
if (!_player->HasPendingBind())
{
- sLog->outDetail("InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName(), _player->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName(), _player->GetGUIDLow());
return;
}
@@ -1714,3 +1774,47 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket)
_player->SetPendingBind(0, 0);
}
+
+void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY");
+
+ uint64 guid;
+ uint32 spellId;
+ float elevation, speed;
+ float curX, curY, curZ;
+ float targetX, targetY, targetZ;
+ uint8 moveStop;
+
+ recvPacket >> guid >> spellId >> elevation >> speed;
+ recvPacket >> curX >> curY >> curZ;
+ recvPacket >> targetX >> targetY >> targetZ;
+ recvPacket >> moveStop;
+
+ Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
+ Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL;
+ if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
+ {
+ recvPacket.rfinish();
+ return;
+ }
+
+ Position pos = *spell->m_targets.GetSrcPos();
+ pos.Relocate(curX, curY, curZ);
+ spell->m_targets.ModSrc(pos);
+
+ pos = *spell->m_targets.GetDstPos();
+ pos.Relocate(targetX, targetY, targetZ);
+ spell->m_targets.ModDst(pos);
+
+ spell->m_targets.SetElevation(elevation);
+ spell->m_targets.SetSpeed(speed);
+
+ if (moveStop)
+ {
+ uint32 opcode;
+ recvPacket >> opcode;
+ recvPacket.SetOpcode(opcode);
+ HandleMovementOpcodes(recvPacket);
+ }
+}
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index f1217e58b3f..27b1f2eca3f 100755
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -46,7 +46,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetSemaphoreTeleportFar(false);
// get the teleport destination
- WorldLocation &loc = GetPlayer()->GetTeleportDest();
+ WorldLocation const loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if (!MapManager::IsValidMapCoord(loc))
@@ -64,10 +64,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->m_InstanceValid = true;
Map* oldMap = GetPlayer()->GetMap();
- ASSERT(oldMap);
if (GetPlayer()->IsInWorld())
{
- sLog->outCrash("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
@@ -77,7 +76,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// while the player is in transit, for example the map may get full
if (!newMap || !newMap->CanEnter(GetPlayer()))
{
- sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
@@ -90,7 +89,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
{
- sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(oldMap);
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
@@ -197,11 +196,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
uint32 flags, time;
recv_data >> flags >> time;
- sLog->outStaticDebug("Guid " UI64FMTD, guid);
- sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Guid " UI64FMTD, guid);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Flags %u, time %u", flags, time/IN_MILLISECONDS);
- Unit* mover = _player->m_mover;
- Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
+ Player* plMover = _player->m_mover->ToPlayer();
if (!plMover || !plMover->IsBeingTeleportedNear())
return;
@@ -240,33 +238,33 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
GetPlayer()->ProcessDelayedOperations();
}
-void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
+void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
{
- uint16 opcode = recv_data.GetOpcode();
+ uint16 opcode = recvData.GetOpcode();
Unit* mover = _player->m_mover;
- ASSERT(mover != NULL); // there must always be a mover
+ ASSERT(mover != NULL); // there must always be a mover
- Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
+ Player* plrMover = mover->ToPlayer();
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
- if (plMover && plMover->IsBeingTeleported())
+ if (plrMover && plrMover->IsBeingTeleported())
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
/* extract packet */
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
MovementInfo movementInfo;
movementInfo.guid = guid;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
// prevent tampered movement data
if (guid != mover->GetGUID())
@@ -274,7 +272,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
if (!movementInfo.pos.IsPositionValid())
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
@@ -285,28 +283,54 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50)
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(),
movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation()))
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
// if we boarded a transport, add us to it
- if (plMover && !plMover->GetTransport())
+ if (plrMover)
{
- // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list
- for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
+ if (!plrMover->GetTransport())
+ {
+ // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list
+ for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
+ {
+ if ((*iter)->GetGUID() == movementInfo.t_guid)
+ {
+ plrMover->m_transport = *iter;
+ (*iter)->AddPassenger(plrMover);
+ break;
+ }
+ }
+ }
+ else if (plrMover->GetTransport()->GetGUID() != movementInfo.t_guid)
{
- if ((*iter)->GetGUID() == movementInfo.t_guid)
+ bool foundNewTransport = false;
+ plrMover->m_transport->RemovePassenger(plrMover);
+ for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
+ {
+ if ((*iter)->GetGUID() == movementInfo.t_guid)
+ {
+ foundNewTransport = true;
+ plrMover->m_transport = *iter;
+ (*iter)->AddPassenger(plrMover);
+ break;
+ }
+ }
+
+ if (!foundNewTransport)
{
- plMover->m_transport = (*iter);
- (*iter)->AddPassenger(plMover);
- break;
+ plrMover->m_transport = NULL;
+ movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
+ movementInfo.t_time = 0;
+ movementInfo.t_seat = -1;
}
}
}
@@ -318,29 +342,29 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
}
}
- else if (plMover && plMover->GetTransport()) // if we were on a transport, leave
+ else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave
{
- plMover->m_transport->RemovePassenger(plMover);
- plMover->m_transport = NULL;
+ plrMover->m_transport->RemovePassenger(plrMover);
+ plrMover->m_transport = NULL;
movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
movementInfo.t_time = 0;
movementInfo.t_seat = -1;
}
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
- if (opcode == MSG_MOVE_FALL_LAND && plMover && !plMover->isInFlight())
- plMover->HandleFall(movementInfo);
+ if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->isInFlight())
+ plrMover->HandleFall(movementInfo);
- if (plMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plMover->IsInWater())
+ if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater())
{
// now client not include swimming flag in case jumping under water
- plMover->SetInWater(!plMover->IsInWater() || plMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));
+ plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));
}
/*----------------------*/
/* process position-change */
- WorldPacket data(opcode, recv_data.size());
+ WorldPacket data(opcode, recvData.size());
movementInfo.time = getMSTime();
movementInfo.guid = mover->GetGUID();
WriteMovementInfo(&data, &movementInfo);
@@ -357,27 +381,25 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
mover->UpdatePosition(movementInfo.pos);
- if (plMover) // nothing is charmed, or player charmed
+ if (plrMover) // nothing is charmed, or player charmed
{
- plMover->UpdateFallInformationIfNeed(movementInfo, opcode);
+ plrMover->UpdateFallInformationIfNeed(movementInfo, opcode);
if (movementInfo.pos.GetPositionZ() < -500.0f)
{
- if (!(plMover->InBattleground()
- && plMover->GetBattleground()
- && plMover->GetBattleground()->HandlePlayerUnderMap(_player)))
+ if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player)))
{
// NOTE: this is actually called many times while falling
// even after the player has been teleported away
// TODO: discard movement packets after the player is rooted
- if (plMover->isAlive())
+ if (plrMover->isAlive())
{
- plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
+ plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
// player can be alive if GM/etc
// change the death state to CORPSE to prevent the death timer from
// starting in the next player update
- if (!plMover->isAlive())
- plMover->KillPlayer();
+ if (!plrMover->isAlive())
+ plrMover->KillPlayer();
}
}
}
@@ -433,7 +455,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break;
case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break;
default:
- sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
return;
}
@@ -450,13 +472,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
{
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
{
- sLog->outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
+ sLog->outError(LOG_FILTER_NETWORKIO, "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), newspeed);
_player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true);
}
else // must be lesser - cheating
{
- sLog->outBasic("Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
_player->GetName(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed);
_player->GetSession()->KickPlayer();
}
@@ -473,7 +495,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
if (GetPlayer()->IsInWorld())
{
if (_player->m_mover->GetGUID() != guid)
- sLog->outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
+ sLog->outError(LOG_FILTER_NETWORKIO, "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/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index e54bee96b8b..3501b3bc068 100755
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -69,17 +69,17 @@ void WorldSession::HandlePetAction(WorldPacket & recv_data)
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
- sLog->outDetail("HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
if (!pet)
{
- sLog->outError("HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
return;
}
if (pet != GetPlayer()->GetFirstControlled())
{
- sLog->outError("HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
return;
}
@@ -121,13 +121,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recv_data)
if (!pet)
{
- sLog->outError("HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
return;
}
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
{
- sLog->outError("HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
return;
}
@@ -142,7 +142,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId());
return;
}
@@ -263,7 +263,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
}
break;
default:
- sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
break;
case ACT_REACTION: // 0x6
@@ -292,7 +292,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown PET spell id %i", spellid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellid);
return;
}
@@ -339,9 +339,11 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
pet->SendUpdateToPlayer((Player*)unit_target2);
}
+
if (Unit* powner = pet->GetCharmerOrOwner())
if (powner->GetTypeId() == TYPEID_PLAYER)
- pet->SendUpdateToPlayer(powner->ToPlayer());
+ pet->SendUpdateToPlayer(powner->ToPlayer());
+
result = SPELL_CAST_OK;
}
@@ -395,13 +397,13 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
break;
}
default:
- sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
}
void WorldSession::HandlePetNameQuery(WorldPacket & recv_data)
{
- sLog->outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetNameQuery. CMSG_PET_NAME_QUERY");
uint32 petnumber;
uint64 petguid;
@@ -452,7 +454,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
{
if (!GetPlayer()->isGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
{
- sLog->outStaticDebug("Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
return false;
}
}
@@ -461,7 +463,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
{
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
{
- sLog->outStaticDebug("Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
return false;
}
}
@@ -470,7 +472,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
{
- sLog->outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetSetAction. CMSG_PET_SET_ACTION");
uint64 petguid;
uint8 count;
@@ -481,14 +483,14 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
if (!pet || pet != _player->GetFirstControlled())
{
- sLog->outError("HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
return;
}
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
@@ -550,7 +552,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]);
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]);
- sLog->outDetail("Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state));
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
@@ -586,7 +588,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
void WorldSession::HandlePetRename(WorldPacket & recv_data)
{
- sLog->outDetail("HandlePetRename. CMSG_PET_RENAME");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetRename. CMSG_PET_RENAME");
uint64 petguid;
uint8 isdeclined;
@@ -673,7 +675,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data)
{
uint64 guid;
recv_data >> guid; //pet guid
- sLog->outDetail("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
if (!_player->IsInWorld())
return;
@@ -699,7 +701,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data)
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
{
- sLog->outDetail("CMSG_PET_SPELL_AUTOCAST");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_PET_SPELL_AUTOCAST");
uint64 guid;
uint32 spellid;
uint8 state; //1 for on, 0 for off
@@ -715,7 +717,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
{
- sLog->outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
return;
}
@@ -727,7 +729,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
@@ -741,7 +743,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
{
- sLog->outDetail("WORLD: CMSG_PET_CAST_SPELL");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL");
uint64 guid;
uint8 castCount;
@@ -760,14 +762,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
{
- sLog->outError("HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown PET spell id %i", spellId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellId);
return;
}
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index cb3bac0e443..90af03113bf 100755
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -479,7 +479,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
if (!result)
{
- sLog->outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
}
@@ -771,7 +771,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
}
else
{
- sLog->outError("Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
return;
}
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 628cdbbdd5e..d3f51867831 100755
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -70,7 +70,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data)
recv_data >> guid;
// This is disable by default to prevent lots of console spam
- // sLog->outString("HandleNameQueryOpcode %u", guid);
+ // sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleNameQueryOpcode %u", guid);
SendNameQueryOpcode(guid);
}
@@ -113,7 +113,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data)
ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName);
}
}
- sLog->outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry);
// guess size
WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 100);
data << uint32(entry); // creature entry
@@ -179,7 +179,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption);
}
}
- sLog->outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150);
data << uint32(entry);
data << uint32(info->type);
@@ -209,7 +209,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
{
- sLog->outDetail("WORLD: Received MSG_CORPSE_QUERY");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY");
Corpse* corpse = GetPlayer()->GetCorpse();
@@ -264,7 +264,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data)
uint64 guid;
recv_data >> textID;
- sLog->outDetail("WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID);
recv_data >> guid;
GetPlayer()->SetSelection(guid);
@@ -344,7 +344,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data)
/// Only _static_ data is sent in this packet !!!
void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
{
- sLog->outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY");
uint32 pageID;
recv_data >> pageID;
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 34fed5e9a97..db18f2a01c9 100755
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -43,7 +43,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
Object* questgiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!questgiver)
{
- sLog->outDetail("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
return;
}
@@ -71,7 +71,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
break;
}
default:
- sLog->outError("QuestGiver called for unexpected type %u", questgiver->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "QuestGiver called for unexpected type %u", questgiver->GetTypeId());
break;
}
@@ -122,7 +122,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
// no or incorrect quest giver
if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
- (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
+ (object->GetTypeId() == TYPEID_PLAYER && object != _player && !object->ToPlayer()->CanShareQuest(questId)))
{
_player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
@@ -289,7 +289,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
if (reward >= QUEST_REWARD_CHOICES_COUNT)
{
- sLog->outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName(), _player->GetGUIDLow(), reward);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName(), _player->GetGUIDLow(), reward);
return;
}
@@ -308,7 +308,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) ||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
{
- sLog->outError("HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
_player->GetName(), _player->GetGUIDLow(), questId);
return;
}
@@ -324,7 +324,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
{
- if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true))
+ if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true))
{
_player->AddQuest(nextQuest, object);
if (_player->CanCompleteQuest(nextQuest->GetQuestId()))
@@ -343,7 +343,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
{
- if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true))
+ if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true))
{
_player->AddQuest(nextQuest, object);
if (_player->CanCompleteQuest(nextQuest->GetQuestId()))
@@ -435,7 +435,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
_player->RemoveActiveQuest(questId);
_player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
- sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
}
_player->SetQuestSlot(slot, 0);
@@ -500,7 +500,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
{
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
{
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
_player->GetName(), _player->GetGUIDLow(), questId);
return;
}
@@ -582,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
- player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true);
+ player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true);
player->SetDivider(_player->GetGUID());
}
}
@@ -634,7 +634,7 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32
}
default:
//its imposible, but check ^)
- sLog->outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
return DIALOG_STATUS_NONE;
}
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index b2d52c85467..d7bb10e8ba3 100755
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -99,7 +99,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
return;
}
- sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size());
ItemTemplate const* proto = pItem->GetTemplate();
if (!proto)
@@ -175,7 +175,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
{
- sLog->outDetail("WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size());
Player* pUser = _player;
@@ -187,7 +187,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
recvPacket >> bagIndex >> slot;
- sLog->outDetail("bagIndex: %u, slot: %u", bagIndex, slot);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "bagIndex: %u, slot: %u", bagIndex, slot);
Item* item = pUser->GetItemByPos(bagIndex, slot);
if (!item)
@@ -207,7 +207,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
if (!(proto->Flags & ITEM_PROTO_FLAG_OPENABLE) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
{
pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
pUser->GetName(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId);
return;
}
@@ -221,7 +221,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
if (!lockInfo)
{
pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, NULL);
- sLog->outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId);
return;
}
@@ -254,7 +254,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
}
else
{
- sLog->outError("Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow());
pUser->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
return;
}
@@ -328,7 +328,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %u", spellId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown spell id %u", spellId);
recvPacket.rfinish(); // prevent spam at ignore packet
return;
}
@@ -444,7 +444,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown PET spell id %u", spellId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %u", spellId);
return;
}
@@ -452,13 +452,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
if (!pet)
{
- sLog->outError("HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
return;
}
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm())
{
- sLog->outError("HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
return;
}
@@ -650,18 +650,30 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)
uint8 castCount;
float x, y, z; // Position of missile hit
- recvPacket.readPackGUID(casterGuid);
+ recvPacket >> casterGuid;
recvPacket >> spellId;
recvPacket >> castCount;
recvPacket >> x;
recvPacket >> y;
recvPacket >> z;
+ Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid);
+ if (!caster)
+ return;
+
+ Spell* spell = caster->FindCurrentSpellBySpellId(spellId);
+ if (!spell || !spell->m_targets.HasDst())
+ return;
+
+ Position pos = *spell->m_targets.GetDstPos();
+ pos.Relocate(x, y, z);
+ spell->m_targets.ModDst(pos);
+
WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21);
data << uint64(casterGuid);
data << uint8(castCount);
data << float(x);
data << float(y);
data << float(z);
- SendPacket(&data);
+ caster->SendMessageToSet(&data, true);
}
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index dc26aaa42ca..f50b9ebd311 100755
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -192,21 +192,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
if (myItems[i])
{
if (!traderCanTrade)
- sLog->outError("trader can't store item: %u", myItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "trader can't store item: %u", myItems[i]->GetGUIDLow());
if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK)
_player->MoveItemToInventory(playerDst, myItems[i], true, true);
else
- sLog->outError("player can't take item back: %u", myItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "player can't take item back: %u", myItems[i]->GetGUIDLow());
}
// return the already removed items to the original owner
if (hisItems[i])
{
if (!playerCanTrade)
- sLog->outError("player can't store item: %u", hisItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "player can't store item: %u", hisItems[i]->GetGUIDLow());
if (trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK)
trader->MoveItemToInventory(traderDst, hisItems[i], true, true);
else
- sLog->outError("trader can't take item back: %u", hisItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "trader can't take item back: %u", hisItems[i]->GetGUIDLow());
}
}
}
@@ -224,7 +224,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m
{
if (Item* item = myTrade->GetItem(TradeSlots(i)))
{
- sLog->outStaticDebug("player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
//Can return NULL
myItems[i] = item;
myItems[i]->SetInTrade();
@@ -232,7 +232,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m
if (Item* item = hisTrade->GetItem(TradeSlots(i)))
{
- sLog->outStaticDebug("partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
hisItems[i] = item;
hisItems[i]->SetInTrade();
}
@@ -531,7 +531,7 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::SendCancelTrade()
{
- if (m_playerRecentlyLogout)
+ if (PlayerRecentlyLoggedOut() || PlayerLogout())
return;
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index cfd73c2c987..f0ccfc44e60 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -63,7 +63,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
if (!seat->CanSwitchFromSeat())
{
recv_data.rfinish(); // prevent warnings spam
- sLog->outError("HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
recv_data.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
return;
}
@@ -150,7 +150,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
if (!vehicle)
{
data.rfinish(); // prevent warnings spam
- sLog->outError("HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
return;
}
@@ -162,13 +162,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- sLog->outError("Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
if (!player->IsOnVehicle(vehicle->GetBase()))
{
- sLog->outError("Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
@@ -177,7 +177,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
if (seat->IsEjectable())
player->ExitVehicle();
else
- sLog->outError("Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
}
else if (IS_CREATURE_GUID(guid))
@@ -185,13 +185,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
if (!unit) // creatures can be ejected too from player mounts
{
- sLog->outError("Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
if (!unit->IsOnVehicle(vehicle->GetBase()))
{
- sLog->outError("Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
@@ -203,10 +203,10 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
unit->ExitVehicle();
}
else
- sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
}
else
- sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
}
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/)
@@ -220,7 +220,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/)
if (seat->CanEnterOrExit())
GetPlayer()->ExitVehicle();
else
- sLog->outError("Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags);
}
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 8078a91d082..48ed7bdba1f 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -75,19 +75,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
const MapEntry* entry = sMapStore.LookupEntry(mapId);
if (!entry)
{
- sLog->outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId);
return NULL;
}
if (instanceId == 0)
{
- sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId);
return NULL;
}
if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
- sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty);
return NULL;
}
@@ -275,8 +275,8 @@ void InstanceSaveManager::LoadInstances()
// Load reset times and clean expired instances
sInstanceSaveMgr->LoadResetTimes();
- sLog->outString(">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
}
void InstanceSaveManager::LoadResetTimes()
@@ -364,7 +364,7 @@ void InstanceSaveManager::LoadResetTimes()
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
if (!mapDiff)
{
- sLog->outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty);
continue;
}
@@ -458,7 +458,7 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev
}
if (itr == m_resetTimeQueue.end())
- sLog->outError("InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId);
}
}
else
@@ -543,7 +543,10 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
if (iMap && iMap->IsDungeon())
((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
- sObjectMgr->DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded
+ if (iMap)
+ iMap->DeleteRespawnTimes();
+ else
+ Map::DeleteRespawnTimesInDB(mapid, instanceId);
// Free up the instance id and allow it to be reused
sMapMgr->FreeInstanceId(instanceId);
@@ -563,7 +566,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
if (!mapDiff || !mapDiff->resetTime)
{
- sLog->outError("InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid);
return;
}
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index d2c256e08f7..be9ee67b341 100755
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -46,7 +46,7 @@ void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go)
if (go)
go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: InstanceScript: HandleGameObject failed");
+ sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript: HandleGameObject failed");
}
bool InstanceScript::IsEncounterInProgress() const
@@ -197,7 +197,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
if (bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
- //sLog->outError("Inialize boss %u state as %u.", id, (uint32)state);
+ //sLog->outError(LOG_FILTER_GENERAL, "Inialize boss %u state as %u.", id, (uint32)state);
return false;
}
else
@@ -267,7 +267,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime,
go->ResetDoorOrButton();
}
else
- sLog->outError("SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType());
+ sLog->outError(LOG_FILTER_GENERAL, "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType());
}
}
@@ -298,7 +298,7 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
player->SendUpdateWorldState(uiStateId, uiStateData);
}
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoUpdateWorldState attempt send data but no players in map.");
+ sLog->outDebug(LOG_FILTER_TSCR, "DoUpdateWorldState attempt send data but no players in map.");
}
// Send Notify to all players in instance
@@ -384,7 +384,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
{
- sLog->outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
+ sLog->outError(LOG_FILTER_GENERAL, "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
instance->GetId(), criteria_id);
return false;
}
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 71f1572624b..ba6d327e631 100755
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -25,11 +25,11 @@
//#include "GameObject.h"
//#include "Map.h"
-#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
-#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-#define OUT_LOAD_INST_DATA_FAIL sLog->outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
+#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_LOAD_INST_DATA_FAIL sLog->outError(LOG_FILTER_TSCR, "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
class Map;
class Unit;
@@ -131,7 +131,6 @@ typedef std::map<uint32 /*entry*/, MinionInfo> MinionInfoMap;
class InstanceScript : public ZoneScript
{
public:
-
explicit InstanceScript(Map* map) : instance(map), completedEncounters(0) {}
virtual ~InstanceScript() {}
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 1b349b11156..72636a5d2aa 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -121,7 +121,7 @@ uint32 LootStore::LoadLootTable()
if (maxcount > std::numeric_limits<uint8>::max())
{
- sLog->outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max());
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max());
continue; // error already printed to log/console.
}
@@ -225,12 +225,12 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const
{
// all still listed ids isn't referenced
for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr)
- sLog->outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
}
void LootStore::ReportNotExistedId(uint32 id) const
{
- sLog->outErrorDb("Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName());
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName());
}
//
@@ -259,13 +259,13 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
{
if (group >= 1 << 7) // it stored in 7 bit field
{
- sLog->outErrorDb("Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7);
return false;
}
if (mincountOrRef == 0)
{
- sLog->outErrorDb("Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef);
return false;
}
@@ -274,36 +274,36 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
if (!proto)
{
- sLog->outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
return false;
}
if (chance == 0 && group == 0) // Zero chance is allowed for grouped entries only
{
- sLog->outErrorDb("Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
return false;
}
if (chance != 0 && chance < 0.000001f) // loot with low chance
{
- sLog->outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped",
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: low chance (%f) - skipped",
store.GetName(), entry, itemid, chance);
return false;
}
if (maxcount < mincountOrRef) // wrong max count
{
- sLog->outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
return false;
}
}
else // mincountOrRef < 0
{
if (needs_quest)
- sLog->outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
else if (chance == 0) // no chance for the reference
{
- sLog->outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
return false;
}
}
@@ -322,6 +322,7 @@ LootItem::LootItem(LootStoreItem const& li)
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
freeforall = proto && (proto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT);
+ follow_loot_rules = proto && (proto->FlagsCu & ITEM_FLAGS_CU_FOLLOW_LOOT_RULES);
needs_quest = li.needs_quest;
@@ -356,18 +357,9 @@ bool LootItem::AllowedForPlayer(Player const* player) const
if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
return false;
- if (needs_quest)
- {
- // Checking quests for quest-only drop (check only quests requirements in this case)
- if (!player->HasQuestForItem(itemid))
- return false;
- }
- else
- {
- // Not quest only drop (check quest starting items for already accepted non-repeatable quests)
- if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
- return false;
- }
+ // check quest requirements
+ if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
+ return false;
return true;
}
@@ -417,7 +409,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
if (!tab)
{
if (!noEmptyError)
- sLog->outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
return false;
}
@@ -483,7 +475,7 @@ void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player))
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
- if (proto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
+ if (proto->IsCurrencyToken())
player->StoreLootItem(i, this);
}
}
@@ -521,18 +513,19 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
for (uint8 i = 0; i < quest_items.size(); ++i)
{
LootItem &item = quest_items[i];
- if (!item.is_looted && item.AllowedForPlayer(player))
+
+ if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))))
{
ql->push_back(QuestItem(i));
- // questitems get blocked when they first appear in a
+ // quest items get blocked when they first appear in a
// player's quest vector
//
// increase once if one looter only, looter-times if free for all
if (item.freeforall || !item.is_blocked)
++unlootedCount;
-
- item.is_blocked = true;
+ if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT || player->GetGroup()->GetLootMethod() != ROUND_ROBIN))
+ item.is_blocked = true;
if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
break;
@@ -555,7 +548,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool pres
for (uint8 i = 0; i < items.size(); ++i)
{
LootItem &item = items[i];
- if (!item.is_looted && !item.freeforall && item.AllowedForPlayer(player))
+ if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player->GetGroup() && ((player->GetGroup()->GetLootMethod() == MASTER_LOOT && player->GetGroup()->GetLooterGuid() == player->GetGUID()) || player->GetGroup()->GetLootMethod() != MASTER_LOOT ))))
{
if (presentAtLooting)
item.AddAllowedLooter(player);
@@ -910,7 +903,27 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
{
b << uint8(l.items.size() + (qi - q_list->begin()));
b << item;
- b << uint8(slotType);
+ if (item.follow_loot_rules)
+ {
+ switch (lv.permission)
+ {
+ case MASTER_PERMISSION:
+ b << uint8(LOOT_SLOT_TYPE_MASTER);
+ break;
+ case GROUP_PERMISSION:
+ case ROUND_ROBIN_PERMISSION:
+ if (!item.is_blocked)
+ b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
+ else
+ b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING);
+ break;
+ default:
+ b << uint8(slotType);
+ break;
+ }
+ }
+ else
+ b << uint8(slotType);
++itemsShown;
}
}
@@ -946,7 +959,27 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
{
b << uint8(ci->index);
b << item;
- b << uint8(slotType);
+ if (item.follow_loot_rules)
+ {
+ switch (lv.permission)
+ {
+ case MASTER_PERMISSION:
+ b << uint8(LOOT_SLOT_TYPE_MASTER);
+ break;
+ case GROUP_PERMISSION:
+ case ROUND_ROBIN_PERMISSION:
+ if (!item.is_blocked)
+ b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT);
+ else
+ b << uint8(LOOT_SLOT_TYPE_ROLL_ONGOING);
+ break;
+ default:
+ b << uint8(slotType);
+ break;
+ }
+ }
+ else
+ b << uint8(slotType);
++itemsShown;
}
}
@@ -1145,12 +1178,12 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
float chance = RawTotalChance();
if (chance > 101.0f) // TODO: replace with 100% when DBs will be ready
{
- sLog->outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
}
if (chance >= 100.0f && !EqualChanced.empty())
{
- sLog->outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
}
}
@@ -1358,7 +1391,7 @@ bool LootTemplate::addConditionItem(Condition* cond)
{
if (!cond || !cond->isLoaded())//should never happen, checked at loading
{
- sLog->outError("LootTemplate::addConditionItem: condition is null");
+ sLog->outError(LOG_FILTER_LOOT, "LootTemplate::addConditionItem: condition is null");
return false;
}
if (!Entries.empty())
@@ -1417,7 +1450,7 @@ bool LootTemplate::isReference(uint32 id)
void LoadLootTemplates_Creature()
{
- sLog->outString("Loading creature loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1444,16 +1477,14 @@ void LoadLootTemplates_Creature()
LootTemplates_Creature.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
}
void LoadLootTemplates_Disenchant()
{
- sLog->outString("Loading disenchanting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1479,15 +1510,14 @@ void LoadLootTemplates_Disenchant()
LootTemplates_Disenchant.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
}
void LoadLootTemplates_Fishing()
{
- sLog->outString("Loading fishing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1504,16 +1534,14 @@ void LoadLootTemplates_Fishing()
LootTemplates_Fishing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
}
void LoadLootTemplates_Gameobject()
{
- sLog->outString("Loading gameobject loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1526,7 +1554,7 @@ void LoadLootTemplates_Gameobject()
{
if (uint32 lootid = itr->second.GetLootId())
{
- if (sObjectMgr->IsGoOfSpecificEntrySpawned(itr->second.entry) && lootIdSet.find(lootid) == lootIdSet.end())
+ if (lootIdSet.find(lootid) == lootIdSet.end())
LootTemplates_Gameobject.ReportNotExistedId(lootid);
else
lootIdSetUsed.insert(lootid);
@@ -1540,16 +1568,14 @@ void LoadLootTemplates_Gameobject()
LootTemplates_Gameobject.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
}
void LoadLootTemplates_Item()
{
- sLog->outString("Loading item loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading item loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1566,16 +1592,14 @@ void LoadLootTemplates_Item()
LootTemplates_Item.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `item_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
}
void LoadLootTemplates_Milling()
{
- sLog->outString("Loading milling loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1597,16 +1621,14 @@ void LoadLootTemplates_Milling()
LootTemplates_Milling.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
}
void LoadLootTemplates_Pickpocketing()
{
- sLog->outString("Loading pickpocketing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1633,16 +1655,14 @@ void LoadLootTemplates_Pickpocketing()
LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
}
void LoadLootTemplates_Prospecting()
{
- sLog->outString("Loading prospecting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1664,16 +1684,14 @@ void LoadLootTemplates_Prospecting()
LootTemplates_Prospecting.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
}
void LoadLootTemplates_Mail()
{
- sLog->outString("Loading mail loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1690,16 +1708,14 @@ void LoadLootTemplates_Mail()
LootTemplates_Mail.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
}
void LoadLootTemplates_Skinning()
{
- sLog->outString("Loading skinning loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1726,16 +1742,14 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
}
void LoadLootTemplates_Spell()
{
- sLog->outString("Loading spell loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1770,15 +1784,14 @@ void LoadLootTemplates_Spell()
LootTemplates_Spell.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
}
void LoadLootTemplates_Reference()
{
- sLog->outString("Loading reference loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1801,6 +1814,5 @@ void LoadLootTemplates_Reference()
// output error for any still listed ids (not referenced from any loot table)
LootTemplates_Reference.ReportUnusedIds(lootIdSet);
- sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 4a6becc7eff..1af5bd1ea62 100755
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -140,6 +140,7 @@ struct LootItem
bool is_underthreshold : 1;
bool is_counted : 1;
bool needs_quest : 1; // quest drop
+ bool follow_loot_rules : 1;
// Constructor, copies most fields from LootStoreItem, generates random count and random suffixes/properties
// Should be called for non-reference LootStoreItem entries only (mincountOrRef > 0)
@@ -280,6 +281,7 @@ struct Loot
QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
std::vector<LootItem> items;
+ std::vector<LootItem> quest_items;
uint32 gold;
uint8 unlootedCount;
uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
@@ -344,7 +346,6 @@ struct Loot
QuestItemList* FillQuestLoot(Player* player);
QuestItemList* FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting);
- std::vector<LootItem> quest_items;
std::set<uint64> PlayersLooting;
QuestItemMap PlayerQuestItems;
QuestItemMap PlayerFFAItems;
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 3c3888eb9f8..929a1d81d57 100755
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -50,7 +50,7 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery
default:
m_messageType = MAIL_NORMAL;
m_senderId = 0; // will show mail from not existed player
- sLog->outError("MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
+ sLog->outError(LOG_FILTER_GENERAL, "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
break;
}
}
diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h
index dbd03bd96ee..8efb33bda9a 100755
--- a/src/server/game/Mails/Mail.h
+++ b/src/server/game/Mails/Mail.h
@@ -56,8 +56,9 @@ enum MailStationery
MAIL_STATIONERY_DEFAULT = 41,
MAIL_STATIONERY_GM = 61,
MAIL_STATIONERY_AUCTION = 62,
- MAIL_STATIONERY_VAL = 64,
- MAIL_STATIONERY_CHR = 65,
+ MAIL_STATIONERY_VAL = 64, // Valentine
+ MAIL_STATIONERY_CHR = 65, // Christmas
+ MAIL_STATIONERY_ORP = 67, // Orphan
};
enum MailState
@@ -67,17 +68,6 @@ enum MailState
MAIL_STATE_DELETED = 3
};
-enum MailAuctionAnswers
-{
- AUCTION_OUTBIDDED = 0,
- AUCTION_WON = 1,
- AUCTION_SUCCESSFUL = 2,
- AUCTION_EXPIRED = 3,
- AUCTION_CANCELLED_TO_BIDDER = 4,
- AUCTION_CANCELED = 5,
- AUCTION_SALE_PENDING = 6
-};
-
enum MailShowFlags
{
MAIL_SHOW_UNK0 = 0x0001,
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index a9fc3f3350f..b38f89eab8f 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -85,14 +85,14 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy)
FILE* pf=fopen(tmp, "rb");
if (!pf)
- sLog->outError("Map file '%s': does not exist!", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s': does not exist!", tmp);
else
{
map_fileheader header;
if (fread(&header, sizeof(header), 1, pf) == 1)
{
if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt)
- sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
else
ret = true;
}
@@ -112,7 +112,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy)
if (!exists)
{
std::string name = vmgr->getDirFileName(mapid, gx, gy);
- sLog->outError("VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str());
+ sLog->outError(LOG_FILTER_MAPS, "VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str());
return false;
}
}
@@ -146,13 +146,13 @@ void Map::LoadVMap(int gx, int gy)
switch (vmapLoadResult)
{
case VMAP::VMAP_LOAD_RESULT_OK:
- sLog->outDetail("VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outInfo(LOG_FILTER_MAPS, "VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
break;
case VMAP::VMAP_LOAD_RESULT_ERROR:
- sLog->outDetail("Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outInfo(LOG_FILTER_MAPS, "Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
break;
case VMAP::VMAP_LOAD_RESULT_IGNORED:
- sLog->outStaticDebug("Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outDebug(LOG_FILTER_MAPS, "Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
break;
}
}
@@ -179,7 +179,7 @@ void Map::LoadMap(int gx, int gy, bool reload)
//map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?)
if (GridMaps[gx][gy])
{
- sLog->outDetail("Unloading previously loaded map %u before reloading.", GetId());
+ sLog->outInfo(LOG_FILTER_MAPS, "Unloading previously loaded map %u before reloading.", GetId());
sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy);
delete (GridMaps[gx][gy]);
@@ -191,12 +191,12 @@ void Map::LoadMap(int gx, int gy, bool reload)
int len = sWorld->GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1;
tmp = new char[len];
snprintf(tmp, len, (char *)(sWorld->GetDataPath()+"maps/%03u%02u%02u.map").c_str(), GetId(), gx, gy);
- sLog->outDetail("Loading map %s", tmp);
+ sLog->outInfo(LOG_FILTER_MAPS, "Loading map %s", tmp);
// loading data
GridMaps[gx][gy] = new GridMap();
if (!GridMaps[gx][gy]->loadData(tmp))
{
- sLog->outError("Error loading map file: \n %s\n", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map file: \n %s\n", tmp);
}
delete [] tmp;
@@ -287,7 +287,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!p.IsCoordValid())
{
- sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
+ sLog->outError(LOG_FILTER_MAPS, "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
}
@@ -295,7 +295,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
- sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
+ sLog->outDebug(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
ASSERT(ngrid != NULL);
@@ -369,7 +369,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object)
// refresh grid state & timer
if (grid->GetGridState() != GRID_STATE_ACTIVE)
{
- sLog->outStaticDebug("Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId());
ResetGridExpiry(*grid, 0.1f);
grid->SetGridState(GRID_STATE_ACTIVE);
}
@@ -410,7 +410,7 @@ bool Map::AddPlayerToMap(Player* player)
CellCoord cellCoord = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
if (!cellCoord.IsCoordValid())
{
- sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
+ sLog->outError(LOG_FILTER_MAPS, "Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return false;
}
@@ -462,7 +462,7 @@ bool Map::AddToMap(T *obj)
ASSERT(cellCoord.IsCoordValid());
if (!cellCoord.IsCoordValid())
{
- sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
+ sLog->outError(LOG_FILTER_MAPS, "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return false; //Should delete object
}
@@ -472,7 +472,7 @@ bool Map::AddToMap(T *obj)
else
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
AddToGrid(obj, cell);
- sLog->outStaticDebug("Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
+ sLog->outDebug(LOG_FILTER_MAPS, "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
//Must already be set before AddToMap. Usually during obj->Create.
//obj->SetMap(this);
@@ -738,7 +738,7 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie
if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
{
- sLog->outStaticDebug("Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
+ sLog->outDebug(LOG_FILTER_MAPS, "Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
player->RemoveFromGrid();
@@ -1026,7 +1026,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll)
GridMaps[gx][gy] = NULL;
}
- sLog->outStaticDebug("Unloading grid[%u, %u] for map %u finished", x, y, GetId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u finished", x, y, GetId());
return true;
}
@@ -1040,7 +1040,7 @@ void Map::RemoveAllPlayers()
if (!player->IsBeingTeleportedFar())
{
// this is happening for bg
- sLog->outError("Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName(), GetId());
+ sLog->outError(LOG_FILTER_MAPS, "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName(), GetId());
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
}
}
@@ -1113,28 +1113,28 @@ bool GridMap::loadData(char *filename)
// loadup area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
{
- sLog->outError("Error loading map area data\n");
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map area data\n");
fclose(in);
return false;
}
// loadup height data
if (header.heightMapOffset && !loadHeihgtData(in, header.heightMapOffset, header.heightMapSize))
{
- sLog->outError("Error loading map height data\n");
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map height data\n");
fclose(in);
return false;
}
// loadup liquid data
if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize))
{
- sLog->outError("Error loading map liquids data\n");
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map liquids data\n");
fclose(in);
return false;
}
fclose(in);
return true;
}
- sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename);
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename);
fclose(in);
return false;
}
@@ -1254,7 +1254,7 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
return true;
}
-uint16 GridMap::getArea(float x, float y)
+uint16 GridMap::getArea(float x, float y) const
{
if (!_areaMap)
return _gridArea;
@@ -1487,7 +1487,7 @@ float GridMap::getHeightFromUint16(float x, float y) const
return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight;
}
-float GridMap::getLiquidLevel(float x, float y)
+float GridMap::getLiquidLevel(float x, float y) const
{
if (!_liquidMap)
return _liquidLevel;
@@ -1507,7 +1507,7 @@ float GridMap::getLiquidLevel(float x, float y)
}
// Why does this return LIQUID data?
-uint8 GridMap::getTerrainType(float x, float y)
+uint8 GridMap::getTerrainType(float x, float y) const
{
if (!_liquidFlags)
return 0;
@@ -1724,7 +1724,7 @@ bool Map::IsOutdoors(float x, float y, float z) const
WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
if (wmoEntry)
{
- sLog->outStaticDebug("Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
+ sLog->outDebug(LOG_FILTER_MAPS, "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
atEntry = GetAreaEntryByAreaID(wmoEntry->areaId);
}
return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
@@ -2011,7 +2011,7 @@ void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpa
void Map::SendInitSelf(Player* player)
{
- sLog->outDetail("Creating player data for himself %u", player->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_MAPS, "Creating player data for himself %u", player->GetGUIDLow());
UpdateData data;
@@ -2095,7 +2095,7 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)
{
if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)
{
- sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y);
+ sLog->outError(LOG_FILTER_MAPS, "map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y);
ASSERT(false);
}
i_grids[x][y] = grid;
@@ -2168,7 +2168,7 @@ void Map::RemoveAllObjectsInRemoveList()
{
Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID());
if (!corpse)
- sLog->outError("Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow());
+ sLog->outError(LOG_FILTER_MAPS, "Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow());
else
RemoveFromMap(corpse, true);
break;
@@ -2186,7 +2186,7 @@ void Map::RemoveAllObjectsInRemoveList()
RemoveFromMap(obj->ToCreature(), true);
break;
default:
- sLog->outError("Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId());
+ sLog->outError(LOG_FILTER_MAPS, "Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId());
break;
}
@@ -2263,7 +2263,7 @@ void Map::AddToActive(Creature* c)
else
{
GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY());
- sLog->outError("Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
+ sLog->outError(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord);
}
}
@@ -2284,7 +2284,7 @@ void Map::RemoveFromActive(Creature* c)
else
{
GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY());
- sLog->outError("Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
+ sLog->outError(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord);
}
}
@@ -2335,7 +2335,7 @@ bool InstanceMap::CanEnter(Player* player)
{
if (player->GetMapRef().getTarget() == this)
{
- sLog->outError("InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
ASSERT(false);
return false;
}
@@ -2348,7 +2348,7 @@ bool InstanceMap::CanEnter(Player* player)
uint32 maxPlayers = GetMaxPlayers();
if (GetPlayersCountExceptGMs() >= maxPlayers)
{
- sLog->outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
return false;
}
@@ -2418,7 +2418,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!mapSave)
{
- sLog->outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
+ sLog->outInfo(LOG_FILTER_MAPS, "InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
}
@@ -2429,7 +2429,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// cannot enter other instances if bound permanently
if (playerBind->save != mapSave)
{
- sLog->outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset());
return false;
}
}
@@ -2441,9 +2441,9 @@ bool InstanceMap::AddPlayerToMap(Player* player)
InstanceGroupBind* groupBind = group->GetBoundInstance(this);
if (playerBind)
{
- sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
if (groupBind)
- sLog->outError("InstanceMap::Add: the group is bound to the instance %d, %d, %d, %d, %d, %d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: the group is bound to the instance %d, %d, %d, %d, %d, %d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
//ASSERT(false);
return false;
}
@@ -2455,15 +2455,15 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// cannot jump to a different instance without resetting it
if (groupBind->save != mapSave)
{
- sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
if (mapSave)
- sLog->outError("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
+ sLog->outError(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
else
- sLog->outError("MapSave NULL");
+ sLog->outError(LOG_FILTER_MAPS, "MapSave NULL");
if (groupBind->save)
- sLog->outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
+ sLog->outError(LOG_FILTER_MAPS, "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
else
- sLog->outError("GroupBind save NULL");
+ sLog->outError(LOG_FILTER_MAPS, "GroupBind save NULL");
return false;
}
// if the group/leader is permanently bound to the instance
@@ -2494,7 +2494,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin())))
- if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM)
+ if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM))
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
}
@@ -2502,7 +2502,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// first player enters (no players yet)
SetResetSchedule(false);
- sLog->outDetail("MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName());
// initialize unload state
m_unloadTimer = 0;
m_resetAfterUnload = false;
@@ -2528,7 +2528,7 @@ void InstanceMap::Update(const uint32 t_diff)
void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
{
- sLog->outDetail("MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
//if last player set unload timer
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
@@ -2623,7 +2623,7 @@ void InstanceMap::PermBindAllPlayers(Player* source)
InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!save)
{
- sLog->outError("Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId());
+ sLog->outError(LOG_FILTER_MAPS, "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId());
return;
}
@@ -2656,7 +2656,7 @@ void InstanceMap::UnloadAll()
ASSERT(!HavePlayers());
if (m_resetAfterUnload == true)
- sObjectMgr->DeleteRespawnTimeForInstance(GetInstanceId());
+ DeleteRespawnTimes();
Map::UnloadAll();
}
@@ -2677,7 +2677,7 @@ void InstanceMap::SetResetSchedule(bool on)
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()))
sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
else
- sLog->outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)",
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)",
on ? "on" : "off", GetId(), GetMapName(), GetInstanceId(), Difficulty(GetSpawnMode()));
}
}
@@ -2739,7 +2739,7 @@ bool BattlegroundMap::CanEnter(Player* player)
{
if (player->GetMapRef().getTarget() == this)
{
- sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_MAPS, "BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow());
ASSERT(false);
return false;
}
@@ -2767,7 +2767,7 @@ bool BattlegroundMap::AddPlayerToMap(Player* player)
void BattlegroundMap::RemovePlayerFromMap(Player* player, bool remove)
{
- sLog->outDetail("MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
Map::RemovePlayerFromMap(player, remove);
}
@@ -2805,3 +2805,134 @@ void Map::UpdateIteratorBack(Player* player)
if (m_mapRefIter == player->GetMapRef())
m_mapRefIter = m_mapRefIter->nocheck_prev();
}
+
+void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime)
+{
+ if (!respawnTime)
+ {
+ // Delete only
+ RemoveCreatureRespawnTime(dbGuid);
+ return;
+ }
+
+ _creatureRespawnTimes[dbGuid] = respawnTime;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
+ stmt->setUInt32(0, dbGuid);
+ stmt->setUInt32(1, uint32(respawnTime));
+ stmt->setUInt16(2, GetId());
+ stmt->setUInt32(3, GetInstanceId());
+ CharacterDatabase.Execute(stmt);
+}
+
+void Map::RemoveCreatureRespawnTime(uint32 dbGuid)
+{
+ _creatureRespawnTimes.erase(dbGuid);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
+ stmt->setUInt32(0, dbGuid);
+ stmt->setUInt16(1, GetId());
+ stmt->setUInt32(2, GetInstanceId());
+ CharacterDatabase.Execute(stmt);
+}
+
+void Map::SaveGORespawnTime(uint32 dbGuid, time_t respawnTime)
+{
+ if (!respawnTime)
+ {
+ // Delete only
+ RemoveGORespawnTime(dbGuid);
+ return;
+ }
+
+ _goRespawnTimes[dbGuid] = respawnTime;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN);
+ stmt->setUInt32(0, dbGuid);
+ stmt->setUInt32(1, uint32(respawnTime));
+ stmt->setUInt16(2, GetId());
+ stmt->setUInt32(3, GetInstanceId());
+ CharacterDatabase.Execute(stmt);
+}
+
+void Map::RemoveGORespawnTime(uint32 dbGuid)
+{
+ _goRespawnTimes.erase(dbGuid);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN);
+ stmt->setUInt32(0, dbGuid);
+ stmt->setUInt16(1, GetId());
+ stmt->setUInt32(2, GetInstanceId());
+ CharacterDatabase.Execute(stmt);
+}
+
+void Map::LoadRespawnTimes()
+{
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CREATURE_RESPAWNS);
+ stmt->setUInt16(0, GetId());
+ stmt->setUInt32(1, GetInstanceId());
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 loguid = fields[0].GetUInt32();
+ uint32 respawnTime = fields[1].GetUInt32();
+
+ _creatureRespawnTimes[loguid] = time_t(respawnTime);
+ } while (result->NextRow());
+ }
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GO_RESPAWNS);
+ stmt->setUInt16(0, GetId());
+ stmt->setUInt32(1, GetInstanceId());
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 loguid = fields[0].GetUInt32();
+ uint32 respawnTime = fields[1].GetUInt32();
+
+ _goRespawnTimes[loguid] = time_t(respawnTime);
+ } while (result->NextRow());
+ }
+}
+
+void Map::DeleteRespawnTimes()
+{
+ _creatureRespawnTimes.clear();
+ _goRespawnTimes.clear();
+
+ DeleteRespawnTimesInDB(GetId(), GetInstanceId());
+}
+
+void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
+{
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE);
+ stmt->setUInt16(0, mapId);
+ stmt->setUInt32(1, instanceId);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN_BY_INSTANCE);
+ stmt->setUInt16(0, mapId);
+ stmt->setUInt32(1, instanceId);
+ CharacterDatabase.Execute(stmt);
+}
+
+time_t Map::GetLinkedRespawnTime(uint64 guid) const
+{
+ uint64 linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid);
+ switch (GUID_HIPART(linkedGuid))
+ {
+ case HIGHGUID_UNIT:
+ return GetCreatureRespawnTime(GUID_LOPART(linkedGuid));
+ case HIGHGUID_GAMEOBJECT:
+ return GetGORespawnTime(GUID_LOPART(linkedGuid));
+ default:
+ break;
+ }
+
+ return time_t(0);
+}
+
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 925adfbc15a..126d0855352 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -195,10 +195,10 @@ public:
bool loadData(char* filaname);
void unloadData();
- uint16 getArea(float x, float y);
- inline float getHeight(float x, float y) {return (this->*_gridGetHeight)(x, y);}
- float getLiquidLevel(float x, float y);
- uint8 getTerrainType(float x, float y);
+ uint16 getArea(float x, float y) const;
+ inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);}
+ float getLiquidLevel(float x, float y) const;
+ uint8 getTerrainType(float x, float y) const;
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
};
@@ -230,7 +230,7 @@ enum LevelRequirementVsMode
#define MAX_HEIGHT 100000.0f // can be use for find ground height at surface
#define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
#define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT
-#define DEFAULT_HEIGHT_SEARCH 10.0f // default search distance to find height at nearby locations
+#define DEFAULT_HEIGHT_SEARCH 50.0f // default search distance to find height at nearby locations
#define MIN_UNLOAD_DELAY 1 // immediate unload
typedef std::map<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
@@ -441,10 +441,42 @@ class Map : public GridRefManager<NGridType>
float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
void Balance() { _dynamicTree.balance(); }
- void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); }
- void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); }
- bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);}
+ void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
+ void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
+ bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
+
+ /*
+ RESPAWN TIMES
+ */
+ time_t GetLinkedRespawnTime(uint64 guid) const;
+ time_t GetCreatureRespawnTime(uint32 dbGuid) const
+ {
+ UNORDERED_MAP<uint32 /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
+ if (itr != _creatureRespawnTimes.end())
+ return itr->second;
+
+ return time_t(0);
+ }
+
+ time_t GetGORespawnTime(uint32 dbGuid) const
+ {
+ UNORDERED_MAP<uint32 /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
+ if (itr != _goRespawnTimes.end())
+ return itr->second;
+
+ return time_t(0);
+ }
+
+ void SaveCreatureRespawnTime(uint32 dbGuid, time_t respawnTime);
+ void RemoveCreatureRespawnTime(uint32 dbGuid);
+ void SaveGORespawnTime(uint32 dbGuid, time_t respawnTime);
+ void RemoveGORespawnTime(uint32 dbGuid);
+ void LoadRespawnTimes();
+ void DeleteRespawnTimes();
+
+ static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
+
private:
void LoadMapAndVMap(int gx, int gy);
void LoadVMap(int gx, int gy);
@@ -491,6 +523,7 @@ class Map : public GridRefManager<NGridType>
void ScriptsProcess();
void UpdateActiveCells(const float &x, const float &y, const uint32 t_diff);
+
protected:
void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); }
@@ -573,6 +606,9 @@ class Map : public GridRefManager<NGridType>
else
m_activeNonPlayers.erase(obj);
}
+
+ UNORDERED_MAP<uint32 /*dbGUID*/, time_t> _creatureRespawnTimes;
+ UNORDERED_MAP<uint32 /*dbGUID*/, time_t> _goRespawnTimes;
};
enum InstanceResetMethod
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index 5924b9246f6..e0dbc19aff4 100755
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -194,13 +194,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
const MapEntry* entry = sMapStore.LookupEntry(GetId());
if (!entry)
{
- sLog->outError("CreateInstance: no entry for map %d", GetId());
+ sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no entry for map %d", GetId());
ASSERT(false);
}
const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId());
if (!iTemplate)
{
- sLog->outError("CreateInstance: no instance template for map %d", GetId());
+ sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no instance template for map %d", GetId());
ASSERT(false);
}
@@ -212,6 +212,8 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
ASSERT(map->IsDungeon());
+ map->LoadRespawnTimes();
+
bool load_data = save != NULL;
map->CreateInstanceData(load_data);
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index eb09538721d..b49d7db0a27 100755
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -77,7 +77,7 @@ void MapManager::checkAndCorrectGridStatesArray()
{
if (i_GridStates[i] != si_GridStates[i])
{
- sLog->outError("MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
+ sLog->outError(LOG_FILTER_MAPS, "MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
ok = false;
si_GridStates[i] = i_GridStates[i];
}
@@ -110,6 +110,7 @@ Map* MapManager::CreateBaseMap(uint32 id)
else
{
map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
+ map->LoadRespawnTimes();
}
i_maps[id] = map;
}
@@ -410,7 +411,7 @@ uint32 MapManager::GenerateInstanceId()
if (newInstanceId == _nextInstanceId)
{
- sLog->outError("Instance ID overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_MAPS, "Instance ID overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h
index 1049325237a..aa07eef2204 100755
--- a/src/server/game/Maps/MapManager.h
+++ b/src/server/game/Maps/MapManager.h
@@ -71,7 +71,7 @@ class MapManager
void SetMapUpdateInterval(uint32 t)
{
- if (t > MIN_MAP_UPDATE_DELAY)
+ if (t < MIN_MAP_UPDATE_DELAY)
t = MIN_MAP_UPDATE_DELAY;
i_timer.SetInterval(t);
@@ -143,7 +143,7 @@ class MapManager
void RegisterInstanceId(uint32 instanceId);
void FreeInstanceId(uint32 instanceId);
- uint32 GetNextInstanceId() { return _nextInstanceId; };
+ uint32 GetNextInstanceId() const { return _nextInstanceId; };
void SetNextInstanceId(uint32 nextInstanceId) { _nextInstanceId = nextInstanceId; };
MapUpdater * GetMapUpdater() { return &m_updater; }
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index bf00514000e..dac5b1ef9a2 100755
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -127,7 +127,7 @@ namespace Trinity
nBaseExp = 580;
break;
default:
- sLog->outError("BaseGain: Unsupported content level %u", content);
+ sLog->outError(LOG_FILTER_GENERAL, "BaseGain: Unsupported content level %u", content);
nBaseExp = 45;
break;
}
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 547f1679b61..a766108dbb0 100755
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -522,8 +522,11 @@ enum TrinityStrings
LANG_YOURS_EXPLORE_SET_ALL = 553,
LANG_YOURS_EXPLORE_SET_NOTHING = 554,
- LANG_HOVER_ENABLED = 555,
- LANG_HOVER_DISABLED = 556,
+ LANG_NPC_SETDATA = 555,
+
+ //! Old ones now free:
+ // LANG_HOVER_DISABLED = 556,
+
LANG_YOURS_LEVEL_UP = 557,
LANG_YOURS_LEVEL_DOWN = 558,
LANG_YOURS_LEVEL_PROGRESS_RESET = 559,
@@ -954,7 +957,10 @@ enum TrinityStrings
LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029,
LANG_FLEE = 5030,
LANG_NPCINFO_AIINFO = 5031,
- // Room for more Trinity strings 5032-9999
+ LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032,
+ LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033,
+ LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034,
+ // Room for more Trinity strings 5035-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 16821834669..501408243bb 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -270,7 +270,7 @@ enum SpellAttr0
SPELL_ATTR0_UNK0 = 0x00000001, // 0
SPELL_ATTR0_REQ_AMMO = 0x00000002, // 1 on next ranged
SPELL_ATTR0_ON_NEXT_SWING = 0x00000004, // 2
- SPELL_ATTR0_UNK3 = 0x00000008, // 3 not set in 3.0.3
+ SPELL_ATTR0_IS_REPLENISHMENT = 0x00000008, // 3 not set in 3.0.3
SPELL_ATTR0_ABILITY = 0x00000010, // 4 client puts 'ability' instead of 'spell' in game strings for these spells
SPELL_ATTR0_TRADESPELL = 0x00000020, // 5 trade spells (recipes), will be added by client to a sublist of profession spell
SPELL_ATTR0_PASSIVE = 0x00000040, // 6 Passive spell
@@ -315,7 +315,7 @@ enum SpellAttr1
SPELL_ATTR1_MELEE_COMBAT_START = 0x00000200, // 9 player starts melee combat after this spell is cast
SPELL_ATTR1_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100% (old NO_INITIAL_AGGRO)
SPELL_ATTR1_UNK11 = 0x00000800, // 11 aura
- SPELL_ATTR1_UNK12 = 0x00001000, // 12 pickpoket
+ SPELL_ATTR1_IS_PICKPOCKET = 0x00001000, // 12 Pickpocket
SPELL_ATTR1_FARSIGHT = 0x00002000, // 13 Client removes farsight on aura loss
SPELL_ATTR1_CHANNEL_TRACK_TARGET = 0x00004000, // 14 Client automatically forces player to face target when channeling
SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // 15 remove auras on immunity
@@ -327,7 +327,7 @@ enum SpellAttr1
SPELL_ATTR1_UNK21 = 0x00200000, // 21
SPELL_ATTR1_REQ_COMBO_POINTS2 = 0x00400000, // 22 Req combo points on target
SPELL_ATTR1_UNK23 = 0x00800000, // 23
- SPELL_ATTR1_UNK24 = 0x01000000, // 24 only fishing spells
+ SPELL_ATTR1_IS_FISHING = 0x01000000, // 24 only fishing spells
SPELL_ATTR1_UNK25 = 0x02000000, // 25
SPELL_ATTR1_UNK26 = 0x04000000, // 26 works correctly with [target=focus] and [target=mouseover] macros?
SPELL_ATTR1_UNK27 = 0x08000000, // 27 melee spell?
@@ -352,17 +352,17 @@ enum SpellAttr2
SPELL_ATTR2_UNK10 = 0x00000400, // 10 related to tame
SPELL_ATTR2_HEALTH_FUNNEL = 0x00000800, // 11
SPELL_ATTR2_UNK12 = 0x00001000, // 12 Cleave, Heart Strike, Maul, Sunder Armor, Swipe
- SPELL_ATTR2_UNK13 = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas
+ SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas
SPELL_ATTR2_UNK14 = 0x00004000, // 14
SPELL_ATTR2_UNK15 = 0x00008000, // 15 not set in 3.0.3
SPELL_ATTR2_TAME_BEAST = 0x00010000, // 16
SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 don't reset timers for melee autoattacks (swings) or ranged autoattacks (autoshoots)
- SPELL_ATTR2_UNK18 = 0x00040000, // 18 Only Revive pet - possible req dead pet
+ SPELL_ATTR2_REQ_DEAD_PET = 0x00040000, // 18 Only Revive pet and Heart of the Pheonix
SPELL_ATTR2_NOT_NEED_SHAPESHIFT = 0x00080000, // 19 does not necessarly need shapeshift
SPELL_ATTR2_UNK20 = 0x00100000, // 20
SPELL_ATTR2_DAMAGE_REDUCED_SHIELD = 0x00200000, // 21 for ice blocks, pala immunity buffs, priest absorb shields, but used also for other spells -> not sure!
SPELL_ATTR2_UNK22 = 0x00400000, // 22 Ambush, Backstab, Cheap Shot, Death Grip, Garrote, Judgements, Mutilate, Pounce, Ravage, Shiv, Shred
- SPELL_ATTR2_UNK23 = 0x00800000, // 23 Only mage Arcane Concentration have this flag
+ SPELL_ATTR2_IS_ARCANE_CONCENTRATION = 0x00800000, // 23 Only mage Arcane Concentration have this flag
SPELL_ATTR2_UNK24 = 0x01000000, // 24
SPELL_ATTR2_UNK25 = 0x02000000, // 25
SPELL_ATTR2_UNK26 = 0x04000000, // 26 unaffected by school immunity
@@ -389,7 +389,7 @@ enum SpellAttr3
SPELL_ATTR3_BATTLEGROUND = 0x00000800, // 11 Can casted only on battleground
SPELL_ATTR3_ONLY_TARGET_GHOSTS = 0x00001000, // 12
SPELL_ATTR3_UNK13 = 0x00002000, // 13
- SPELL_ATTR3_UNK14 = 0x00004000, // 14 "Honorless Target" only this spells have this flag
+ 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
SPELL_ATTR3_NO_INITIAL_AGGRO = 0x00020000, // 17 Soothe Animal, 39758, Mind Soothe
@@ -433,16 +433,16 @@ enum SpellAttr4
SPELL_ATTR4_UNK19 = 0x00080000, // 19 proc dalayed, after damage or don't proc on absorb?
SPELL_ATTR4_NOT_CHECK_SELFCAST_POWER = 0x00100000, // 20 supersedes message "More powerful spell applied" for self casts.
SPELL_ATTR4_UNK21 = 0x00200000, // 21 Pally aura, dk presence, dudu form, warrior stance, shadowform, hunter track
- SPELL_ATTR4_UNK22 = 0x00400000, // 22
+ SPELL_ATTR4_UNK22 = 0x00400000, // 22 Seal of Command (42058,57770) and Gymer's Smash 55426
SPELL_ATTR4_UNK23 = 0x00800000, // 23
SPELL_ATTR4_UNK24 = 0x01000000, // 24 some shoot spell
- SPELL_ATTR4_UNK25 = 0x02000000, // 25 pet scaling auras
+ SPELL_ATTR4_IS_PET_SCALING = 0x02000000, // 25 pet scaling auras
SPELL_ATTR4_CAST_ONLY_IN_OUTLAND = 0x04000000, // 26 Can only be used in Outland.
SPELL_ATTR4_UNK27 = 0x08000000, // 27
SPELL_ATTR4_UNK28 = 0x10000000, // 28 Aimed Shot
SPELL_ATTR4_UNK29 = 0x20000000, // 29
SPELL_ATTR4_UNK30 = 0x40000000, // 30
- SPELL_ATTR4_UNK31 = 0x80000000 // 31
+ SPELL_ATTR4_UNK31 = 0x80000000 // 31 Polymorph (chicken) 228 and Sonic Boom (38052,38488)
};
enum SpellAttr5
@@ -462,7 +462,7 @@ enum SpellAttr5
SPELL_ATTR5_UNK12 = 0x00001000, // 12 Cleave related?
SPELL_ATTR5_HASTE_AFFECT_DURATION = 0x00002000, // 13 haste effects decrease duration of this
SPELL_ATTR5_UNK14 = 0x00004000, // 14
- SPELL_ATTR5_UNK15 = 0x00008000, // 15
+ SPELL_ATTR5_UNK15 = 0x00008000, // 15 Inflits on multiple targets?
SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped
SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared
SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused
@@ -2567,7 +2567,7 @@ enum CreatureTypeFlags
{
CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter
CREATURE_TYPEFLAGS_GHOST = 0x00000002, // Creature are also visible for not alive player. Allow gossip interaction if npcflag allow?
- CREATURE_TYPEFLAGS_UNK2 = 0x00000004,
+ CREATURE_TYPEFLAGS_BOSS = 0x00000004,
CREATURE_TYPEFLAGS_UNK3 = 0x00000008,
CREATURE_TYPEFLAGS_UNK4 = 0x00000010,
CREATURE_TYPEFLAGS_UNK5 = 0x00000020,
@@ -3152,8 +3152,6 @@ enum SummonType
enum EventId
{
- EVENT_SPELLCLICK = 1001,
- EVENT_FALL_GROUND = 1002,
EVENT_CHARGE = 1003,
};
@@ -3295,20 +3293,20 @@ enum BanReturn
// indexes of BattlemasterList.dbc
enum BattlegroundTypeId
{
- BATTLEGROUND_TYPE_NONE = 0,
- BATTLEGROUND_AV = 1,
- BATTLEGROUND_WS = 2,
- BATTLEGROUND_AB = 3,
- BATTLEGROUND_NA = 4,
- BATTLEGROUND_BE = 5,
- BATTLEGROUND_AA = 6,
- BATTLEGROUND_EY = 7,
- BATTLEGROUND_RL = 8,
- BATTLEGROUND_SA = 9,
- BATTLEGROUND_DS = 10,
- BATTLEGROUND_RV = 11,
- BATTLEGROUND_IC = 30,
- BATTLEGROUND_RB = 32
+ BATTLEGROUND_TYPE_NONE = 0, // None
+ BATTLEGROUND_AV = 1, // Alterac Valley
+ BATTLEGROUND_WS = 2, // Warsong Gulch
+ BATTLEGROUND_AB = 3, // Arathi Basin
+ BATTLEGROUND_NA = 4, // Nagrand Arena
+ BATTLEGROUND_BE = 5, // Blade's Edge Arena
+ BATTLEGROUND_AA = 6, // All Arenas
+ BATTLEGROUND_EY = 7, // Eye of the Storm
+ BATTLEGROUND_RL = 8, // Ruins of Lordaernon
+ BATTLEGROUND_SA = 9, // Strand of the Ancients
+ BATTLEGROUND_DS = 10, // Dalaran Sewers
+ BATTLEGROUND_RV = 11, // Ring of Valor
+ BATTLEGROUND_IC = 30, // Isle of Conquest
+ BATTLEGROUND_RB = 32 // Random Battleground
};
#define MAX_BATTLEGROUND_TYPE_ID 33
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 7e8020b7863..dd053534c8a 100755..100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -114,6 +114,9 @@ void MotionMaster::UpdateMotion(uint32 diff)
_cleanFlag &= ~MMCF_RESET;
}
+
+ // probably not the best place to pu this but im not really sure where else to put it.
+ _owner->UpdateUnderwaterState(_owner->GetMap(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
}
void MotionMaster::DirectClean(bool reset)
@@ -186,7 +189,7 @@ void MotionMaster::MoveRandom(float spawndist)
{
if (_owner->GetTypeId() == TYPEID_UNIT)
{
- sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE);
}
}
@@ -197,22 +200,22 @@ void MotionMaster::MoveTargetedHome()
if (_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)_owner)->GetCharmerOrOwnerGUID())
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow());
Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE);
}
else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID())
{
- sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow());
Unit *target = ((Creature*)_owner)->GetCharmerOrOwner();
if (target)
{
- sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
Mutate(new FollowMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE);
}
}
else
{
- sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow());
+ sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow());
}
}
@@ -220,12 +223,12 @@ void MotionMaster::MoveConfused()
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) move confused", _owner->GetGUIDLow());
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) move confused",
_owner->GetEntry(), _owner->GetGUIDLow());
Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED);
}
@@ -240,7 +243,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
//_owner->ClearUnitState(UNIT_STATE_FOLLOW);
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) chase to %s (GUID: %u)",
_owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
@@ -248,7 +251,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
@@ -265,14 +268,14 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
//_owner->AddUnitState(UNIT_STATE_FOLLOW);
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
Mutate(new FollowMovementGenerator<Player>(*target,dist,angle), slot);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
@@ -284,42 +287,40 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath), MOTION_SLOT_ACTIVE);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath), MOTION_SLOT_ACTIVE);
}
}
-void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed)
+void MotionMaster::MoveLand(uint32 id, Position const& pos)
{
float x, y, z;
pos.GetPosition(x, y, z);
- sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(*_owner);
init.MoveTo(x,y,z);
- init.SetVelocity(speed);
init.SetAnimation(Movement::ToGround);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
}
-void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
+void MotionMaster::MoveTakeoff(uint32 id, Position const& pos)
{
float x, y, z;
pos.GetPosition(x, y, z);
- sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(*_owner);
init.MoveTo(x,y,z);
- init.SetVelocity(speed);
init.SetAnimation(Movement::ToFly);
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
@@ -334,9 +335,17 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
float x, y, z;
float moveTimeHalf = speedZ / Movement::gravity;
float dist = 2 * moveTimeHalf * speedXY;
+ float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ);
_owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI);
- MoveJump(x, y, z, speedXY, speedZ);
+
+ Movement::MoveSplineInit init(*_owner);
+ init.MoveTo(x,y,z);
+ init.SetParabolic(max_height,0);
+ init.SetOrientationFixed(true);
+ init.SetVelocity(speedXY);
+ init.Launch();
+ Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
@@ -355,7 +364,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id)
{
- sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
float moveTimeHalf = speedZ / Movement::gravity;
float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ);
@@ -374,7 +383,7 @@ void MotionMaster::MoveFall(uint32 id/*=0*/)
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
- sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
+ sLog->outDebug(LOG_FILTER_GENERAL, "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
return;
}
@@ -403,12 +412,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath, speed), MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, speed), MOTION_SLOT_CONTROLLED);
}
@@ -418,11 +427,11 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow());
+ sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow());
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
_owner->AttackStop();
_owner->ToCreature()->SetReactState(REACT_PASSIVE);
@@ -434,11 +443,11 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow());
+ sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow());
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), time);
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
}
@@ -454,14 +463,14 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow());
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
_owner->GetEntry(), _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
@@ -479,19 +488,19 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if (path < sTaxiPathNodesByPath.size())
{
- sLog->outStaticDebug("%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode);
+ sLog->outDebug(LOG_FILTER_GENERAL, "%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode);
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outError("%s attempt taxi to (not existed Path %u node %u)",
+ sLog->outError(LOG_FILTER_GENERAL, "%s attempt taxi to (not existed Path %u node %u)",
_owner->GetName(), path, pathnode);
}
}
else
{
- sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
+ sLog->outError(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
}
}
@@ -503,11 +512,11 @@ void MotionMaster::MoveDistract(uint32 timer)
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) (timer: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), timer);
}
@@ -559,7 +568,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
- sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
}
@@ -618,7 +627,7 @@ void MotionMaster::DirectDelete(_Ty curr)
void MotionMaster::DelayedDelete(_Ty curr)
{
- sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
if (isStatic(curr))
return;
if (!_expList)
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index a96a3e6391a..f10c6569cad 100755
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -157,8 +157,8 @@ class MotionMaster //: private std::stack<MovementGenerator *>
void MovePoint(uint32 id, float x, float y, float z, bool generatePath = false);
// These two movement types should only be used with creatures having landing/takeoff animations
- void MoveLand(uint32 id, Position const& pos, float speed);
- void MoveTakeoff(uint32 id, Position const& pos, float speed);
+ void MoveLand(uint32 id, Position const& pos);
+ void MoveTakeoff(uint32 id, Position const& pos);
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
index 216721360c6..f122349a71c 100755..100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
@@ -23,10 +23,8 @@
#include "MoveSplineInit.h"
#include "MoveSpline.h"
-void HomeMovementGenerator<Creature>::Initialize(Creature & owner)
+void HomeMovementGenerator<Creature>::Initialize(Creature& owner)
{
- owner.SetWalk(false);
- owner.AddUnitState(UNIT_STATE_EVADE);
_setTargetLocation(owner);
}
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index 7a8ad4584b0..cdb8a0a2a05 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -33,6 +33,7 @@ void PointMovementGenerator<T>::Initialize(T &unit)
unit.StopMoving();
unit.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
+ i_recalculateSpeed = false;
Movement::MoveSplineInit init(unit);
init.MoveTo(i_x, i_y, i_z, m_generatePath);
if (speed > 0.0f)
@@ -53,6 +54,17 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/)
}
unit.AddUnitState(UNIT_STATE_ROAMING_MOVE);
+
+ if (i_recalculateSpeed && !unit.movespline->Finalized())
+ {
+ i_recalculateSpeed = false;
+ Movement::MoveSplineInit init(unit);
+ init.MoveTo(i_x, i_y, i_z);
+ if (speed > 0.0f) // Default value for point motion type is 0.0, if 0.0 spline will use GetSpeed on unit
+ init.SetVelocity(speed);
+ init.Launch();
+ }
+
return !unit.movespline->Finalized();
}
@@ -82,11 +94,6 @@ void PointMovementGenerator<T>::MovementInform(T & /*unit*/)
template <> void PointMovementGenerator<Creature>::MovementInform(Creature &unit)
{
- //if (id == EVENT_FALL_GROUND)
- //{
- // unit.setDeathState(JUST_DIED);
- // unit.SetFlying(true);
- //}
if (unit.AI())
unit.AI()->MovementInform(POINT_MOTION_TYPE, id);
}
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
index 404d3362bab..541cbdbc3a7 100755..100644
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
@@ -36,6 +36,8 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
void MovementInform(T &);
+ void unitSpeedChanged() { i_recalculateSpeed = true; }
+
MovementGeneratorType GetMovementGeneratorType() { return POINT_MOTION_TYPE; }
bool GetDestination(float& x, float& y, float& z) const { x=i_x; y=i_y; z=i_z; return true; }
@@ -44,6 +46,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
float i_x, i_y, i_z;
float speed;
bool m_generatePath;
+ bool i_recalculateSpeed;
};
class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
index 63e3ebfd378..1680bfeb1d4 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
@@ -130,7 +130,7 @@ bool TargetedMovementGeneratorMedium<T,D>::Update(T &owner, const uint32 & time_
}
// prevent movement while casting spells with cast time or channel time
- if (owner.IsNonMeleeSpellCasted(false, false, true))
+ if (owner.HasUnitState(UNIT_STATE_CASTING))
{
if (!owner.IsStopped())
owner.StopMoving();
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 6d060668e4c..8c2db9ddbd6 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -41,7 +41,7 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature)
if (!i_path)
{
// No movement found for entry
- sLog->outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature.GetName(), creature.GetEntry(), creature.GetGUIDLow(), path_id);
+ sLog->outError(LOG_FILTER_SQL, "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature.GetName(), creature.GetEntry(), creature.GetGUIDLow(), path_id);
return;
}
@@ -107,7 +107,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
i_currentNode = (i_currentNode+1) % i_path->size();
}
- const WaypointData *node = i_path->at(i_currentNode);
+ WaypointData const* node = i_path->at(i_currentNode);
m_isArrivalDone = false;
@@ -116,7 +116,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
Movement::MoveSplineInit init(creature);
init.MoveTo(node->x, node->y, node->z);
- if (node->orientation != 100 && node->delay != 0)
+ //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table
+ if (node->orientation && node->delay)
init.SetFacing(node->orientation);
init.SetWalk(!node->run);
@@ -313,9 +314,9 @@ void FlightPathMovementGenerator::PreloadEndGrid()
// Load the grid
if (endMap)
{
- sLog->outDetail("Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1));
+ sLog->outInfo(LOG_FILTER_GENERAL, "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1));
endMap->LoadGrid(_endGridX, _endGridY);
}
else
- sLog->outDetail("Unable to determine map to preload flightmaster grid");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unable to determine map to preload flightmaster grid");
}
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index 91b4ff08250..61bd3900b9d 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -153,7 +153,7 @@ void MoveSpline::init_spline(const MoveSplineInitArgs& args)
// TODO: what to do in such cases? problem is in input data (all points are at same coords)
if (spline.length() < minimal_duration)
{
- sLog->outError("MoveSpline::init_spline: zero length spline, wrong input data?");
+ sLog->outError(LOG_FILTER_GENERAL, "MoveSpline::init_spline: zero length spline, wrong input data?");
spline.set_length(spline.last(), spline.isCyclic() ? 1000 : 1);
}
point_Idx = spline.first();
@@ -199,11 +199,11 @@ bool MoveSplineInitArgs::Validate() const
#define CHECK(exp) \
if (!(exp))\
{\
- sLog->outError("MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\
+ sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\
return false;\
}
CHECK(path.size() > 1);
- CHECK(velocity > 0.f);
+ CHECK(velocity > 0.1f);
CHECK(time_perc >= 0.f && time_perc <= 1.f);
//CHECK(_checkPathBounds());
return true;
@@ -226,7 +226,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const
offset = path[i] - middle;
if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET)
{
- sLog->outError("MoveSplineInitArgs::_checkPathBounds check failed");
+ sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::_checkPathBounds check failed");
return false;
}
}
diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h
index 33973064e09..cfc2fdee450 100644
--- a/src/server/game/Movement/Spline/MoveSplineFlag.h
+++ b/src/server/game/Movement/Spline/MoveSplineFlag.h
@@ -34,43 +34,43 @@ namespace Movement
{
public:
enum eFlags{
- None = 0x00000000,
- // x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
- Done = 0x00000100,
- Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag
- No_Spline = 0x00000400,
- Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
- Walkmode = 0x00001000,
- Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
- OrientationFixed = 0x00004000, // Model orientation fixed
- Final_Point = 0x00008000,
- Final_Target = 0x00010000,
- Final_Angle = 0x00020000,
- Catmullrom = 0x00040000, // Used Catmullrom interpolation mode
- Cyclic = 0x00080000, // Movement by cycled spline
- Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
- Animation = 0x00200000, // Plays animation after some time passed
- Frozen = 0x00400000, // Will never arrive
- Unknown5 = 0x00800000,
- Unknown6 = 0x01000000,
- Unknown7 = 0x02000000,
- Unknown8 = 0x04000000,
+ None = 0x00000000,
+ // x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
+ Done = 0x00000100,
+ Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag
+ No_Spline = 0x00000400,
+ Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
+ Walkmode = 0x00001000,
+ Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
+ OrientationFixed = 0x00004000, // Model orientation fixed
+ Final_Point = 0x00008000,
+ Final_Target = 0x00010000,
+ Final_Angle = 0x00020000,
+ Catmullrom = 0x00040000, // Used Catmullrom interpolation mode
+ Cyclic = 0x00080000, // Movement by cycled spline
+ Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
+ Animation = 0x00200000, // Plays animation after some time passed
+ Frozen = 0x00400000, // Will never arrive
+ TransportEnter = 0x00800000,
+ TransportExit = 0x01000000,
+ Unknown7 = 0x02000000,
+ Unknown8 = 0x04000000,
OrientationInversed = 0x08000000,
- Unknown10 = 0x10000000,
- Unknown11 = 0x20000000,
- Unknown12 = 0x40000000,
- Unknown13 = 0x80000000,
+ Unknown10 = 0x10000000,
+ Unknown11 = 0x20000000,
+ Unknown12 = 0x40000000,
+ Unknown13 = 0x80000000,
// Masks
- Mask_Final_Facing = Final_Point | Final_Target | Final_Angle,
+ Mask_Final_Facing = Final_Point | Final_Target | Final_Angle,
// animation ids stored here, see AnimType enum, used with Animation flag
- Mask_Animations = 0xFF,
+ Mask_Animations = 0xFF,
// flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
Mask_No_Monster_Move = Mask_Final_Facing | Mask_Animations | Done,
// CatmullRom interpolation mode used
- Mask_CatmullRom = Flying | Catmullrom,
+ Mask_CatmullRom = Flying | Catmullrom,
// Unused, not suported flags
- Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown5|Unknown6|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13,
+ Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13,
};
inline uint32& raw() { return (uint32&)*this;}
@@ -98,14 +98,16 @@ namespace Movement
void operator &= (uint32 f) { raw() &= f;}
void operator |= (uint32 f) { raw() |= f;}
- void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations|Falling|Parabolic)) | Animation|anim;}
- void EnableParabolic() { raw() = (raw() & ~(Mask_Animations|Falling|Animation)) | Parabolic;}
- void EnableFalling() { raw() = (raw() & ~(Mask_Animations|Parabolic|Animation)) | Falling;}
+ void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Parabolic)) | Animation | anim; }
+ void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation)) | Parabolic; }
+ void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Parabolic | Animation)) | Falling; }
void EnableFlying() { raw() = (raw() & ~Catmullrom) | Flying; }
void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; }
- void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
- void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;}
- void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;}
+ void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point; }
+ void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle; }
+ void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target; }
+ void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
+ void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
uint8 animId : 8;
bool done : 1;
@@ -123,8 +125,8 @@ namespace Movement
bool enter_cycle : 1;
bool animation : 1;
bool frozen : 1;
- bool unknown5 : 1;
- bool unknown6 : 1;
+ bool transportEnter: 1;
+ bool transportExit : 1;
bool unknown7 : 1;
bool unknown8 : 1;
bool orientationInversed : 1;
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 924db9ad726..5fca373503e 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -20,6 +20,8 @@
#include "MoveSpline.h"
#include "MovementPacketBuilder.h"
#include "Unit.h"
+#include "Transport.h"
+#include "Vehicle.h"
namespace Movement
{
@@ -58,17 +60,26 @@ namespace Movement
{
MoveSpline& move_spline = *unit.movespline;
- Location real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZMinusOffset(),unit.GetOrientation());
- // there is a big chane that current position is unknown if current state is not finalized, need compute it
+ bool transport = false;
+ Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZMinusOffset(), unit.GetOrientation());
+ // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes
+ if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID())
+ {
+ transport = true;
+ real_position.x = unit.GetTransOffsetX();
+ real_position.y = unit.GetTransOffsetY();
+ real_position.z = unit.GetTransOffsetZ();
+ real_position.orientation = unit.GetTransOffsetO();
+ }
+
+ // there is a big chance that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized())
real_position = move_spline.ComputePosition();
+ // should i do the things that user should do? - no.
if (args.path.empty())
- {
- // should i do the things that user should do?
- MoveTo(real_position);
- }
+ return;
// corrent first vertex
args.path[0] = real_position;
@@ -82,7 +93,7 @@ namespace Movement
moveFlags |= (MOVEMENTFLAG_SPLINE_ENABLED|MOVEMENTFLAG_FORWARD);
- if (args.velocity == 0.f)
+ if (!args.HasVelocity)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate())
@@ -94,8 +105,14 @@ namespace Movement
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);
- WorldPacket data(SMSG_MONSTER_MOVE, 64);
+ WorldPacket data(!transport ? SMSG_MONSTER_MOVE : SMSG_MONSTER_MOVE_TRANSPORT, 64);
data.append(unit.GetPackGUID());
+ if (transport)
+ {
+ data.appendPackGUID(unit.GetTransGUID());
+ data << int8(unit.GetTransSeat());
+ }
+
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data,true);
@@ -104,6 +121,8 @@ namespace Movement
MoveSplineInit::MoveSplineInit(Unit& m) : unit(m)
{
+ // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes
+ args.TransformForTransport = unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID();
// mix existing state into new
args.flags.walkmode = unit.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);
args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY));
@@ -112,13 +131,48 @@ namespace Movement
void MoveSplineInit::SetFacing(const Unit * target)
{
args.flags.EnableFacingTarget();
- //args.facing.target = target->GetObjectGuid().GetRawValue();
- args.facing.target = target->GetUInt64Value(OBJECT_FIELD_GUID);
+ args.facing.target = target->GetGUID();
}
void MoveSplineInit::SetFacing(float angle)
{
+ if (args.TransformForTransport)
+ {
+ if (Unit* vehicle = unit.GetVehicleBase())
+ angle -= vehicle->GetOrientation();
+ else if (Transport* transport = unit.GetTransport())
+ angle -= transport->GetOrientation();
+ }
+
args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi());
args.flags.EnableFacingAngle();
}
+
+ void MoveSplineInit::MoveTo(Vector3 const& dest)
+ {
+ args.path_Idx_offset = 0;
+ args.path.resize(2);
+ TransportPathTransform transform(unit, args.TransformForTransport);
+ args.path[1] = transform(dest);
+ }
+
+ Vector3 TransportPathTransform::operator()(Vector3 input)
+ {
+ if (_transformForTransport)
+ {
+ if (Unit* vehicle = _owner.GetVehicleBase())
+ {
+ input.x -= vehicle->GetPositionX();
+ input.y -= vehicle->GetPositionY();
+ input.z -= vehicle->GetPositionZMinusOffset();
+ }
+ else if (Transport* transport = _owner.GetTransport())
+ {
+ float unused = 0.0f;
+ transport->CalculatePassengerOffset(input.x, input.y, input.z, unused);
+ }
+ }
+
+ return input;
+ }
}
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index 24563f28c4f..4efde66fcd5 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -34,6 +34,19 @@ namespace Movement
FlyToGround = 3, // 463 = FlyToGround
};
+ // Transforms coordinates from global to transport offsets
+ class TransportPathTransform
+ {
+ public:
+ TransportPathTransform(Unit& owner, bool transformForTransport)
+ : _owner(owner), _transformForTransport(transformForTransport) { }
+ Vector3 operator()(Vector3 input);
+
+ private:
+ Unit& _owner;
+ bool _transformForTransport;
+ };
+
/* Initializes and launches spline movement
*/
class MoveSplineInit
@@ -97,6 +110,12 @@ namespace Movement
/* Enables falling mode. Disabled by default
*/
void SetFall();
+ /* Enters transport. Disabled by default
+ */
+ void SetTransportEnter();
+ /* Exits transport. Disabled by default
+ */
+ void SetTransportExit();
/* Inverses unit model orientation. Disabled by default
*/
void SetOrientationInversed();
@@ -113,25 +132,31 @@ namespace Movement
PointsArray& Path() { return args.path; }
+ /* Disables transport coordinate transformations for cases where raw offsets are available
+ */
+ void DisableTransportPathTransformations();
protected:
MoveSplineInitArgs args;
Unit& unit;
};
- inline void MoveSplineInit::SetFly() { args.flags.EnableFlying();}
+ inline void MoveSplineInit::SetFly() { args.flags.EnableFlying(); }
inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;}
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
inline void MoveSplineInit::SetFall() { args.flags.EnableFalling();}
- inline void MoveSplineInit::SetVelocity(float vel){ args.velocity = vel;}
+ inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; }
inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;}
+ inline void MoveSplineInit::SetTransportEnter() { args.flags.EnableTransportEnter(); }
+ inline void MoveSplineInit::SetTransportExit() { args.flags.EnableTransportExit(); }
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;}
inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset)
{
args.path_Idx_offset = path_offset;
- args.path.assign(controls.begin(),controls.end());
+ args.path.resize(controls.size());
+ std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit, args.TransformForTransport));
}
inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
@@ -171,10 +196,14 @@ namespace Movement
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
{
- args.facing.f.x = spot.x;
- args.facing.f.y = spot.y;
- args.facing.f.z = spot.z;
+ TransportPathTransform transform(unit, args.TransformForTransport);
+ Vector3 finalSpot = transform(spot);
+ args.facing.f.x = finalSpot.x;
+ args.facing.f.y = finalSpot.y;
+ args.facing.f.z = finalSpot.z;
args.flags.EnableFacingPoint();
}
+
+ inline void MoveSplineInit::DisableTransportPathTransformations() { args.TransformForTransport = false; }
}
#endif // TRINITYSERVER_MOVESPLINEINIT_H
diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
index 26fbbdd0fcc..de02b35d0a0 100644
--- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h
+++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
@@ -42,7 +42,8 @@ namespace Movement
struct MoveSplineInitArgs
{
MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0),
- velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f)
+ velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f),
+ HasVelocity(false), TransformForTransport(true)
{
path.reserve(path_capacity);
}
@@ -56,6 +57,8 @@ namespace Movement
float time_perc;
uint32 splineId;
float initialOrientation;
+ bool HasVelocity;
+ bool TransformForTransport;
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
bool Validate() const;
diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
index 0260767dbe2..8aef671d2d1 100644
--- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
+++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
@@ -44,24 +44,12 @@ namespace Movement
void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data)
{
MoveSplineFlag splineflags = move_spline.splineflags;
- /*if (unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
- {
- data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
- if (unit->GetVehicle())
- data << unit->GetVehicle()->GetBase()->GetPackGUID();
- else if (unit->GetTransport())
- data << unit->GetTransport()->GetPackGUID();
- else
- data << uint64(0);
-
- data << int8(unit->GetTransSeat());
- }*/
- data << uint8(0);
+ data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40)
data << move_spline.spline.getPoint(move_spline.spline.first());
data << move_spline.GetId();
- switch(splineflags & MoveSplineFlag::Mask_Final_Facing)
+ switch (splineflags & MoveSplineFlag::Mask_Final_Facing)
{
case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget);
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 296c9eee50f..a01e18347f6 100755
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -48,8 +48,8 @@ void WaypointMgr::Load()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
+
return;
}
@@ -86,8 +86,8 @@ void WaypointMgr::Load()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void WaypointMgr::ReloadPath(uint32 id)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 465fca75030..4db35d5bc79 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -123,7 +123,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
{
- sLog->outError("OutdoorPvP: GO %u is not capture point!", entry);
+ sLog->outError(LOG_FILTER_OUTDOORPVP, "OutdoorPvP: GO %u is not capture point!", entry);
return false;
}
@@ -166,8 +166,10 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
//if (Map* map = sMapMgr->FindMap(cr->GetMapId()))
// map->Remove(cr, false);
// delete respawn time for this creature
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_GUID);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
stmt->setUInt32(0, guid);
+ stmt->setUInt16(1, cr->GetMapId());
+ stmt->setUInt32(2, 0); // instance id, always 0 for world maps
CharacterDatabase.Execute(stmt);
cr->AddObjectToRemoveList();
@@ -380,7 +382,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
if (m_OldState != m_State)
{
- //sLog->outError("%u->%u", m_OldState, m_State);
+ //sLog->outError(LOG_FILTER_OUTDOORPVP, "%u->%u", m_OldState, m_State);
if (oldTeam != m_team)
ChangeTeam(oldTeam);
ChangeState();
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index a079d2f643b..ce987e25eed 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -46,8 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
return;
}
@@ -65,7 +64,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
if (typeId >= MAX_OUTDOORPVP_TYPES)
{
- sLog->outErrorDb("Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId);
+ sLog->outError(LOG_FILTER_SQL, "Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId);
continue;
}
@@ -85,20 +84,20 @@ void OutdoorPvPMgr::InitOutdoorPvP()
OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));
if (iter == m_OutdoorPvPDatas.end())
{
- sLog->outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));
+ sLog->outError(LOG_FILTER_SQL, "Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));
continue;
}
pvp = sScriptMgr->CreateOutdoorPvP(iter->second);
if (!pvp)
{
- sLog->outError("Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));
+ sLog->outError(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));
continue;
}
if (!pvp->SetupOutdoorPvP())
{
- sLog->outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));
+ sLog->outError(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));
delete pvp;
continue;
}
@@ -106,8 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
m_OutdoorPvPSet.push_back(pvp);
}
- sLog->outString(">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index d8548b552d3..79e8d47aa94 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -571,8 +571,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
mPoolTemplate.clear();
- sLog->outString(">> Loaded 0 object pools. DB table `pool_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
return;
}
@@ -590,13 +589,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Creatures
- sLog->outString("Loading Creatures Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -605,8 +603,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
}
else
{
@@ -622,17 +619,17 @@ void PoolMgr::LoadFromDB()
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
{
- sLog->outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
- sLog->outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
continue;
}
PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id];
@@ -647,14 +644,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Gameobjects
- sLog->outString("Loading Gameobject Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -663,8 +659,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
}
else
{
@@ -680,7 +675,7 @@ void PoolMgr::LoadFromDB()
GameObjectData const* data = sObjectMgr->GetGOData(guid);
if (!data)
{
- sLog->outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
@@ -689,19 +684,19 @@ void PoolMgr::LoadFromDB()
goinfo->type != GAMEOBJECT_TYPE_GOOBER &&
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE)
{
- sLog->outErrorDb("`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
- sLog->outErrorDb("`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
continue;
}
@@ -717,14 +712,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Pool of pools
- sLog->outString("Loading Mother Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -733,8 +727,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 pools in pools");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools");
}
else
{
@@ -749,22 +742,22 @@ void PoolMgr::LoadFromDB()
if (mother_pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id);
continue;
}
if (child_pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id);
continue;
}
if (mother_pool_id == child_pool_id)
{
- sLog->outErrorDb("`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
- sLog->outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id);
continue;
}
PoolTemplateData* pPoolTemplateMother = &mPoolTemplate[mother_pool_id];
@@ -794,7 +787,7 @@ void PoolMgr::LoadFromDB()
ss << *itr << ' ';
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
<< poolItr->first << " and child pool " << poolItr->second;
- sLog->outErrorDb("%s", ss.str().c_str());
+ sLog->outError(LOG_FILTER_SQL, "%s", ss.str().c_str());
mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first);
mPoolSearchMap.erase(poolItr);
--count;
@@ -803,12 +796,11 @@ void PoolMgr::LoadFromDB()
}
}
- sLog->outString(">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Quest Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -817,8 +809,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 quests in pools");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools");
}
else
{
@@ -844,19 +835,19 @@ void PoolMgr::LoadFromDB()
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
if (!quest)
{
- sLog->outErrorDb("`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (!quest->IsDailyOrWeekly())
{
- sLog->outErrorDb("`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id);
continue;
}
@@ -867,7 +858,7 @@ void PoolMgr::LoadFromDB()
if (poolTypeMap[pool_id] != currType)
{
- sLog->outErrorDb("`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.",
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.",
entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY");
continue;
}
@@ -877,7 +868,7 @@ void PoolMgr::LoadFromDB()
if (creBounds.first == creBounds.second && goBounds.first == goBounds.second)
{
- sLog->outErrorDb("`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id);
continue;
}
@@ -893,13 +884,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
- sLog->outString("Starting objects pooling system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system...");
{
uint32 oldMSTime = getMSTime();
@@ -909,8 +899,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Pool handling system initialized, 0 pools spawned.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned.");
}
else
{
@@ -926,9 +915,9 @@ void PoolMgr::LoadFromDB()
if (pool_pool_id)
// The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned,
// however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing.
- sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32());
+ sLog->outError(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32());
else
- sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry);
+ sLog->outError(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry);
continue;
}
@@ -941,8 +930,8 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outBasic("Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outDebug(LOG_FILTER_POOLSYS, "Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
}
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 94a6590cc4a..05b224fb024 100755
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -45,7 +45,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const
if (!factionEntry)
{
- sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
+ sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
return 0;
}
@@ -68,7 +68,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
if (!factionEntry)
{
- sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
+ sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
return 0;
}
diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h
index 401503783b9..a073845ea73 100755
--- a/src/server/game/Reputation/ReputationMgr.h
+++ b/src/server/game/Reputation/ReputationMgr.h
@@ -132,6 +132,9 @@ class ReputationMgr
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply);
+ //! Public for chat command needs
+ bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
+
public: // senders
void SendInitialReputations();
void SendForceReactions();
@@ -142,7 +145,6 @@ class ReputationMgr
void Initialize();
uint32 GetDefaultStateFlags(FactionEntry const* factionEntry) const;
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
- bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
void SetVisible(FactionState* faction);
void SetAtWar(FactionState* faction, bool atWar) const;
void SetInactive(FactionState* faction, bool inactive) const;
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 5387a3132c6..517ea6cb6bd 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -102,7 +102,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
{
Player* player = NULL;
if (!source && !target)
- sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
{
// Check target first, then source.
@@ -112,7 +112,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
player = source->ToPlayer();
if (!player)
- sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
@@ -124,7 +124,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
{
Creature* creature = NULL;
if (!source && !target)
- sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
{
if (bReverse)
@@ -145,7 +145,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
}
if (!creature)
- sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
@@ -157,15 +157,15 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
{
Unit* unit = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else if (!obj->isType(TYPEMASK_UNIT))
- sLog->outError("%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
else
{
unit = obj->ToUnit();
if (!unit)
- sLog->outError("%s %s object could not be casted to unit.",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object could not be casted to unit.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
}
return unit;
@@ -175,12 +175,12 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf
{
Player* player = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
player = obj->ToPlayer();
if (!player)
- sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return player;
@@ -190,12 +190,12 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip
{
Creature* creature = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
creature = obj->ToCreature();
if (!creature)
- sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return creature;
@@ -205,13 +205,13 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
{
WorldObject* pWorldObject = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
pWorldObject = dynamic_cast<WorldObject*>(obj);
if (!pWorldObject)
- sLog->outError("%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return pWorldObject;
@@ -227,29 +227,29 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
case SCRIPT_COMMAND_OPEN_DOOR: bOpen = true; break;
case SCRIPT_COMMAND_CLOSE_DOOR: break;
default:
- sLog->outError("%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
return;
}
if (!guid)
- sLog->outError("%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
else if (!source)
- sLog->outError("%s source object is NULL.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str());
else if (!source->isType(TYPEMASK_UNIT))
- sLog->outError("%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
+ sLog->outError(LOG_FILTER_TSCR, "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
{
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
if (!wSource)
- sLog->outError("%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
{
GameObject* pDoor = _FindGameObject(wSource, guid);
if (!pDoor)
- sLog->outError("%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
- sLog->outError("%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow());
else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
{
@@ -331,7 +331,7 @@ void Map::ScriptsProcess()
}
break;
default:
- sLog->outError("%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID));
break;
}
@@ -359,7 +359,7 @@ void Map::ScriptsProcess()
target = HashMapHolder<Corpse>::Find(step.targetGUID);
break;
default:
- sLog->outError("%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID));
break;
}
@@ -370,7 +370,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_TALK:
if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
{
- sLog->outError("%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
+ sLog->outError(LOG_FILTER_TSCR, "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
break;
}
if (step.script->Talk.Flags & SF_TALK_USE_PLAYER)
@@ -397,7 +397,7 @@ void Map::ScriptsProcess()
{
uint64 targetGUID = target ? target->GetGUID() : 0;
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
- sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
player->Whisper(text, LANG_UNIVERSAL, targetGUID);
break;
@@ -429,13 +429,13 @@ void Map::ScriptsProcess()
break;
case CHAT_TYPE_WHISPER:
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
- sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
cSource->Whisper(step.script->Talk.TextID, targetGUID);
break;
case CHAT_MSG_RAID_BOSS_WHISPER:
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
- sLog->outError("%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
cSource->MonsterWhisper(step.script->Talk.TextID, targetGUID, true);
break;
@@ -463,7 +463,7 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount())
- sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID,
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
else
@@ -492,7 +492,7 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
- sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
@@ -506,7 +506,7 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
- sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
@@ -533,12 +533,12 @@ void Map::ScriptsProcess()
{
if (!source)
{
- sLog->outError("%s source object is NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source object is NULL.", step.script->GetDebugInfo().c_str());
break;
}
if (!target)
{
- sLog->outError("%s target object is NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str());
break;
}
@@ -549,7 +549,7 @@ void Map::ScriptsProcess()
{
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
{
- sLog->outError("%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
break;
}
@@ -562,7 +562,7 @@ void Map::ScriptsProcess()
{
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
{
- sLog->outError("%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
@@ -570,7 +570,7 @@ void Map::ScriptsProcess()
}
else
{
- sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
@@ -601,7 +601,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
if (!step.script->RespawnGameobject.GOGuid)
{
- sLog->outError("%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str());
break;
}
@@ -611,7 +611,7 @@ void Map::ScriptsProcess()
GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid);
if (!pGO)
{
- sLog->outError("%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid);
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid);
break;
}
@@ -620,7 +620,7 @@ void Map::ScriptsProcess()
pGO->GetGoType() == GAMEOBJECT_TYPE_BUTTON ||
pGO->GetGoType() == GAMEOBJECT_TYPE_TRAP)
{
- sLog->outError("%s can not be used with gameobject of type %u (guid: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s can not be used with gameobject of type %u (guid: %u).",
step.script->GetDebugInfo().c_str(), uint32(pGO->GetGoType()), step.script->RespawnGameobject.GOGuid);
break;
}
@@ -643,7 +643,7 @@ void Map::ScriptsProcess()
if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script))
{
if (!step.script->TempSummonCreature.CreatureEntry)
- sLog->outError("%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str());
else
{
float x = step.script->TempSummonCreature.PosX;
@@ -652,7 +652,7 @@ void Map::ScriptsProcess()
float o = step.script->TempSummonCreature.Orientation;
if (!pSummoner->SummonCreature(step.script->TempSummonCreature.CreatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay))
- sLog->outError("%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry);
+ sLog->outError(LOG_FILTER_TSCR, "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry);
}
}
break;
@@ -670,13 +670,13 @@ void Map::ScriptsProcess()
// Target must be GameObject.
if (!target)
{
- sLog->outError("%s target object is NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str());
break;
}
if (target->GetTypeId() != TYPEID_GAMEOBJECT)
{
- sLog->outError("%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
@@ -700,7 +700,7 @@ void Map::ScriptsProcess()
// TODO: Allow gameobjects to be targets and casters
if (!source && !target)
{
- sLog->outError("%s source and target objects are NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", step.script->GetDebugInfo().c_str());
break;
}
@@ -733,13 +733,13 @@ void Map::ScriptsProcess()
if (!uSource || !uSource->isType(TYPEMASK_UNIT))
{
- sLog->outError("%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
+ sLog->outError(LOG_FILTER_TSCR, "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
break;
}
if (!uTarget || !uTarget->isType(TYPEMASK_UNIT))
{
- sLog->outError("%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
+ sLog->outError(LOG_FILTER_TSCR, "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
break;
}
@@ -799,7 +799,7 @@ void Map::ScriptsProcess()
if (Unit* unit = _GetScriptUnit(source, true, step.script))
{
if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID))
- sLog->outError("%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID);
+ sLog->outError(LOG_FILTER_TSCR, "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID);
else
unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable);
}
@@ -809,12 +809,12 @@ void Map::ScriptsProcess()
{
if (!step.script->CallScript.CreatureEntry)
{
- sLog->outError("%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str());
break;
}
if (!step.script->CallScript.ScriptID)
{
- sLog->outError("%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str());
break;
}
@@ -840,7 +840,7 @@ void Map::ScriptsProcess()
if (!cTarget)
{
- sLog->outError("%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry);
+ sLog->outError(LOG_FILTER_TSCR, "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry);
break;
}
@@ -849,7 +849,7 @@ void Map::ScriptsProcess()
//if no scriptmap present...
if (!datamap)
{
- sLog->outError("%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType);
+ sLog->outError(LOG_FILTER_TSCR, "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType);
break;
}
@@ -863,7 +863,7 @@ void Map::ScriptsProcess()
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
{
if (cSource->isDead())
- sLog->outError("%s creature is already dead (Entry: %u, GUID: %u)",
+ sLog->outError(LOG_FILTER_TSCR, "%s creature is already dead (Entry: %u, GUID: %u)",
step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow());
else
{
@@ -919,7 +919,7 @@ void Map::ScriptsProcess()
break;
default:
- sLog->outError("Unknown script command %s.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Unknown script command %s.", step.script->GetDebugInfo().c_str());
break;
}
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 76c3f1c073c..9d983542fea 100755
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -46,22 +46,34 @@ void AddSC_SmartSCripts();
//Commands
void AddSC_account_commandscript();
void AddSC_achievement_commandscript();
+void AddSC_ban_commandscript();
+void AddSC_bf_commandscript();
+void AddSC_cast_commandscript();
+void AddSC_character_commandscript();
void AddSC_debug_commandscript();
+void AddSC_disable_commandscript();
void AddSC_event_commandscript();
void AddSC_gm_commandscript();
void AddSC_go_commandscript();
void AddSC_gobject_commandscript();
+void AddSC_guild_commandscript();
void AddSC_honor_commandscript();
+void AddSC_instance_commandscript();
void AddSC_learn_commandscript();
+void AddSC_list_commandscript();
+void AddSC_lookup_commandscript();
+void AddSC_message_commandscript();
void AddSC_misc_commandscript();
void AddSC_modify_commandscript();
void AddSC_npc_commandscript();
void AddSC_quest_commandscript();
void AddSC_reload_commandscript();
+void AddSC_reset_commandscript();
+void AddSC_server_commandscript();
void AddSC_tele_commandscript();
+void AddSC_ticket_commandscript();
void AddSC_titles_commandscript();
void AddSC_wp_commandscript();
-void AddSC_gps_commandscript();
#ifdef SCRIPTS
//world
@@ -425,6 +437,7 @@ void AddSC_ulduar_teleporter();
void AddSC_boss_mimiron();
void AddSC_boss_hodir();
void AddSC_boss_freya();
+void AddSC_boss_algalon_the_observer();
void AddSC_instance_ulduar();
void AddSC_boss_keleseth(); //Utgarde Keep
void AddSC_boss_skarvald_dalronn();
@@ -496,6 +509,7 @@ void AddSC_howling_fjord();
void AddSC_icecrown();
void AddSC_sholazar_basin();
void AddSC_storm_peaks();
+void AddSC_wintergrasp();
void AddSC_zuldrak();
void AddSC_crystalsong_forest();
void AddSC_isle_of_conquest();
@@ -648,22 +662,34 @@ void AddCommandScripts()
{
AddSC_account_commandscript();
AddSC_achievement_commandscript();
+ AddSC_ban_commandscript();
+ AddSC_bf_commandscript();
+ AddSC_cast_commandscript();
+ AddSC_character_commandscript();
AddSC_debug_commandscript();
+ AddSC_disable_commandscript();
AddSC_event_commandscript();
AddSC_gm_commandscript();
AddSC_go_commandscript();
AddSC_gobject_commandscript();
+ AddSC_guild_commandscript();
AddSC_honor_commandscript();
+ AddSC_instance_commandscript();
AddSC_learn_commandscript();
+ AddSC_lookup_commandscript();
+ AddSC_list_commandscript();
+ AddSC_message_commandscript();
AddSC_misc_commandscript();
AddSC_modify_commandscript();
AddSC_npc_commandscript();
AddSC_quest_commandscript();
AddSC_reload_commandscript();
+ AddSC_reset_commandscript();
+ AddSC_server_commandscript();
AddSC_tele_commandscript();
+ AddSC_ticket_commandscript();
AddSC_titles_commandscript();
AddSC_wp_commandscript();
- AddSC_gps_commandscript();
}
void AddWorldScripts()
@@ -1129,6 +1155,7 @@ void AddNorthrendScripts()
AddSC_boss_mimiron();
AddSC_boss_hodir();
AddSC_boss_freya();
+ AddSC_boss_algalon_the_observer();
AddSC_instance_ulduar();
AddSC_boss_keleseth(); //Utgarde Keep
AddSC_boss_skarvald_dalronn();
@@ -1200,6 +1227,7 @@ void AddNorthrendScripts()
AddSC_icecrown();
AddSC_sholazar_basin();
AddSC_storm_peaks();
+ AddSC_wintergrasp();
AddSC_zuldrak();
AddSC_crystalsong_forest();
AddSC_isle_of_conquest();
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index aac615180c8..47ce6c17b28 100755
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
#include "ScriptMgr.h"
#include "Config.h"
#include "DatabaseEnv.h"
@@ -27,6 +26,10 @@
#include "ScriptSystem.h"
#include "Transport.h"
#include "Vehicle.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "GossipDef.h"
+#include "CreatureAI.h"
// This is the global static registry of scripts.
template<class TScript>
@@ -51,7 +54,7 @@ class ScriptRegistry
{
if (it->second == script)
{
- sLog->outError("Script '%s' has same memory pointer as '%s'.",
+ sLog->outError(LOG_FILTER_TSCR, "Script '%s' has same memory pointer as '%s'.",
script->GetName().c_str(), it->second->GetName().c_str());
return;
@@ -87,7 +90,7 @@ class ScriptRegistry
else
{
// If the script is already assigned -> delete it!
- sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.",
+ sLog->outError(LOG_FILTER_TSCR, "Script '%s' already assigned with the same script name, so the script can't work.",
script->GetName().c_str());
ASSERT(false); // Error that should be fixed ASAP.
@@ -97,7 +100,7 @@ class ScriptRegistry
{
// The script uses a script name from database, but isn't assigned to anything.
if (script->GetName().find("example") == std::string::npos && script->GetName().find("Smart") == std::string::npos)
- sLog->outErrorDb("Script named '%s' does not have a script name assigned in database.",
+ sLog->outError(LOG_FILTER_SQL, "Script named '%s' does not have a script name assigned in database.",
script->GetName().c_str());
}
}
@@ -159,13 +162,13 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
{
if (!pSource)
{
- sLog->outError("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry);
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i, invalid Source pointer.", iTextEntry);
return;
}
if (iTextEntry >= 0)
{
- sLog->outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
return;
}
@@ -173,18 +176,18 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
if (!pData)
{
- sLog->outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
return;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
+ sLog->outDebug(LOG_FILTER_TSCR, "DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
if (pData->uiSoundId)
{
if (sSoundEntriesStore.LookupEntry(pData->uiSoundId))
pSource->SendPlaySound(pData->uiSoundId, false);
else
- sLog->outError("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
}
if (pData->uiEmote)
@@ -192,7 +195,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote);
else
- sLog->outError("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId());
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId());
}
switch (pData->uiType)
@@ -214,7 +217,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
if (target && target->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(iTextEntry, target->GetGUID());
else
- sLog->outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
break;
}
@@ -223,7 +226,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
if (target && target->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(iTextEntry, target->GetGUID(), true);
else
- sLog->outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
+ sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
break;
}
@@ -248,13 +251,12 @@ void ScriptMgr::Initialize()
LoadDatabase();
- sLog->outString("Loading C++ scripts");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts");
FillSpellSummary();
AddScripts();
- sLog->outString(">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
}
void ScriptMgr::Unload()
@@ -851,6 +853,14 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
return tmpscript->GetAI(creature);
}
+GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject)
+{
+ ASSERT(gameobject);
+
+ GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, NULL);
+ return tmpscript->GetAI(gameobject);
+}
+
void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
{
ASSERT(creature);
@@ -937,6 +947,22 @@ void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player)
tmpscript->OnDamaged(go, player);
}
+void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit)
+{
+ ASSERT(go);
+
+ GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
+ tmpscript->OnLootStateChanged(go, state, unit);
+}
+
+void ScriptMgr::OnGameObjectStateChanged(GameObject* go, uint32 state)
+{
+ ASSERT(go);
+
+ GET_SCRIPT(GameObjectScript, go->GetScriptId(), tmpscript);
+ tmpscript->OnGameObjectStateChanged(go, state);
+}
+
void ScriptMgr::OnGameObjectUpdate(GameObject* go, uint32 diff)
{
ASSERT(go);
@@ -1416,7 +1442,7 @@ WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<Map>(mapId)
{
if (GetEntry() && !GetEntry()->IsWorldMap())
- sLog->outError("WorldMapScript for map %u is invalid.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "WorldMapScript for map %u is invalid.", mapId);
ScriptRegistry<WorldMapScript>::AddScript(this);
}
@@ -1425,7 +1451,7 @@ InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<InstanceMap>(mapId)
{
if (GetEntry() && !GetEntry()->IsDungeon())
- sLog->outError("InstanceMapScript for map %u is invalid.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "InstanceMapScript for map %u is invalid.", mapId);
ScriptRegistry<InstanceMapScript>::AddScript(this);
}
@@ -1434,7 +1460,7 @@ BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<BattlegroundMap>(mapId)
{
if (GetEntry() && !GetEntry()->IsBattleground())
- sLog->outError("BattlegroundMapScript for map %u is invalid.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "BattlegroundMapScript for map %u is invalid.", mapId);
ScriptRegistry<BattlegroundMapScript>::AddScript(this);
}
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 3b65a5cf256..270182509f9 100755
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -39,6 +39,7 @@ class Creature;
class CreatureAI;
class DynamicObject;
class GameObject;
+class GameObjectAI;
class Guild;
class GridMap;
class Group;
@@ -163,7 +164,7 @@ class ScriptObject
protected:
ScriptObject(const char* name)
- : _name(std::string(name))
+ : _name(name)
{
}
@@ -313,7 +314,7 @@ template<class TMap> class MapScript : public UpdatableScript<TMap>
: _mapEntry(sMapStore.LookupEntry(mapId))
{
if (!_mapEntry)
- sLog->outError("Invalid MapScript for %u; no such map ID.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "Invalid MapScript for %u; no such map ID.", mapId);
}
public:
@@ -471,6 +472,15 @@ class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject>
// Called when the game object is damaged (destructible buildings only).
virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { }
+
+ // Called when the game object loot state is changed.
+ virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
+
+ // Called when the game object state is changed.
+ virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { }
+
+ // Called when a GameObjectAI object is needed for the gameobject.
+ virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return NULL; }
};
class AreaTriggerScript : public ScriptObject
@@ -910,7 +920,10 @@ class ScriptMgr
uint32 GetDialogStatus(Player* player, GameObject* go);
void OnGameObjectDestroyed(GameObject* go, Player* player);
void OnGameObjectDamaged(GameObject* go, Player* player);
+ void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit);
+ void OnGameObjectStateChanged(GameObject* go, uint32 state);
void OnGameObjectUpdate(GameObject* go, uint32 diff);
+ GameObjectAI* GetGameObjectAI(GameObject* go);
public: /* AreaTriggerScript */
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index c38d559372f..41b41b91808 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -16,28 +16,27 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
#include "ScriptSystem.h"
#include "ObjectMgr.h"
#include "DatabaseEnv.h"
+#include "ScriptMgr.h"
ScriptPointVector const SystemMgr::_empty;
void SystemMgr::LoadScriptTexts()
{
- sLog->outString("TSCR: Loading Script Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts...");
LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2));
- sLog->outString("TSCR: Loading Script Texts additional data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data...");
uint32 oldMSTime = getMSTime();
-
+
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");
if (!result)
{
- sLog->outString(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
return;
}
@@ -56,50 +55,48 @@ void SystemMgr::LoadScriptTexts()
if (iId >= 0)
{
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
continue;
}
if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2)
{
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
continue;
}
if (temp.uiSoundId)
{
if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
}
if (!GetLanguageDescByID(temp.uiLanguage))
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
if (temp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
m_mTextDataMap[iId] = temp;
++uiCount;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
}
void SystemMgr::LoadScriptTextsCustom()
{
- sLog->outString("TSCR: Loading Custom Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts...");
LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3));
- sLog->outString("TSCR: Loading Custom Texts additional data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data...");
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
if (!result)
{
- sLog->outString(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
return;
}
@@ -118,35 +115,34 @@ void SystemMgr::LoadScriptTextsCustom()
if (iId >= 0)
{
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
continue;
}
if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)
{
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
continue;
}
if (temp.uiSoundId)
{
if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
}
if (!GetLanguageDescByID(temp.uiLanguage))
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
if (temp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
m_mTextDataMap[iId] = temp;
++uiCount;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount);
}
void SystemMgr::LoadScriptWaypoints()
@@ -163,15 +159,14 @@ void SystemMgr::LoadScriptWaypoints()
if (result)
uiCreatureCount = result->GetRowCount();
- sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
if (!result)
{
- sLog->outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
return;
}
@@ -194,18 +189,17 @@ void SystemMgr::LoadScriptWaypoints()
if (!pCInfo)
{
- sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
continue;
}
if (!pCInfo->ScriptID)
- sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
m_mPointMoveMap[uiEntry].push_back(temp);
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index cf6332b22f2..4211a63b043 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -5,6 +5,7 @@
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
+#include "ScriptMgr.h"
#include <ace/Singleton.h>
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index c6ccfaa8004..a229d3ed536 100755
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -76,7 +76,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x02F*/ { "SMSG_DEBUG_AISTATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x030*/ { "CMSG_DISABLE_PVP_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x031*/ { "CMSG_ADVANCE_SPAWN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- /*0x032*/ { "SMSG_DESTRUCTIBLE_BUILDING_DAMAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x032*/ { "SMSG_DESTRUCTIBLE_BUILDING_DAMAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x033*/ { "CMSG_AUTH_SRP6_BEGIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x034*/ { "CMSG_AUTH_SRP6_PROOF", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x035*/ { "CMSG_AUTH_SRP6_RECODE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
@@ -104,7 +104,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x04B*/ { "CMSG_LOGOUT_REQUEST", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutRequestOpcode },
/*0x04C*/ { "SMSG_LOGOUT_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x04D*/ { "SMSG_LOGOUT_COMPLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x04E*/ { "CMSG_LOGOUT_CANCEL", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutCancelOpcode },
+ /*0x04E*/ { "CMSG_LOGOUT_CANCEL", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleLogoutCancelOpcode },
/*0x04F*/ { "SMSG_LOGOUT_CANCEL_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x050*/ { "CMSG_NAME_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleNameQueryOpcode },
/*0x051*/ { "SMSG_NAME_QUERY_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
@@ -270,8 +270,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x0F1*/ { "MSG_MOVE_KNOCK_BACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x0F2*/ { "SMSG_MOVE_FEATHER_FALL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x0F3*/ { "SMSG_MOVE_NORMAL_FALL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x0F4*/ { "SMSG_MOVE_SET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- /*0x0F5*/ { "SMSG_MOVE_UNSET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x0F4*/ { "SMSG_MOVE_SET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
+ /*0x0F5*/ { "SMSG_MOVE_UNSET_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x0F6*/ { "CMSG_MOVE_HOVER_ACK", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveHoverAck },
/*0x0F7*/ { "MSG_MOVE_HOVER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x0F8*/ { "CMSG_TRIGGER_CINEMATIC_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
@@ -310,7 +310,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x119*/ { "CMSG_IGNORE_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleIgnoreTradeOpcode },
/*0x11A*/ { "CMSG_ACCEPT_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptTradeOpcode },
/*0x11B*/ { "CMSG_UNACCEPT_TRADE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUnacceptTradeOpcode },
- /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelTradeOpcode},
+ /*0x11C*/ { "CMSG_CANCEL_TRADE", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelTradeOpcode },
/*0x11D*/ { "CMSG_SET_TRADE_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTradeItemOpcode },
/*0x11E*/ { "CMSG_CLEAR_TRADE_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleClearTradeItemOpcode },
/*0x11F*/ { "CMSG_SET_TRADE_GOLD", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTradeGoldOpcode },
@@ -558,7 +558,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x211*/ { "CMSG_GMTICKET_GETTICKET", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketGetTicketOpcode },
/*0x212*/ { "SMSG_GMTICKET_GETTICKET", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x213*/ { "CMSG_UNLEARN_TALENTS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
- /*0x214*/ { "SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
+ /*0x214*/ { "SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x215*/ { "SMSG_GAMEOBJECT_DESPAWN_ANIM", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x216*/ { "MSG_CORPSE_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCorpseQueryOpcode },
/*0x217*/ { "CMSG_GMTICKET_DELETETICKET", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGMTicketDeleteOpcode },
@@ -970,7 +970,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x3AD*/ { "MSG_MOVE_UPDATE_CAN_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x3AE*/ { "MSG_RAID_READY_CHECK_CONFIRM", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x3AF*/ { "CMSG_VOICE_SESSION_ENABLE", STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleVoiceSessionEnableOpcode },
- /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x3B1*/ { "SMSG_VOICE_PARENTAL_CONTROLS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x3B2*/ { "CMSG_GM_WHISPER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x3B3*/ { "SMSG_GM_MESSAGECHAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
@@ -1023,7 +1023,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReportPvPAFK },
- /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildBankerActivate },
/*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildBankQueryTab },
/*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
@@ -1148,7 +1148,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x45F*/ { "CMSG_CALENDAR_EVENT_INVITE_NOTES", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x460*/ { "SMSG_CALENDAR_EVENT_INVITE_NOTES", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x461*/ { "SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x462*/ { "CMSG_UPDATE_MISSILE_TRAJECTORY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x462*/ { "CMSG_UPDATE_MISSILE_TRAJECTORY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleUpdateMissileTrajectory },
/*0x463*/ { "SMSG_UPDATE_ACCOUNT_DATA_COMPLETE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x464*/ { "SMSG_TRIGGER_MOVIE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x465*/ { "CMSG_COMPLETE_MOVIE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
@@ -1273,15 +1273,15 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x4DC*/ { "SMSG_PVP_QUEUE_STATS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4DD*/ { "CMSG_SET_PAID_SERVICE_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4DE*/ { "SMSG_BATTLEFIELD_MGR_ENTRY_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfEntryInviteResponse },
/*0x4E0*/ { "SMSG_BATTLEFIELD_MGR_ENTERED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E1*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse },
/*0x4E3*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E4*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E5*/ { "SMSG_BATTLEFIELD_MGR_EJECT_PENDING", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E6*/ { "SMSG_BATTLEFIELD_MGR_EJECTED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest },
/*0x4E8*/ { "SMSG_BATTLEFIELD_MGR_STATE_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E9*/ { "CMSG_BATTLEFIELD_MANAGER_ADVANCE_STATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EA*/ { "CMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index 3c77ced6741..d5b9dff4a89 100755
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -1248,8 +1248,8 @@ enum Opcodes
SMSG_CALENDAR_CLEAR_PENDING_ACTION = 0x4BB,
SMSG_EQUIPMENT_SET_LIST = 0x4BC, // equipment manager list?
CMSG_EQUIPMENT_SET_SAVE = 0x4BD,
- CMSG_UPDATE_PROJECTILE_POSITION = 0x4BE, // uint64 caster, uint32 spellId, uint8 castId, vector3 position
- SMSG_SET_PROJECTILE_POSITION = 0x4BF, // uint64 caster, uint8 castId, vector3 position
+ CMSG_UPDATE_PROJECTILE_POSITION = 0x4BE,
+ SMSG_SET_PROJECTILE_POSITION = 0x4BF,
SMSG_TALENTS_INFO = 0x4C0,
CMSG_LEARN_PREVIEW_TALENTS = 0x4C1,
CMSG_LEARN_PREVIEW_TALENTS_PET = 0x4C2,
@@ -1354,7 +1354,7 @@ enum SessionStatus
STATUS_AUTHED = 0, // Player authenticated (_player == NULL, m_playerRecentlyLogout = false or will be reset before handler call, m_GUID have garbage)
STATUS_LOGGEDIN, // Player in game (_player != NULL, m_GUID == _player->GetGUID(), inWorld())
STATUS_TRANSFER, // Player transferring to another map (_player != NULL, m_GUID == _player->GetGUID(), !inWorld())
- STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player!= NULL or _player == NULL && m_playerRecentlyLogout, m_GUID store last _player guid)
+ STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player != NULL or _player == NULL && m_playerRecentlyLogout && m_playerLogout, m_GUID store last _player guid)
STATUS_NEVER, // Opcode not accepted from client (deprecated or server side only)
STATUS_UNHANDLED, // Opcode not handled yet
};
@@ -1385,5 +1385,13 @@ inline const char* LookupOpcodeName(uint16 id)
return "Received unknown opcode, it's more than max!";
return opcodeTable[id].name;
}
+
+inline std::string GetOpcodeNameForLogging(uint16 opcode)
+{
+ std::ostringstream ss;
+ ss << '[' << LookupOpcodeName(opcode) << " 0x" << std::hex << std::uppercase << opcode << std::nouppercase << " (" << std::dec << opcode << ")]";
+ return ss.str().c_str();
+}
+
#endif
/// @}
diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp
new file mode 100644
index 00000000000..cb6dcdbdb9e
--- /dev/null
+++ b/src/server/game/Server/Protocol/PacketLog.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008-2012 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 "PacketLog.h"
+#include "Config.h"
+#include "ByteBuffer.h"
+#include "WorldPacket.h"
+
+PacketLog::PacketLog() : _file(NULL)
+{
+ Initialize();
+}
+
+PacketLog::~PacketLog()
+{
+ if (_file)
+ fclose(_file);
+
+ _file = NULL;
+}
+
+void PacketLog::Initialize()
+{
+ std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
+
+ if (!logsDir.empty())
+ if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\'))
+ logsDir.push_back('/');
+
+ std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", "");
+ if (!logname.empty())
+ _file = fopen((logsDir + logname).c_str(), "wb");
+}
+
+void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)
+{
+ ByteBuffer data(4+4+4+1+packet.size());
+ data << int32(packet.GetOpcode());
+ data << int32(packet.size());
+ data << uint32(time(NULL));
+ data << uint8(direction);
+
+ for (uint32 i = 0; i < packet.size(); i++)
+ data << const_cast<WorldPacket&>(packet)[i];
+
+ fwrite(data.contents(), 1, data.size(), _file);
+ fflush(_file);
+}
diff --git a/src/server/game/Server/Protocol/WorldLog.h b/src/server/game/Server/Protocol/PacketLog.h
index fb344f195de..b899daae198 100755..100644
--- a/src/server/game/Server/Protocol/WorldLog.h
+++ b/src/server/game/Server/Protocol/PacketLog.h
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,46 +15,36 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/// \addtogroup u2w
-/// @{
-/// \file
-
-#ifndef TRINITY_WORLDLOG_H
-#define TRINITY_WORLDLOG_H
+#ifndef TRINITY_PACKETLOG_H
+#define TRINITY_PACKETLOG_H
#include "Common.h"
#include <ace/Singleton.h>
-#include "Errors.h"
-#include <stdarg.h>
+enum Direction
+{
+ CLIENT_TO_SERVER,
+ SERVER_TO_CLIENT
+};
+
+class WorldPacket;
-/// %Log packets to a file
-class WorldLog
+class PacketLog
{
- friend class ACE_Singleton<WorldLog, ACE_Thread_Mutex>;
+ friend class ACE_Singleton<PacketLog, ACE_Thread_Mutex>;
private:
- WorldLog();
- ~WorldLog();
- WorldLog(const WorldLog &);
- WorldLog& operator=(const WorldLog &);
- ACE_Thread_Mutex Lock;
+ PacketLog();
+ ~PacketLog();
public:
void Initialize();
- /// Is the world logger active?
- bool LogWorld(void) const { return (i_file != NULL); }
- /// %Log to the file
- void outLog(char const* fmt, ...);
- void outTimestampLog(char const* fmt, ...);
+ bool CanLogPacket() const { return (_file != NULL); }
+ void LogPacket(WorldPacket const& packet, Direction direction);
private:
- FILE* i_file;
-
- bool m_dbWorld;
+ FILE* _file;
};
-#define sWorldLog ACE_Singleton<WorldLog, ACE_Thread_Mutex>::instance()
+#define sPacketLog ACE_Singleton<PacketLog, ACE_Thread_Mutex>::instance()
#endif
-/// @}
-
diff --git a/src/server/game/Server/Protocol/WorldLog.cpp b/src/server/game/Server/Protocol/WorldLog.cpp
deleted file mode 100755
index 38b13dff095..00000000000
--- a/src/server/game/Server/Protocol/WorldLog.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- \ingroup u2w
-*/
-
-#include "WorldLog.h"
-#include "Config.h"
-#include "Log.h"
-#include "DatabaseWorkerPool.h"
-
-WorldLog::WorldLog() : i_file(NULL)
-{
- Initialize();
-}
-
-WorldLog::~WorldLog()
-{
- if (i_file != NULL)
- fclose(i_file);
-
- i_file = NULL;
-}
-
-/// Open the log file (if specified so in the configuration file)
-void WorldLog::Initialize()
-{
- std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
-
- if (!logsDir.empty())
- {
- if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\'))
- logsDir.push_back('/');
- }
-
- std::string logname = ConfigMgr::GetStringDefault("WorldLogFile", "");
- if (!logname.empty())
- {
- i_file = fopen((logsDir+logname).c_str(), "w");
- }
-
- m_dbWorld = ConfigMgr::GetBoolDefault("LogDB.World", false); // can be VERY heavy if enabled
-}
-
-void WorldLog::outTimestampLog(char const* fmt, ...)
-{
- if (LogWorld())
- {
- TRINITY_GUARD(ACE_Thread_Mutex, Lock);
- ASSERT(i_file);
-
- Log::outTimestamp(i_file);
- va_list args;
- va_start(args, fmt);
- vfprintf(i_file, fmt, args);
- //fprintf(i_file, "\n");
- va_end(args);
-
- fflush(i_file);
- }
-
- if (sLog->GetLogDB() && m_dbWorld)
- {
- va_list ap2;
- va_start(ap2, fmt);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, fmt, ap2);
- sLog->outDB(LOG_TYPE_WORLD, nnew_str);
- va_end(ap2);
- }
-}
-
-void WorldLog::outLog(char const* fmt, ...)
-{
- if (LogWorld())
- {
- TRINITY_GUARD(ACE_Thread_Mutex, Lock);
- ASSERT(i_file);
-
- va_list args;
- va_start(args, fmt);
- vfprintf(i_file, fmt, args);
- //fprintf(i_file, "\n");
- va_end(args);
-
- fflush(i_file);
- }
-
- if (sLog->GetLogDB() && m_dbWorld)
- {
- va_list ap2;
- va_start(ap2, fmt);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, fmt, ap2);
- sLog->outDB(LOG_TYPE_WORLD, nnew_str);
- va_end(ap2);
- }
-}
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 88248b7bc55..6a2c7e64446 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -137,16 +137,29 @@ WorldSession::~WorldSession()
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
}
-void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
-{
- sLog->outError("Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped",
- GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size);
-}
-
/// Get the player name
-char const* WorldSession::GetPlayerName() const
-{
- return GetPlayer() ? GetPlayer()->GetName() : "<none>";
+std::string WorldSession::GetPlayerName(bool simple /* = true */) const
+ {
+ std::string name = "[Player: ";
+ uint32 guidLow = 0;
+
+ if (Player* player = GetPlayer())
+ {
+ name.append(player->GetName());
+ guidLow = player->GetGUIDLow();
+ }
+ else
+ name.append("<none>");
+
+ if (!simple)
+ {
+ std::ostringstream ss;
+ ss << " (Guid: " << guidLow << ", Account: " << GetAccountId() << ")";
+ name.append(ss.str());
+ }
+
+ name.append("]");
+ return name;
}
/// Get player guid if available. Use for logging purposes only
@@ -186,8 +199,8 @@ void WorldSession::SendPacket(WorldPacket const* packet)
{
uint64 minTime = uint64(cur_time - lastTime);
uint64 fullTime = uint64(lastTime - firstTime);
- sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
- sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
+ sLog->outInfo(LOG_FILTER_GENERAL, "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
lastTime = cur_time;
sendLastPacketCount = 1;
@@ -208,16 +221,15 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
/// Logging helper for unexpected opcodes
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason)
{
- sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, reason);
+ sLog->outError(LOG_FILTER_OPCODES, "Received unexpected opcode %s Status: %s Reason: %s from %s",
+ GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerName(false).c_str());
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnprocessedTail(WorldPacket* packet)
{
- sLog->outError("SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), uint32(packet->rpos()), uint32(packet->wpos()));
+ sLog->outError(LOG_FILTER_OPCODES, "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
+ uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerName(false).c_str());
packet->print_storage();
}
@@ -250,7 +262,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
if (packet->GetOpcode() >= NUM_MSG_TYPES)
{
- sLog->outError("SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerName(false).c_str());
sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet));
}
else
@@ -275,22 +288,21 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
deletePacket = false;
QueuePacket(packet);
//! Log
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s (0x%.4X) with with status STATUS_LOGGEDIN. "
- "Player is currently not in world yet.", opHandle.name, packet->GetOpcode());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. "
+ "Player is currently not in world yet.", GetOpcodeNameForLogging(packet->GetOpcode()).c_str());
}
-
}
else if (_player->IsInWorld())
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
+ if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
break;
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT:
- if (!_player && !m_playerRecentlyLogout)
+ if (!_player && !m_playerRecentlyLogout && !m_playerLogout) // There's a short delay between _player = null and m_playerRecentlyLogout = true during logout
LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT",
"the player has not logged in yet and not recently logout");
else
@@ -298,7 +310,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
// not expected _player or must checked in packet handler
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
+ if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
@@ -311,7 +323,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
+ if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
@@ -323,37 +335,31 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
break;
}
- // single from authed time opcodes send in to after logout time
- // and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
- if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
+ // some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes
+ // however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process.
+ if (packet->GetOpcode() == CMSG_CHAR_ENUM)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
+ if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
- sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerName(false).c_str());
break;
case STATUS_UNHANDLED:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerName(false).c_str());
break;
}
}
catch(ByteBufferException &)
{
- sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
- if (sLog->IsOutDebug())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
- packet->hexlike();
- }
+ packet->hexlike();
}
}
@@ -404,7 +410,7 @@ void WorldSession::LogoutPlayer(bool Save)
if (_player)
{
- if (uint64 lguid = GetPlayer()->GetLootGUID())
+ if (uint64 lguid = _player->GetLootGUID())
DoLootRelease(lguid);
///- If the player just died before logging out, make him appear as a ghost
@@ -518,44 +524,41 @@ void WorldSession::LogoutPlayer(bool Save)
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
_player->RemoveFromGroup();
- ///- Send update to group and reset stored max enchanting level
+ //! Send update to group and reset stored max enchanting level
if (_player->GetGroup())
{
_player->GetGroup()->SendUpdate();
_player->GetGroup()->ResetMaxEnchantingLevel();
}
- ///- Broadcast a logout message to the player's friends
+ //! Broadcast a logout message to the player's friends
sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow());
- // Call script hook before deletion
- sScriptMgr->OnPlayerLogout(GetPlayer());
+ //! Call script hook before deletion
+ sScriptMgr->OnPlayerLogout(_player);
- ///- Remove the player from the world
+ //! Remove the player from the world
// the player may not be in the world when logging out
// e.g if he got disconnected during a transfer to another map
// calls to GetMap in this case may cause crashes
_player->CleanupsBeforeDelete();
- sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
if (Map* _map = _player->FindMap())
_map->RemovePlayerFromMap(_player, true);
- SetPlayer(NULL); // deleted in Remove call
- ///- Send the 'logout complete' packet to the client
+ SetPlayer(NULL); //! Pointer already deleted during RemovePlayerFromMap
+
+ //! Send the 'logout complete' packet to the client
+ //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle
WorldPacket data(SMSG_LOGOUT_COMPLETE, 0);
SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
- ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
- //No SQL injection as AccountId is uint32
-
+ //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE);
-
stmt->setUInt32(0, GetAccountId());
-
CharacterDatabase.Execute(stmt);
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
}
m_playerLogout = false;
@@ -613,22 +616,26 @@ const char *WorldSession::GetTrinityString(int32 entry) const
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received opcode %s that must be processed in WorldSocket::OnRead from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::SendAuthWaitQue(uint32 position)
@@ -671,13 +678,15 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
uint32 type = fields[0].GetUInt8();
if (type >= NUM_ACCOUNT_DATA_TYPES)
{
- sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
+ sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have invalid account data type (%u), ignore.",
+ mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
continue;
}
if ((mask & (1 << type)) == 0)
{
- sLog->outError("Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
+ sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have non appropriate for table account data type (%u), ignore.",
+ mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
continue;
}
@@ -931,7 +940,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
if (size > 0xFFFFF)
{
- sLog->outError("WorldSession::ReadAddonsInfo addon info too big, size %u", size);
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
return;
}
@@ -961,7 +970,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
addonInfo >> enabled >> crc >> unk1;
- sLog->outDetail("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
AddonInfo addon(addonName, enabled, crc, 2, true);
@@ -974,15 +983,15 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
match = false;
if (!match)
- sLog->outDetail("ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
else
- sLog->outDetail("ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
}
else
{
AddonMgr::SaveAddon(addon);
- sLog->outDetail("ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
}
// TODO: Find out when to not use CRC/pubkey, and other possible states.
@@ -997,7 +1006,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!");
}
else
- sLog->outError("Addon packet uncompress error!");
+ sLog->outError(LOG_FILTER_GENERAL, "Addon packet uncompress error!");
}
void WorldSession::SendAddonsInfo()
@@ -1036,7 +1045,7 @@ void WorldSession::SendAddonsInfo()
data << uint8(usepk);
if (usepk) // if CRC is wrong, add public key (client need it)
{
- sLog->outDetail("ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey",
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey",
itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC);
data.append(addonPublicKey, sizeof(addonPublicKey));
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 0fce0a372ff..0aa14eb78a8 100755
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -125,6 +125,16 @@ enum PartyResult
ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
};
+
+enum BFLeaveReason
+{
+ BF_LEAVE_REASON_CLOSE = 0x00000001,
+ //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
+ //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
+ BF_LEAVE_REASON_EXITED = 0x00000008,
+ BF_LEAVE_REASON_LOW_LEVEL = 0x00000010,
+};
+
enum ChatRestrictionType
{
ERR_CHAT_RESTRICTED = 0,
@@ -221,8 +231,7 @@ class WorldSession
bool PlayerLoading() const { return m_playerLoading; }
bool PlayerLogout() const { return m_playerLogout; }
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
-
- void SizeError(WorldPacket const& packet, uint32 size) const;
+ bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; }
void ReadAddonsInfo(WorldPacket& data);
void SendAddonsInfo();
@@ -245,7 +254,7 @@ class WorldSession
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; }
- char const* GetPlayerName() const;
+ std::string GetPlayerName(bool simple = true) const;
uint32 GetGuidLow() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
@@ -322,7 +331,7 @@ class WorldSession
void LoadTutorialsData();
void SendTutorialsData();
void SaveTutorialsData(SQLTransaction& trans);
- uint32 GetTutorialInt(uint8 index) { return m_Tutorials[index]; }
+ uint32 GetTutorialInt(uint8 index) const { return m_Tutorials[index]; }
void SetTutorialInt(uint8 index, uint32 value)
{
if (m_Tutorials[index] != value)
@@ -389,13 +398,13 @@ class WorldSession
}
// Recruit-A-Friend Handling
- uint32 GetRecruiterId() { return recruiterId; }
- bool IsARecruiter() { return isRecruiter; }
+ uint32 GetRecruiterId() const { return recruiterId; }
+ bool IsARecruiter() const { return isRecruiter; }
public: // opcodes handlers
void Handle_NULL(WorldPacket& recvPacket); // not used
- void Handle_EarlyProccess(WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead
+ void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead
void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client
void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client
@@ -786,6 +795,16 @@ class WorldSession
void HandleHearthAndResurrect(WorldPacket& recv_data);
void HandleInstanceLockResponse(WorldPacket& recvPacket);
+ // Battlefield
+ void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
+ void SendBfInvitePlayerToQueue(uint32 BattleId);
+ void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
+ void SendBfEntered(uint32 BattleId);
+ void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
+ void HandleBfQueueInviteResponse(WorldPacket &recv_data);
+ void HandleBfEntryInviteResponse(WorldPacket &recv_data);
+ void HandleBfExitRequest(WorldPacket &recv_data);
+
// Looking for Dungeon/Raid
void HandleLfgSetCommentOpcode(WorldPacket& recv_data);
void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recv_data);
@@ -912,6 +931,7 @@ class WorldSession
void HandleEjectPassenger(WorldPacket& data);
void HandleEnterPlayerVehicle(WorldPacket& data);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);
+ void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
private:
void InitializeQueryCallbackParameters();
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 64137dfe7c7..92455f8edfe 100755
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -42,7 +42,7 @@
#include "WorldSession.h"
#include "WorldSocketMgr.h"
#include "Log.h"
-#include "WorldLog.h"
+#include "PacketLog.h"
#include "ScriptMgr.h"
#include "AccountMgr.h"
@@ -63,22 +63,22 @@ struct ServerPktHeader
if (isLargePacket())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
- header[headerIndex++] = 0x80|(0xFF &(size>>16));
+ header[headerIndex++] = 0x80 | (0xFF & (size >> 16));
}
- header[headerIndex++] = 0xFF &(size>>8);
- header[headerIndex++] = 0xFF &size;
+ header[headerIndex++] = 0xFF &(size >> 8);
+ header[headerIndex++] = 0xFF & size;
header[headerIndex++] = 0xFF & cmd;
- header[headerIndex++] = 0xFF & (cmd>>8);
+ header[headerIndex++] = 0xFF & (cmd >> 8);
}
uint8 getHeaderLength()
{
// cmd = 2 bytes, size= 2||3bytes
- return 2+(isLargePacket()?3:2);
+ return 2 + (isLargePacket() ? 3 : 2);
}
- bool isLargePacket()
+ bool isLargePacket() const
{
return size > 0x7FFF;
}
@@ -107,8 +107,8 @@ m_Seed(static_cast<uint32> (rand32()))
{
reference_counting_policy().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
- msg_queue()->high_water_mark(8*1024*1024);
- msg_queue()->low_water_mark(8*1024*1024);
+ msg_queue()->high_water_mark(8 * 1024 * 1024);
+ msg_queue()->low_water_mark(8 * 1024 * 1024);
}
WorldSocket::~WorldSocket (void)
@@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const
return m_Address;
}
-int WorldSocket::SendPacket(const WorldPacket& pct)
+int WorldSocket::SendPacket(WorldPacket const& pct)
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
@@ -160,24 +160,8 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
return -1;
// Dump outgoing packet.
- if (sWorldLog->LogWorld())
- {
- sWorldLog->outTimestampLog ("SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
- (uint32) get_handle(),
- pct.size(),
- LookupOpcodeName (pct.GetOpcode()),
- pct.GetOpcode());
-
- uint32 p = 0;
- while (p < pct.size())
- {
- for (uint32 j = 0; j < 16 && p < pct.size(); j++)
- sWorldLog->outLog("%.2X ", const_cast<WorldPacket&>(pct)[p++]);
-
- sWorldLog->outLog("\n");
- }
- sWorldLog->outLog("\n");
- }
+ if (sPacketLog->CanLogPacket())
+ sPacketLog->LogPacket(pct, SERVER_TO_CLIENT);
// Create a copy of the original packet; this is to avoid issues if a hook modifies it.
sScriptMgr->OnPacketSend(this, WorldPacket(pct));
@@ -209,7 +193,7 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
- sLog->outError("WorldSocket::SendPacket enqueue_tail failed");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::SendPacket enqueue_tail failed");
mb->release();
return -1;
}
@@ -252,7 +236,7 @@ int WorldSocket::open (void *a)
if (peer().get_remote_addr(remote_addr) == -1)
{
- sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -277,7 +261,7 @@ int WorldSocket::open (void *a)
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -313,14 +297,14 @@ int WorldSocket::handle_input (ACE_HANDLE)
return Update(); // interesting line, isn't it ?
}
- sLog->outStaticDebug("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
errno = ECONNRESET;
return -1;
}
case 0:
{
- sLog->outStaticDebug("WorldSocket::handle_input: Peer has closed connection");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer has closed connection");
errno = ECONNRESET;
return -1;
@@ -389,7 +373,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
- sLog->outError("WorldSocket::handle_output_queue dequeue_head");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue dequeue_head");
return -1;
}
@@ -424,7 +408,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
{
- sLog->outError("WorldSocket::handle_output_queue enqueue_head");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue enqueue_head");
mblk->release();
return -1;
}
@@ -496,7 +480,7 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
- sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName() : "<none>",
@@ -602,7 +586,7 @@ int WorldSocket::handle_input_missing_data (void)
// hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct)
{
- sLog->outError("Forcing close on input m_RecvWPct = NULL");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Forcing close on input m_RecvWPct = NULL");
errno = EINVAL;
return -1;
}
@@ -648,7 +632,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// would be good to store errno from reactor with errno guard
- sLog->outError("WorldSocket::cancel_wakeup_output");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::cancel_wakeup_output");
return -1;
}
@@ -667,14 +651,14 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError("WorldSocket::schedule_wakeup_output");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::schedule_wakeup_output");
return -1;
}
return 0;
}
-int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
+int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
{
ACE_ASSERT (new_pct);
@@ -687,24 +671,8 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
return -1;
// Dump received packet.
- if (sWorldLog->LogWorld())
- {
- sWorldLog->outTimestampLog ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
- (uint32) get_handle(),
- new_pct->size(),
- LookupOpcodeName (new_pct->GetOpcode()),
- new_pct->GetOpcode());
-
- uint32 p = 0;
- while (p < new_pct->size())
- {
- for (uint32 j = 0; j < 16 && p < new_pct->size(); j++)
- sWorldLog->outLog ("%.2X ", (*new_pct)[p++]);
-
- sWorldLog->outLog ("\n");
- }
- sWorldLog->outLog ("\n");
- }
+ if (sPacketLog->CanLogPacket())
+ sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER);
try
{
@@ -715,58 +683,51 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
case CMSG_AUTH_SESSION:
if (m_Session)
{
- sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerName(false).c_str());
return -1;
}
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return HandleAuthSession (*new_pct);
case CMSG_KEEP_ALIVE:
- sLog->outStaticDebug ("CMSG_KEEP_ALIVE, size: " UI64FMTD, uint64(new_pct->size()));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", GetOpcodeNameForLogging(opcode).c_str());
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return 0;
default:
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
- if (m_Session != NULL)
- {
- // Our Idle timer will reset on any non PING opcodes.
- // Catches people idling on the login screen and any lingering ingame connections.
- m_Session->ResetTimeOutTime();
-
- // OK, give the packet to WorldSession
- aptr.release();
- // WARNINIG here we call it with locks held.
- // Its possible to cause deadlock if QueuePacket calls back
- m_Session->QueuePacket (new_pct);
- return 0;
- }
- else
+ if (!m_Session)
{
- sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
+ sLog->outError(LOG_FILTER_NETWORKIO, "ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1;
}
+
+ // Our Idle timer will reset on any non PING opcodes.
+ // Catches people idling on the login screen and any lingering ingame connections.
+ m_Session->ResetTimeOutTime();
+
+ // OK, give the packet to WorldSession
+ aptr.release();
+ // WARNINIG here we call it with locks held.
+ // Its possible to cause deadlock if QueuePacket calls back
+ m_Session->QueuePacket(new_pct);
+ return 0;
}
}
}
catch (ByteBufferException &)
{
- sLog->outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
- opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1);
- if (sLog->IsOutDebug())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
- new_pct->hexlike();
- }
-
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
+ opcode, GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1);
+ new_pct->hexlike();
return -1;
}
ACE_NOTREACHED (return 0);
}
-int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
+int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
// NOTE: ATM the socket is singlethread, have this in mind ...
uint8 digest[20];
@@ -790,7 +751,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet << uint8(AUTH_REJECT);
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1;
}
@@ -804,7 +765,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
recvPacket >> unk4;
recvPacket.read(digest, 20);
- sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u",
BuiltNumberClient,
unk2,
account.c_str(),
@@ -826,7 +787,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
}
@@ -846,7 +807,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free()
const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free()
- sLog->outStaticDebug ("WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
sStr,
vStr);
@@ -862,7 +823,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet << uint8 (AUTH_FAILED);
SendPacket(packet);
- sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1;
}
}
@@ -926,7 +887,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet << uint8 (AUTH_BANNED);
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1;
}
@@ -940,7 +901,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1;
}
@@ -955,6 +916,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
sha.UpdateBigNumbers (&k, NULL);
sha.Finalize();
+ std::string address = GetRemoteAddress();
+
if (memcmp (sha.GetDigest(), digest, 20))
{
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
@@ -962,13 +925,11 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
return -1;
}
- std::string address = GetRemoteAddress();
-
- sLog->outStaticDebug ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
account.c_str(),
address.c_str());
@@ -1044,12 +1005,8 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
{
- Player* _player = m_Session->GetPlayer();
- sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)",
- m_Session->GetAccountId(),
- _player ? _player->GetGUIDLow() : 0,
- _player ? _player->GetName() : "<none>",
- GetRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
+ m_Session->GetPlayerName(false).c_str(), GetRemoteAddress().c_str());
return -1;
}
@@ -1067,7 +1024,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
m_Session->SetLatency (latency);
else
{
- sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, "
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, "
" address = %s",
GetRemoteAddress().c_str());
diff --git a/src/server/game/Server/WorldSocketAcceptor.h b/src/server/game/Server/WorldSocketAcceptor.h
index a16c5c2189f..d4ff7823b02 100644
--- a/src/server/game/Server/WorldSocketAcceptor.h
+++ b/src/server/game/Server/WorldSocketAcceptor.h
@@ -44,7 +44,7 @@ protected:
virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/)
{
- sLog->outBasic("Resuming acceptor");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Resuming acceptor");
reactor()->cancel_timer(this, 1);
return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK);
}
@@ -54,7 +54,7 @@ protected:
#if defined(ENFILE) && defined(EMFILE)
if (errno == ENFILE || errno == EMFILE)
{
- sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds");
+ sLog->outError(LOG_FILTER_GENERAL, "Out of file descriptors, suspending incoming connections for 10 seconds");
reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
reactor()->schedule_timer(this, NULL, ACE_Time_Value(10));
}
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index d357651a5bf..ed960258c41 100755
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -155,7 +155,7 @@ class ReactorRunnable : protected ACE_Task_Base
virtual int svc()
{
- sLog->outStaticDebug ("Network Thread Starting");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Network Thread Starting");
ACE_ASSERT (m_Reactor);
@@ -192,7 +192,7 @@ class ReactorRunnable : protected ACE_Task_Base
}
}
- sLog->outStaticDebug ("Network Thread exits");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Network Thread exits");
return 0;
}
@@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (num_threads <= 0)
{
- sLog->outError("Network.Threads is wrong in your config file");
+ sLog->outError(LOG_FILTER_GENERAL, "Network.Threads is wrong in your config file");
return -1;
}
@@ -244,7 +244,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
m_NetThreads = new ReactorRunnable[m_NetThreadsCount];
- sLog->outBasic ("Max allowed socket connections %d", ACE::max_handles());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Max allowed socket connections %d", ACE::max_handles());
// -1 means use default
m_SockOutKBuff = ConfigMgr::GetIntDefault ("Network.OutKBuff", -1);
@@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_SockOutUBuff <= 0)
{
- sLog->outError("Network.OutUBuff is wrong in your config file");
+ sLog->outError(LOG_FILTER_GENERAL, "Network.OutUBuff is wrong in your config file");
return -1;
}
@@ -263,7 +263,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1)
{
- sLog->outError("Failed to open acceptor, check if the port is free");
+ sLog->outError(LOG_FILTER_GENERAL, "Failed to open acceptor, check if the port is free");
return -1;
}
@@ -276,7 +276,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
int
WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address)
{
- if (!sLog->IsOutDebug())
+ if (!sLog->ShouldLog(LOG_FILTER_GENERAL, LOG_LEVEL_DEBUG))
ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS);
if (StartReactiveIO(port, address) == -1)
@@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*) & m_SockOutKBuff,
sizeof (int)) == -1 && errno != ENOTSUP)
{
- sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
return -1;
}
}
@@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*)&ndoption,
sizeof (int)) == -1)
{
- sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
return -1;
}
}
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index e314fab07be..3eac3d34fd2 100755
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -55,8 +55,8 @@ void LoadSkillDiscoveryTable()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
+
return;
}
@@ -89,7 +89,7 @@ void LoadSkillDiscoveryTable()
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
- sLog->outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell);
reportedReqSpells.insert(absReqSkillOrSpell);
}
continue;
@@ -102,7 +102,7 @@ void LoadSkillDiscoveryTable()
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
- sLog->outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
" and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
absReqSkillOrSpell, spellId);
reportedReqSpells.insert(absReqSkillOrSpell);
@@ -118,7 +118,7 @@ void LoadSkillDiscoveryTable()
if (bounds.first == bounds.second)
{
- sLog->outErrorDb("Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId);
continue;
}
@@ -127,7 +127,7 @@ void LoadSkillDiscoveryTable()
}
else
{
- sLog->outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);
continue;
}
@@ -136,7 +136,7 @@ void LoadSkillDiscoveryTable()
while (result->NextRow());
if (!ssNonDiscoverableEntries.str().empty())
- sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
+ sLog->outError(LOG_FILTER_SQL, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
// report about empty data for explicit discovery spells
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
@@ -150,11 +150,11 @@ void LoadSkillDiscoveryTable()
continue;
if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())
- sLog->outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
}
- sLog->outString(">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player)
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 3bb435145f1..9e2648dc943 100755
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -60,8 +60,8 @@ void LoadSkillExtraItemTable()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
+
return;
}
@@ -75,28 +75,28 @@ void LoadSkillExtraItemTable()
if (!sSpellMgr->GetSpellInfo(spellId))
{
- sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if (!sSpellMgr->GetSpellInfo(requiredSpecialization))
{
- sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
+ sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
if (additionalCreateChance <= 0.0f)
{
- sLog->outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
if (!additionalMaxNum)
{
- sLog->outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
@@ -110,8 +110,8 @@ void LoadSkillExtraItemTable()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 9ab375413fb..b83e44d6a73 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -36,6 +36,8 @@
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
class Aura;
//
@@ -490,7 +492,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
// Glyph of Ice Barrier: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
// Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage
DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
@@ -499,13 +501,13 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x8 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
}
// Frost Ward
else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
}
break;
case SPELLFAMILY_WARLOCK:
@@ -513,7 +515,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (m_spellInfo->SpellFamilyFlags[2] & 0x40)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
}
break;
case SPELLFAMILY_PRIEST:
@@ -527,7 +529,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
bonus += CalculatePctN(1.0f, pAurEff->GetAmount());
- DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus;
+ DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
// Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
// Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
@@ -555,7 +557,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
//+75.00% from sp bonus
float bonus = 0.75f;
- DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus;
+ DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
// Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
@@ -584,7 +586,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8)
{
// +80.53% from +spd bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8053f;;
+ DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f;
}
break;
case SPELL_AURA_DUMMY:
@@ -592,7 +594,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
break;
// Earth Shield
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400)
- amount = caster->SpellHealingBonus(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
+ {
+ amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
+ amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
+ }
break;
case SPELL_AURA_PERIODIC_DAMAGE:
if (!caster)
@@ -624,7 +629,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
uint8 cp = caster->ToPlayer()->GetComboPoints();
// Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
- if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, 0))
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, EFFECT_0))
+ amount += cp * aurEff->GetAmount();
+ // Idol of Worship. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
+ else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0))
amount += cp * aurEff->GetAmount();
amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
@@ -657,19 +665,23 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
}
break;
case SPELL_AURA_PERIODIC_ENERGIZE:
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
+ switch (m_spellInfo->Id)
{
- // Replenishment (0.25% from max)
- // Infinite Replenishment
- if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495)
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 25 / 10000;
- }
- // Innervate
- else if (m_spellInfo->Id == 29166)
+ case 57669: // Replenishment (0.2% from max)
+ amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f;
+ break;
+ case 61782: // Infinite Replenishment
+ amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
+ break;
+ case 29166: // Innervate
ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
- // Owlkin Frenzy
- else if (m_spellInfo->Id == 48391)
+ break;
+ case 48391: // Owlkin Frenzy
ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
+ break;
+ default:
+ break;
+ }
break;
case SPELL_AURA_PERIODIC_HEAL:
if (!caster)
@@ -774,33 +786,18 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
m_amplitude = 1 * IN_MILLISECONDS;
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
- case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_OBS_MOD_HEALTH:
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
+ case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
case SPELL_AURA_POWER_BURN:
- m_isPeriodic = true;
- break;
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
- if (GetId() == 51912)
- m_amplitude = 3000;
- m_isPeriodic = true;
- break;
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
case SPELL_AURA_PERIODIC_DUMMY:
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
m_isPeriodic = true;
break;
- case SPELL_AURA_DUMMY:
- // Haunting Spirits - perdiodic trigger demon
- if (GetId() == 7057)
- {
- m_isPeriodic = true;
- m_amplitude = irand (0, 60) + 30;
- m_amplitude *= IN_MILLISECONDS;
- }
- break;
default:
break;
}
@@ -866,21 +863,6 @@ void AuraEffect::CalculateSpellMod()
case SPELL_AURA_DUMMY:
switch (GetSpellInfo()->SpellFamilyName)
{
- case SPELLFAMILY_PRIEST:
- // Pain and Suffering
- if (m_spellInfo->SpellIconID == 2874)
- {
- if (!m_spellmod)
- {
- m_spellmod = new SpellModifier(GetBase());
- m_spellmod->op = SPELLMOD_DOT;
- m_spellmod->type = SPELLMOD_PCT;
- m_spellmod->spellId = GetId();
- m_spellmod->mask[1] = 0x00002000;
- }
- m_spellmod->value = GetAmount();
- }
- break;
case SPELLFAMILY_DRUID:
switch (GetId())
{
@@ -933,6 +915,7 @@ void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
handleMask |= AURA_EFFECT_HANDLE_CHANGE_AMOUNT;
if (onStackOrReapply)
handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
+
if (!handleMask)
return;
@@ -1095,14 +1078,6 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
{
switch (GetAuraType())
{
- case SPELL_AURA_DUMMY:
- // Haunting Spirits
- if (GetId() == 7057)
- {
- m_amplitude = irand (0, 60) + 30;
- m_amplitude *= IN_MILLISECONDS;
- }
- break;
case SPELL_AURA_PERIODIC_DUMMY:
switch (GetSpellInfo()->SpellFamilyName)
{
@@ -1134,7 +1109,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
{
m_isPeriodic = false;
- sLog->outError("Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
}
else
{
@@ -1231,12 +1206,11 @@ bool AuraEffect::IsPeriodicTickCrit(Unit* target, Unit const* caster) const
if ((*itr)->IsAffectedOnSpell(m_spellInfo) && caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()))
return true;
}
+
// Rupture - since 3.3.3 can crit
- if (target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0x0, 0x0, caster->GetGUID()))
- {
- if (caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()))
- return true;
- }
+ if (m_spellInfo->SpellIconID == 500 && m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
+ return caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask());
+
return false;
}
@@ -1305,11 +1279,6 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const
case SPELL_AURA_POWER_BURN:
HandlePeriodicPowerBurnAuraTick(target, caster);
break;
- case SPELL_AURA_DUMMY:
- // Haunting Spirits
- if (GetId() == 7057)
- target->CastSpell((Unit*)NULL, GetAmount(), true);
- break;
default:
break;
}
@@ -1475,6 +1444,23 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
if (spellInfo->Stances & (1<<(GetMiscValue()-1)))
target->CastSpell(target, itr->first, true, NULL, this);
}
+
+ // Also do it for Glyphs
+ for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
+ {
+ if (uint32 glyphId = target->ToPlayer()->GetGlyph(i))
+ {
+ if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId))
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellId);
+ if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
+ continue;
+ if (spellInfo->Stances & (1<<(GetMiscValue()-1)))
+ target->CastSpell(target, glyph->SpellId, true, NULL, this);
+ }
+ }
+ }
+
// Leader of the Pack
if (target->ToPlayer()->HasSpell(17007))
{
@@ -1584,10 +1570,25 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
}
}
+ const Unit::AuraEffectList& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT);
+ AuraEffect* newAura = NULL;
+ // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied
+ for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr)
+ {
+ if ((*itr) != this)
+ {
+ newAura = *itr;
+ break;
+ }
+ }
Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
- if (itr->second->GetBase()->IsRemovedOnShapeLost(target))
+ // Use the new aura to see on what stance the target will be
+ uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1));
+
+ // If the stances are not compatible with the spell, remove it
+ if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance))
target->RemoveAura(itr);
else
++itr;
@@ -1934,7 +1935,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_SPIRITOFREDEMPTION: // 0x20
break;
default:
- sLog->outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Auras: Unknown Shapeshift Type: %u", GetMiscValue());
}
modelid = target->GetModelForForm(form);
@@ -2289,7 +2290,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
if (!ci)
{
target->SetDisplayId(16358); // pig pink ^_^
- sLog->outError("Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
}
else
{
@@ -2386,7 +2387,7 @@ void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode
// What must be cloned? at least display and scale
target->SetDisplayId(caster->GetDisplayId());
- //target->SetFloatValue(OBJECT_FIELD_SCALE_X, caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?)
+ //target->SetObjectScale(caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?)
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE);
}
else
@@ -2808,7 +2809,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry);
if (!ci)
{
- sLog->outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue());
+ sLog->outError(LOG_FILTER_SQL, "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue());
return;
}
@@ -3329,41 +3330,239 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
return;
Unit* target = aurApp->GetTarget();
+ std::list <AuraType> aura_immunity_list;
+ uint32 mechanic_immunity_list = 0;
+ int32 miscVal = GetMiscValue();
- std::list <AuraType> immunity_list;
- if (GetMiscValue() & (1<<10))
- immunity_list.push_back(SPELL_AURA_MOD_STUN);
- if (GetMiscValue() & (1<<1))
- immunity_list.push_back(SPELL_AURA_TRANSFORM);
+ switch (miscVal)
+ {
+ case 96:
+ case 1615:
+ {
+ if (GetAmount())
+ {
+ mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
+ | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
+ | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
+ | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
+ | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
+ | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
+
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ }
+ break;
+ }
+ case 679:
+ {
+ if (GetId() == 57742)
+ {
+ mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
+ | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
+ | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
+ | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
+ | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
+ | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
+
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ }
+ break;
+ }
+ case 1557:
+ {
+ if (GetId() == 64187)
+ {
+ mechanic_immunity_list = (1 << MECHANIC_STUN);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ }
+ else
+ {
+ mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
+ | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
+ | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
+ | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
+ | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
+ | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
+
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ }
+ break;
+ }
+ case 1614:
+ case 1694:
+ {
+ target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
+ break;
+ }
+ case 1630:
+ {
+ if (!GetAmount())
+ {
+ target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
+ }
+ else
+ {
+ mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
+ | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
+ | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
+ | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
+ | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
+ | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
+
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ }
+ break;
+ }
+ case 477:
+ case 1733:
+ {
+ if (!GetAmount())
+ {
+ mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
+ | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
+ | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
+ | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
+ | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
+ | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
+
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ }
+ break;
+ }
+ case 878:
+ {
+ if (GetAmount() == 1)
+ {
+ mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
+ | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
+
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ }
+ break;
+ }
+ default:
+ break;
+ }
- // These flag can be recognized wrong:
- if (GetMiscValue() & (1<<6))
- immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
- if (GetMiscValue() & (1<<0))
- immunity_list.push_back(SPELL_AURA_MOD_ROOT);
- if (GetMiscValue() & (1<<2))
- immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
- if (GetMiscValue() & (1<<9))
- immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ if (aura_immunity_list.empty())
+ {
+ if (miscVal & (1<<10))
+ aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ if (miscVal & (1<<1))
+ aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
- // an exception for Bladestorm
- if ((GetMiscValue() & (1<<7)) && (GetId() != 46924))
- immunity_list.push_back(SPELL_AURA_MOD_DISARM);
+ // These flag can be recognized wrong:
+ if (miscVal & (1<<6))
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ if (miscVal & (1<<0))
+ aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ if (miscVal & (1<<2))
+ aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ if (miscVal & (1<<9))
+ aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+ if (miscVal & (1<<7))
+ aura_immunity_list.push_back(SPELL_AURA_MOD_DISARM);
+ }
// apply immunities
- for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end(); ++iter)
+ for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
- // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
- if (apply && GetId() == 46924)
- {
- target->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
- target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
- }
-
if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
- for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end(); ++iter)
+ {
+ target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
+ for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
target->RemoveAurasByType(*iter);
+ }
}
void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -3686,7 +3885,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
if (GetMiscValue() < -2 || GetMiscValue() > 4)
{
- sLog->outError("WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
return;
}
@@ -3712,7 +3911,7 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode,
if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
- sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
}
@@ -3810,7 +4009,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
- sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
}
@@ -3848,7 +4047,7 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aur
{
// support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
// and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
- sLog->outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
return;
}
@@ -4769,38 +4968,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget()))
target->CastSpell(spellTarget, 51699, true);
break;
- case 28832: // Mark of Korth'azz
- case 28833: // Mark of Blaumeux
- case 28834: // Mark of Rivendare
- case 28835: // Mark of Zeliek
- if (caster) // actually we can also use cast(this, originalcasterguid)
- {
- int32 damage;
- switch (GetBase()->GetStackAmount())
- {
- case 1: damage = 0; break;
- case 2: damage = 500; break;
- case 3: damage = 1000; break;
- case 4: damage = 1500; break;
- case 5: damage = 4000; break;
- case 6: damage = 12000; break;
- default:damage = 20000 + 1000 * (GetBase()->GetStackAmount() - 7); break;
- }
- if (damage)
- caster->CastCustomSpell(28836, SPELLVALUE_BASE_POINT0, damage, target);
- }
- break;
- case 63322: // Saronite Vapors
- {
- if (caster)
- {
- int32 mana = int32(GetAmount() * pow(2.0f, GetBase()->GetStackAmount())); // mana restore - bp * 2^stackamount
- int32 damage = mana * 2; // damage
- caster->CastCustomSpell(target, 63337, &mana, NULL, NULL, true);
- caster->CastCustomSpell(target, 63338, &damage, NULL, NULL, true);
- }
- break;
- }
case 71563:
if (Aura* newAura = target->AddAura(71564, target))
newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
@@ -4851,8 +5018,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER)
+ {
if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
+ bf->RemovePlayerFromResurrectQueue(target->GetGUID());
+ }
break;
case 36730: // Flame Strike
{
@@ -4889,56 +5060,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this);
break;
case 58600: // Restricted Flight Area
+ case 58730: // Restricted Flight Area
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
target->CastSpell(target, 58601, true);
break;
}
break;
- case SPELLFAMILY_MAGE:
- // Living Bomb
- if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
- {
- AuraRemoveMode removeMode = aurApp->GetRemoveMode();
- if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE))
- caster->CastSpell(target, GetAmount(), true);
- }
- break;
- case SPELLFAMILY_PRIEST:
- // Vampiric Touch
- if (m_spellInfo->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0)
- if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
- {
- int32 damage = aurEff->GetAmount() * 8;
- // backfire damage
- target->CastCustomSpell(target, 64085, &damage, NULL, NULL, true, NULL, NULL, GetCasterGUID());
- }
- break;
- case SPELLFAMILY_WARLOCK:
- // Haunt
- if (m_spellInfo->SpellFamilyFlags[1] & 0x40000)
- if (caster)
- target->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this, GetCasterGUID());
- break;
- case SPELLFAMILY_DRUID:
- // Lifebloom
- if (GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
- {
- // Final heal only on duration end
- if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
- return;
-
- // final heal
- int32 stack = GetBase()->GetStackAmount();
- target->CastCustomSpell(target, 33778, &m_amount, &stack, NULL, true, NULL, this, GetCasterGUID());
-
- // restore mana
- if (caster)
- {
- int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
- caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID());
- }
- }
- break;
case SPELLFAMILY_DEATHKNIGHT:
// Summon Gargoyle (Dismiss Gargoyle at remove)
if (GetId() == 61777)
@@ -4946,7 +5073,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break;
case SPELLFAMILY_ROGUE:
// Tricks of the trade
- switch(GetId())
+ switch (GetId())
{
case 59628: //Tricks of the trade buff on rogue (6sec duration)
target->SetReducedThreatPercent(0,0);
@@ -5014,48 +5141,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->SetEntry(apply ? 17654 : 17326);
break;
}
- //Summon Fire Elemental
- case 40133:
- {
- if (!caster)
- break;
-
- Unit* owner = caster->GetOwner();
- if (owner && owner->GetTypeId() == TYPEID_PLAYER)
- {
- if (apply)
- owner->CastSpell(owner, 8985, true);
- else
- owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
- }
- break;
- }
- //Summon Earth Elemental
- case 40132 :
- {
- if (!caster)
- break;
-
- Unit* owner = caster->GetOwner();
- if (owner && owner->GetTypeId() == TYPEID_PLAYER)
- {
- if (apply)
- owner->CastSpell(owner, 19704, true);
- else
- owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
- }
- break;
- }
- case 57723: // Exhaustion
- case 57724: // Sated
- {
- switch (GetId())
- {
- case 57723: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 32182, apply); break; // Heroism
- case 57724: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 2825, apply); break; // Bloodlust
- }
- break;
- }
case 57819: // Argent Champion
case 57820: // Ebon Champion
case 57821: // Champion of the Kirin Tor
@@ -5148,69 +5233,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
case SPELLFAMILY_DRUID:
{
- if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
- break;
- switch (GetId())
- {
- case 52610: // Savage Roar
- {
- uint32 spellId = 62071;
- if (apply)
- {
- if (target->GetShapeshiftForm() != FORM_CAT)
- break;
-
- target->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID());
- break;
- }
- target->RemoveAurasDueToSpell(spellId);
- break;
- }
- case 61336: // Survival Instincts
- {
- if (!(mode & AURA_EFFECT_HANDLE_REAL))
- break;
-
- if (apply)
- {
- if (!target->IsInFeralForm())
- break;
-
- int32 bp0 = int32(target->CountPctFromMaxHealth(GetAmount()));
- target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true);
- }
- else
- target->RemoveAurasDueToSpell(50322);
- break;
- }
- }
- // Predatory Strikes
- if (target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->SpellIconID == 1563)
- {
- target->ToPlayer()->UpdateAttackPowerAndDamage();
- }
+ //if (!(mode & AURA_EFFECT_HANDLE_REAL))
+ //break;
break;
}
case SPELLFAMILY_SHAMAN:
{
- if (!(mode & AURA_EFFECT_HANDLE_REAL))
- break;
- // Sentry Totem
- if (GetId() == 6495 && caster && caster->GetTypeId() == TYPEID_PLAYER)
- {
- if (apply)
- {
- if (uint64 guid = caster->m_SummonSlot[4])
- {
- if (Creature* totem = caster->GetMap()->GetCreature(guid))
- if (totem->isTotem())
- caster->ToPlayer()->CastSpell(totem, 6277, true);
- }
- }
- else
- caster->ToPlayer()->StopCastingBindSight();
- return;
- }
+ //if (!(mode & AURA_EFFECT_HANDLE_REAL))
+ //break;
break;
}
case SPELLFAMILY_PALADIN:
@@ -5231,66 +5261,63 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
- if (!apply)
- {
- Unit* caster = GetCaster();
+ if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
+ return;
- if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
- return;
+ Unit* caster = GetCaster();
- Player* plCaster = caster->ToPlayer();
- Unit* target = aurApp->GetTarget();
+ if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
+ return;
- if (target->getDeathState() != JUST_DIED)
- return;
+ Player* plCaster = caster->ToPlayer();
+ Unit* target = aurApp->GetTarget();
- // Item amount
- if (GetAmount() <= 0)
- return;
+ // Item amount
+ if (GetAmount() <= 0)
+ return;
+
+ if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
+ return;
- if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
+ // Soul Shard
+ if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265)
+ {
+ // Soul Shard only from units that grant XP or honor
+ if (!plCaster->isHonorOrXPTarget(target) ||
+ (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
return;
- // Soul Shard
- if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265)
+ // If this is Drain Soul, check for Glyph of Drain Soul
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
{
- // Soul Shard only from units that grant XP or honor
- if (!plCaster->isHonorOrXPTarget(target) ||
- (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
- return;
-
- // If this is Drain Soul, check for Glyph of Drain Soul
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
- {
- // Glyph of Drain Soul - chance to create an additional Soul Shard
- if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
- if (roll_chance_i(aur->GetMiscValue()))
- caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
- }
+ // Glyph of Drain Soul - chance to create an additional Soul Shard
+ if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
+ if (roll_chance_i(aur->GetMiscValue()))
+ caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
}
+ }
- //Adding items
- uint32 noSpaceForCount = 0;
- uint32 count = m_amount;
+ //Adding items
+ uint32 noSpaceForCount = 0;
+ uint32 count = m_amount;
- ItemPosCountVec dest;
- InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
- if (msg != EQUIP_ERR_OK)
- {
- count-=noSpaceForCount;
- plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType);
- if (count == 0)
- return;
- }
-
- Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
- if (!newitem)
- {
- plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
+ ItemPosCountVec dest;
+ InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
+ if (msg != EQUIP_ERR_OK)
+ {
+ count-=noSpaceForCount;
+ plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType);
+ if (count == 0)
return;
- }
- plCaster->SendNewItem(newitem, count, true, true);
}
+
+ Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
+ if (!newitem)
+ {
+ plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
+ return;
+ }
+ plCaster->SendNewItem(newitem, count, true, true);
}
void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -5843,14 +5870,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
if (caster)
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this);
return;
- // Detonate Mana
- case 27819:
- if (int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10))
- {
- mana = target->ModifyPower(POWER_MANA, -mana);
- target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*10, target, true, NULL, this);
- }
- return;
// Inoculate Nestlewood Owlkin
case 29528:
if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
@@ -6156,7 +6175,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
- damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
// Calculate armor mitigation
if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex()))
@@ -6221,7 +6241,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
caster->DealDamageMods(target, damage, &absorb);
@@ -6266,7 +6286,9 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
uint32 damage = std::max(GetAmount(), 0);
- damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+
+ damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
@@ -6289,7 +6311,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
if (target->GetHealth() < damage)
damage = uint32(target->GetHealth());
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
@@ -6304,12 +6326,12 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
if (caster->isAlive())
caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
int32 new_damage = caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
-
if (caster->isAlive())
{
float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
- uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
+ uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
+ heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetBase()->GetStackAmount()));
int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal);
caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
@@ -6413,14 +6435,15 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
damage += addition;
}
- damage = caster->SpellHealingBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
+ damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
}
bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target);
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId());
uint32 absorb = 0;
@@ -6439,7 +6462,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
// damage caster for heal amount
if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL)
{
- uint32 funnelDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power
+ uint32 funnelDamage = GetSpellInfo()->ManaPerSecond; // damage is not affected by spell power
if ((int32)funnelDamage > gain)
funnelDamage = gain;
uint32 funnelAbsorb = 0;
@@ -6489,7 +6512,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
drainAmount = maxmana;
}
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId());
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
@@ -6511,33 +6534,6 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
}
- // spell-specific code
- switch (GetId())
- {
- case 31447: // Mark of Kaz'rogal
- if (target->GetPower(powerType) == 0)
- {
- target->CastSpell(target, 31463, true, 0, this);
- // Remove aura
- GetBase()->SetDuration(0);
- }
- break;
- case 32960: // Mark of Kazzak
- {
- int32 modifier = int32(target->GetPower(powerType) * 0.05f);
- target->ModifyPower(powerType, -modifier);
-
- if (target->GetPower(powerType) == 0)
- {
- target->CastSpell(target, 32961, true, 0, this);
- // Remove aura
- GetBase()->SetDuration(0);
- }
- break;
- }
- default:
- break;
- }
// Drain Mana
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK
&& m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
@@ -6577,7 +6573,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
// ignore negative values (can be result apply spellmods to aura damage
uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100;
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
@@ -6612,7 +6608,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
int32 gain = target->ModifyPower(powerType, amount);
@@ -6703,7 +6699,8 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv
Unit* target = aurApp->GetTarget();
Unit* triggerTarget = eventInfo.GetProcTarget();
SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask);
- uint32 damage = target->SpellDamageBonus(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE);
+ uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE);
+ damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
target->SendSpellNonMeleeDamageLog(&damageInfo);
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index b6cdc006d2d..9ee05b9a2a4 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -424,7 +424,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
// TODO: Figure out why this happens
if (itr == m_applications.end())
{
- sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id);
ASSERT(false);
}
@@ -566,7 +566,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
if (!GetOwner()->IsSelfOrInSameMap(itr->first))
{
//TODO: There is a crash caused by shadowfiend load addon
- sLog->outCrash("Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
+ sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
GetOwner()->GetName(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
ASSERT(false);
@@ -1181,7 +1181,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 31571: spellId = 57529; break;
case 31572: spellId = 57531; break;
default:
- sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
}
if (spellId)
caster->CastSpell(caster, spellId, true);
@@ -1212,22 +1212,15 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Improved Devouring Plague
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1))
{
- int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT) / 100;
+ uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
+ damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
+ int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
int32 heal = int32(CalculatePctN(basepoints0, 15));
+
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
}
}
- // Renew
- else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0))
- {
- // Empowered Renew
- if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1))
- {
- int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL) / 100;
- caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
- }
- }
// Power Word: Shield
else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
{
@@ -1284,7 +1277,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 49631: spellId = 50509; break;
case 49032: spellId = 50508; break;
default:
- sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId());
}
caster->CastSpell(target, spellId, true, 0, GetEffect(0));
}
@@ -1380,17 +1373,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case SPELLFAMILY_WARLOCK:
if (!caster)
break;
- // Curse of Doom
- if (GetSpellInfo()->SpellFamilyFlags[1] & 0x02)
- {
- if (removeMode == AURA_REMOVE_BY_DEATH)
- {
- if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
- caster->CastSpell(target, 18662, true, NULL, GetEffect(0));
- }
- }
// Improved Fear
- else if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
{
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
{
@@ -1400,7 +1384,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 53759: spellId = 60947; break;
case 53754: spellId = 60946; break;
default:
- sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId());
}
if (spellId)
caster->CastSpell(target, spellId, true);
@@ -1609,6 +1593,14 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId())
{
case 19746:
+ // Improved concentration aura - linked aura
+ if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256))
+ {
+ if (apply)
+ target->CastSpell(target, 63510, true);
+ else
+ target->RemoveAura(63510);
+ }
case 31821:
// Aura Mastery Triggered Spell Handler
// If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity
@@ -1617,6 +1609,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Do effects only on aura owner
if (GetCasterGUID() != target->GetGUID())
break;
+
if (apply)
{
if ((GetSpellInfo()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellInfo()->Id == 19746 && target->HasAura(31821)))
@@ -1636,6 +1629,26 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
break;
}
+ if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA)
+ {
+ // Improved devotion aura
+ if (caster->HasAura(20140) || caster->HasAura(20138) || caster->HasAura(20139))
+ {
+ if (apply)
+ caster->CastSpell(target, 63514, true);
+ else
+ target->RemoveAura(63514);
+ }
+ // 63531 - linked aura for both Sanctified Retribution and Swift Retribution talents
+ // Not allow for Retribution Aura (prevent stacking)
+ if ((GetSpellInfo()->SpellIconID != 555) && (caster->HasAura(53648) || caster->HasAura(53484) || caster->HasAura(53379) || caster->HasAura(31869)))
+ {
+ if (apply)
+ caster->CastSpell(target, 63531, true);
+ else
+ target->RemoveAura(63531);
+ }
+ }
break;
case SPELLFAMILY_DEATHKNIGHT:
if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_PRESENCE)
@@ -2243,7 +2256,7 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
}
}
-void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/)
+void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool& defaultPrevented)
{
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
@@ -2254,6 +2267,7 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
+ defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
(*scritr)->_FinishScriptCall();
}
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 36d7328f37e..6376ff6e50b 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -53,6 +53,8 @@
#include "SpellScript.h"
#include "InstanceScript.h"
#include "SpellInfo.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -458,23 +460,23 @@ void SpellCastTargets::Update(Unit* caster)
void SpellCastTargets::OutDebug() const
{
if (!m_targetMask)
- sLog->outString("No targets");
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "No targets");
- sLog->outString("target mask: %u", m_targetMask);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "target mask: %u", m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK))
- sLog->outString("Object target: " UI64FMTD, m_objectTargetGUID);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Object target: " UI64FMTD, m_objectTargetGUID);
if (m_targetMask & TARGET_FLAG_ITEM)
- sLog->outString("Item target: " UI64FMTD, m_itemTargetGUID);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Item target: " UI64FMTD, m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
- sLog->outString("Trade item target: " UI64FMTD, m_itemTargetGUID);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Trade item target: " UI64FMTD, m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
- sLog->outString("Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
- sLog->outString("Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_STRING)
- sLog->outString("String: %s", m_strTarget.c_str());
- sLog->outString("speed: %f", m_speed);
- sLog->outString("elevation: %f", m_elevation);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "String: %s", m_strTarget.c_str());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "speed: %f", m_speed);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "elevation: %f", m_elevation);
}
SpellValue::SpellValue(SpellInfo const* proto)
@@ -585,9 +587,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
CleanupEffectExecuteData();
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
m_destTargets[i] = SpellDestination(*m_caster);
- }
}
Spell::~Spell()
@@ -605,7 +605,7 @@ Spell::~Spell()
{
// Clean the reference to avoid later crash.
// If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
- sLog->outError("SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
*m_selfContainer = NULL;
}
@@ -829,7 +829,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
break;
}
- switch(targetType.GetSelectionCategory())
+ switch (targetType.GetSelectionCategory())
{
case TARGET_SELECT_CATEGORY_CHANNEL:
SelectImplicitChannelTargets(effIndex, targetType);
@@ -847,7 +847,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
switch (targetType.GetObjectType())
{
case TARGET_OBJECT_TYPE_SRC:
- switch(targetType.GetReferenceType())
+ switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_CASTER:
m_targets.SetSrc(*m_caster);
@@ -858,7 +858,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
}
break;
case TARGET_OBJECT_TYPE_DEST:
- switch(targetType.GetReferenceType())
+ switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_CASTER:
SelectImplicitCasterDestTargets(effIndex, targetType);
@@ -875,7 +875,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
}
break;
default:
- switch(targetType.GetReferenceType())
+ switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_CASTER:
SelectImplicitCasterObjectTargets(effIndex, targetType);
@@ -916,17 +916,25 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
switch (targetType.GetTarget())
{
case TARGET_UNIT_CHANNEL_TARGET:
+ {
+ WorldObject* target = ObjectAccessor::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID());
+ CallScriptObjectTargetSelectHandlers(target, effIndex);
// unit target may be no longer avalible - teleported out of map for example
- if (Unit* target = Unit::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID()))
- AddUnitTarget(target, 1 << effIndex);
+ if (target && target->ToUnit())
+ AddUnitTarget(target->ToUnit(), 1 << effIndex);
else
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
break;
+ }
case TARGET_DEST_CHANNEL_TARGET:
if (channeledSpell->m_targets.HasDst())
m_targets.SetDst(channeledSpell->m_targets);
else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, channeledSpell->m_targets.GetObjectTargetGUID()))
- m_targets.SetDst(*target);
+ {
+ CallScriptObjectTargetSelectHandlers(target, effIndex);
+ if (target)
+ m_targets.SetDst(*target);
+ }
else
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
break;
@@ -1004,6 +1012,8 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
return;
}
+ CallScriptObjectTargetSelectHandlers(target, effIndex);
+
switch (targetType.GetObjectType())
{
case TARGET_OBJECT_TYPE_UNIT:
@@ -1043,7 +1053,9 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
{
Trinity::WorldObjectSpellConeTargetCheck check(coneAngle, radius, m_caster, m_spellInfo, selectionType, condList);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> searcher(m_caster, targets, check, containerTypeMask);
- SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> > (searcher, containerTypeMask, m_caster, m_caster, radius);
+ SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> >(searcher, containerTypeMask, m_caster, m_caster, radius);
+
+ CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
if (!targets.empty())
{
@@ -1071,8 +1083,6 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
gObjTargets.push_back(gObjTarget);
}
- CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex);
-
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
AddUnitTarget(*itr, effMask, false);
@@ -1207,6 +1217,9 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
default:
break;
}
+
+ CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
+
std::list<Unit*> unitTargets;
std::list<GameObject*> gObjTargets;
// for compability with older code - add only unit and go targets
@@ -1288,18 +1301,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth
power = POWER_HEALTH;
}
- else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall
- {
- // Remove targets not in LoS or in stealth
- for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
- {
- if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster))
- itr = unitTargets.erase(itr);
- else
- ++itr;
- }
- break;
- }
else
break;
@@ -1340,6 +1341,11 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
}
}
+ // todo: move to scripts, but we must call it before resize list by MaxAffectedTargets
+ // Intimidating Shout
+ if (m_spellInfo->Id == 5246 && effIndex != EFFECT_0)
+ unitTargets.remove(m_targets.GetUnitTarget());
+
// Other special target selection goes here
if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
{
@@ -1348,13 +1354,9 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
if ((*j)->IsAffectedOnSpell(m_spellInfo))
maxTargets += (*j)->GetAmount();
- if (m_spellInfo->Id == 5246) //Intimidating Shout
- unitTargets.remove(m_targets.GetUnitTarget());
Trinity::Containers::RandomResizeList(unitTargets, maxTargets);
}
- CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex);
-
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
AddUnitTarget(*itr, effMask, false);
}
@@ -1370,6 +1372,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
Trinity::Containers::RandomResizeList(gObjTargets, maxTargets);
}
+
for (std::list<GameObject*>::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr)
AddGOTarget(*itr, effMask);
}
@@ -1377,7 +1380,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
- switch(targetType.GetTarget())
+ switch (targetType.GetTarget())
{
case TARGET_DEST_CASTER:
m_targets.SetDst(*m_caster);
@@ -1442,7 +1445,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
WorldObject* target = m_targets.GetObjectTarget();
- switch(targetType.GetTarget())
+ switch (targetType.GetTarget())
{
case TARGET_DEST_TARGET_ENEMY:
case TARGET_DEST_TARGET_ANY:
@@ -1475,7 +1478,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT
if (!m_targets.HasDst())
m_targets.SetDst(*m_caster);
- switch(targetType.GetTarget())
+ switch (targetType.GetTarget())
{
case TARGET_DEST_DYNOBJ_ENEMY:
case TARGET_DEST_DYNOBJ_ALLY:
@@ -1501,27 +1504,27 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT
void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
- switch(targetType.GetTarget())
+ WorldObject* target = NULL;
+ bool checkIfValid = true;
+
+ switch (targetType.GetTarget())
{
case TARGET_UNIT_CASTER:
- AddUnitTarget(m_caster, 1 << effIndex, false);
+ target = m_caster;
+ checkIfValid = false;
break;
case TARGET_UNIT_MASTER:
- if (Unit* owner = m_caster->GetCharmerOrOwner())
- AddUnitTarget(owner, 1 << effIndex);
+ target = m_caster->GetCharmerOrOwner();
break;
case TARGET_UNIT_PET:
- if (Guardian* pet = m_caster->GetGuardianPet())
- AddUnitTarget(pet, 1 << effIndex);
+ target = m_caster->GetGuardianPet();
break;
case TARGET_UNIT_SUMMONER:
if (m_caster->isSummon())
- if (Unit* unit = m_caster->ToTempSummon()->GetSummoner())
- AddUnitTarget(unit, 1 << effIndex);
+ target = m_caster->ToTempSummon()->GetSummoner();
break;
case TARGET_UNIT_VEHICLE:
- if (Unit *vehicle = m_caster->GetVehicleBase())
- AddUnitTarget(vehicle, 1 << effIndex);
+ target = m_caster->GetVehicleBase();
break;
case TARGET_UNIT_PASSENGER_0:
case TARGET_UNIT_PASSENGER_1:
@@ -1532,26 +1535,38 @@ void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImpli
case TARGET_UNIT_PASSENGER_6:
case TARGET_UNIT_PASSENGER_7:
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
- if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0))
- AddUnitTarget(unit, 1 << effIndex);
+ target = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0);
break;
default:
break;
}
+
+ CallScriptObjectTargetSelectHandlers(target, effIndex);
+
+ if (target && target->ToUnit())
+ AddUnitTarget(target->ToUnit(), 1 << effIndex, checkIfValid);
}
void Spell::SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
ASSERT((m_targets.GetObjectTarget() || m_targets.GetItemTarget()) && "Spell::SelectImplicitTargetObjectTargets - no explicit object or item target available!");
- if (Unit* unit = m_targets.GetUnitTarget())
- AddUnitTarget(unit, 1 << effIndex, true, false);
- else if (GameObject* gobj = m_targets.GetGOTarget())
- AddGOTarget(gobj, 1 << effIndex);
- else
- AddItemTarget(m_targets.GetItemTarget(), 1 << effIndex);
- if (WorldObject* target = m_targets.GetObjectTarget())
+ WorldObject* target = m_targets.GetObjectTarget();
+
+ CallScriptObjectTargetSelectHandlers(target, effIndex);
+
+ if (target)
+ {
+ if (Unit* unit = target->ToUnit())
+ AddUnitTarget(unit, 1 << effIndex, true, false);
+ else if (GameObject* gobj = target->ToGameObject())
+ AddGOTarget(gobj, 1 << effIndex);
+
SelectImplicitChainTargets(effIndex, targetType, target, 1 << effIndex);
+ }
+ // Script hook can remove object target and we would wrongly land here
+ else if (Item* item = m_targets.GetItemTarget())
+ AddItemTarget(item, 1 << effIndex);
}
void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask)
@@ -1572,14 +1587,15 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
SearchChainTargets(targets, maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType()
, m_spellInfo->Effects[effIndex].ImplicitTargetConditions, targetType.GetTarget() == TARGET_UNIT_TARGET_CHAINHEAL_ALLY);
+ // Chain primary target is added earlier
+ CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
+
// for backward compability
std::list<Unit*> unitTargets;
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (Unit* unitTarget = (*itr)->ToUnit())
unitTargets.push_back(unitTarget);
- CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex);
-
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
AddUnitTarget(*itr, effMask, false);
}
@@ -1623,7 +1639,7 @@ void Spell::SelectImplicitTrajTargets()
float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d);
if (a > -0.0001f)
a = 0;
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: a %f b %f", a, b);)
float bestDist = m_spellInfo->GetMaxRange(false);
@@ -1639,11 +1655,11 @@ void Spell::SelectImplicitTrajTargets()
const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ;
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
float dist = objDist2d - size;
float height = dist * (a * dist + b);
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
if (dist < bestDist && height < dz + size && height > dz - size)
{
bestDist = dist > 0 ? dist : 0;
@@ -1651,7 +1667,7 @@ void Spell::SelectImplicitTrajTargets()
}
#define CHECK_DIST {\
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
if (dist > bestDist)\
continue;\
if (dist < objDist2d + size && dist > objDist2d - size)\
@@ -1713,7 +1729,7 @@ void Spell::SelectImplicitTrajTargets()
float distSq = (*itr)->GetExactDistSq(x, y, z);
float sizeSq = (*itr)->GetObjectSize();
sizeSq *= sizeSq;
- DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
if (distSq > sizeSq)
{
float factor = 1 - sqrt(sizeSq / distSq);
@@ -1722,7 +1738,7 @@ void Spell::SelectImplicitTrajTargets()
z += factor * ((*itr)->GetPositionZ() - z);
distSq = (*itr)->GetExactDistSq(x, y, z);
- DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
}
}
@@ -1742,9 +1758,12 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex)
case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection())
{
- Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection());
- if (target)
- AddUnitTarget(target, 1 << effIndex, false);
+ WorldObject* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection());
+
+ CallScriptObjectTargetSelectHandlers(target, SpellEffIndex(effIndex));
+
+ if (target && target->ToPlayer())
+ AddUnitTarget(target->ToUnit(), 1 << effIndex, false);
}
return;
default:
@@ -1760,6 +1779,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex)
if (!targetMask)
return;
+ WorldObject* target = NULL;
+
switch (m_spellInfo->Effects[effIndex].GetImplicitTargetType())
{
// add explicit object target or self to the target map
@@ -1768,40 +1789,46 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex)
if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK))
{
if (Unit* unitTarget = m_targets.GetUnitTarget())
- AddUnitTarget(unitTarget, 1 << effIndex, false);
+ target = unitTarget;
else if (targetMask & TARGET_FLAG_CORPSE_MASK)
{
if (Corpse* corpseTarget = m_targets.GetCorpseTarget())
{
// TODO: this is a workaround - corpses should be added to spell target map too, but we can't do that so we add owner instead
if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
- AddUnitTarget(owner, 1 << effIndex, false);
+ target = owner;
}
}
else //if (targetMask & TARGET_FLAG_UNIT_MASK)
- {
- AddUnitTarget(m_caster, 1 << effIndex, false);
- }
+ target = m_caster;
}
if (targetMask & TARGET_FLAG_ITEM_MASK)
{
if (Item* itemTarget = m_targets.GetItemTarget())
AddItemTarget(itemTarget, 1 << effIndex);
+ return;
}
if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK)
- {
- if (GameObject* gObjTarget = m_targets.GetGOTarget())
- AddGOTarget(gObjTarget, 1 << effIndex);
- }
+ target = m_targets.GetGOTarget();
break;
// add self to the target map
case EFFECT_IMPLICIT_TARGET_CASTER:
if (targetMask & TARGET_FLAG_UNIT_MASK)
- AddUnitTarget(m_caster, 1 << effIndex, false);
+ target = m_caster;
break;
default:
break;
}
+
+ CallScriptObjectTargetSelectHandlers(target, SpellEffIndex(effIndex));
+
+ if (target)
+ {
+ if (target->ToUnit())
+ AddUnitTarget(target->ToUnit(), 1 << effIndex, false);
+ else if (target->ToGameObject())
+ AddGOTarget(target->ToGameObject(), 1 << effIndex);
+ }
}
uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList)
@@ -2442,13 +2469,13 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
else
procEx |= PROC_EX_NORMAL_HIT;
- // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
- if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
- caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
-
int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit);
unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
m_healing = gain;
+
+ // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
+ caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
}
// Do damage and triggers
else if (m_damage > 0)
@@ -2475,15 +2502,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
}
- caster->DealSpellDamage(&damageInfo, true);
- // Haunt
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1))
- {
- AuraEffect* aurEff = m_spellAura->GetEffect(1);
- aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage));
- }
m_damage = damageInfo.damage;
+
+ caster->DealSpellDamage(&damageInfo, true);
}
// Passive spell hits/misses or active spells only misses (only triggers)
else
@@ -2504,7 +2526,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
}
}
- if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive())
+ if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
{
m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO));
@@ -2548,12 +2570,34 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
return SPELL_MISS_EVADE;
// For delayed spells immunity may be applied between missile launch and hit - check immunity for that case
+ if (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
+ return SPELL_MISS_IMMUNE;
+
// disable effects to which unit is immune
+ SpellMissInfo returnVal = SPELL_MISS_IMMUNE;
for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber)
- if (effectMask & (1 << effectNumber) && unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber))
- effectMask &= ~(1 << effectNumber);
- if (!effectMask || (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo))))
- return SPELL_MISS_IMMUNE;
+ {
+ if (effectMask & (1 << effectNumber))
+ {
+ if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber))
+ effectMask &= ~(1 << effectNumber);
+ else if (m_spellInfo->Effects[effectNumber].IsAura() && !m_spellInfo->IsPositiveEffect(effectNumber))
+ {
+ int32 debuff_resist_chance = unit->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(m_spellInfo->Dispel));
+ debuff_resist_chance += unit->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(m_spellInfo->Dispel));
+
+ if (debuff_resist_chance > 0)
+ if (irand(0,10000) <= (debuff_resist_chance * 100))
+ {
+ effectMask &= ~(1 << effectNumber);
+ returnVal = SPELL_MISS_RESIST;
+ }
+ }
+ }
+ }
+
+ if (!effectMask)
+ return returnVal;
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers();
@@ -3107,13 +3151,13 @@ void Spell::cast(bool skipCheck)
// should be done before the spell is actually executed
sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
- // Let any pets know we've attacked something. As of 3.0.2 pets begin
- // attacking their owner's target immediately
- if (Pet* playerPet = playerCaster->GetPet())
- {
- if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT))
- playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit());
- }
+ // As of 3.0.2 pets begin attacking their owner's target immediately
+ // Let any pets know we've attacked something. Check DmgClass for harmful spells only
+ // This prevents spells such as Hunter's Mark from triggering pet attack
+ if (this->GetSpellInfo()->DmgClass != SPELL_DAMAGE_CLASS_NONE)
+ if (Pet* playerPet = playerCaster->GetPet())
+ if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT))
+ playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit());
}
SetExecutedCurrently(true);
@@ -3432,29 +3476,13 @@ void Spell::_handle_immediate_phase()
return;
// Handle procs on cast
// TODO: finish new proc system:P
- if (m_UniqueTargetInfo.empty())
+ if (m_UniqueTargetInfo.empty() && m_targets.HasDst())
{
uint32 procAttacker = m_procAttacker;
if (!procAttacker)
- {
- bool positive = m_spellInfo->IsPositive();
- switch (m_spellInfo->DmgClass)
- {
- case SPELL_DAMAGE_CLASS_MAGIC:
- if (positive)
- procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS;
- else
- procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG;
- break;
- case SPELL_DAMAGE_CLASS_NONE:
- if (positive)
- procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS;
- else
- procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG;
- break;
- }
- }
- // Proc damage for spells which have only dest targets (2484 should proc 51486 for example)
+ procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS;
+
+ // Proc the spells that have DEST target
m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell);
}
}
@@ -4279,7 +4307,7 @@ void Spell::TakeCastItem()
{
// This code is to avoid a crash
// I'm not sure, if this is really an error, but I guess every item needs a prototype
- sLog->outError("Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
return;
}
@@ -4369,7 +4397,7 @@ void Spell::TakePower()
if (powerType >= MAX_POWERS)
{
- sLog->outError("Spell::TakePower: Unknown power type '%d'", powerType);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::TakePower: Unknown power type '%d'", powerType);
return;
}
@@ -4852,22 +4880,13 @@ SpellCastResult Spell::CheckCast(bool strict)
if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
return SPELL_FAILED_NOT_INFRONT;
- if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
- return SPELL_FAILED_LINE_OF_SIGHT;
- }
- else
- {
- if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster
- {
- // Lay on Hands - cannot be self-cast on paladin with Forbearance or after using Avenging Wrath
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags[0] & 0x0008000)
- if (target->HasAura(61988)) // Immunity shield marker
- return SPELL_FAILED_TARGET_AURASTATE;
- }
+ if (m_caster->GetEntry() != WORLD_TRIGGER) // Ignore LOS for gameobjects casts (wrongly casted by a trigger)
+ if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
+ return SPELL_FAILED_LINE_OF_SIGHT;
}
}
- //Check for line of sight for spells with dest
+ // Check for line of sight for spells with dest
if (m_targets.HasDst())
{
float x, y, z;
@@ -4966,7 +4985,8 @@ SpellCastResult Spell::CheckCast(bool strict)
bool hasDispellableAura = false;
bool hasNonDispelEffect = false;
- for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
+ uint32 dispelMask = 0;
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL)
{
if (m_spellInfo->Effects[i].IsTargetingArea() || m_spellInfo->AttributesEx & SPELL_ATTR1_MELEE_COMBAT_START)
@@ -4974,17 +4994,8 @@ SpellCastResult Spell::CheckCast(bool strict)
hasDispellableAura = true;
break;
}
- if (Unit* target = m_targets.GetUnitTarget())
- {
- DispelChargesList dispelList;
- uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
- target->GetDispellableAuraList(m_caster, dispelMask, dispelList);
- if (!dispelList.empty())
- {
- hasDispellableAura = true;
- break;
- }
- }
+
+ dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
else if (m_spellInfo->Effects[i].IsEffect())
{
@@ -4992,57 +5003,22 @@ SpellCastResult Spell::CheckCast(bool strict)
break;
}
- if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL) && !IsTriggered())
- return SPELL_FAILED_NOTHING_TO_DISPEL;
+ if (!hasNonDispelEffect && !hasDispellableAura && dispelMask && !IsTriggered())
+ {
+ if (Unit* target = m_targets.GetUnitTarget())
+ {
+ DispelChargesList dispelList;
+ target->GetDispellableAuraList(m_caster, dispelMask, dispelList);
+ if (dispelList.empty())
+ return SPELL_FAILED_NOTHING_TO_DISPEL;
+ }
+ }
- for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// for effects of spells that have only one target
switch (m_spellInfo->Effects[i].Effect)
{
- case SPELL_EFFECT_DUMMY:
- {
- if (m_spellInfo->Id == 51582) // Rocket Boots Engaged
- {
- if (m_caster->IsInWater())
- return SPELL_FAILED_ONLY_ABOVEWATER;
- }
- else if (m_spellInfo->SpellIconID == 156) // Holy Shock
- {
- // spell different for friends and enemies
- // hurt version required facing
- if (m_targets.GetUnitTarget() && !m_caster->IsFriendlyTo(m_targets.GetUnitTarget()) && !m_caster->HasInArc(static_cast<float>(M_PI), m_targets.GetUnitTarget()))
- return SPELL_FAILED_UNIT_NOT_INFRONT;
- }
- else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] == 0x2000) // Death Coil (DeathKnight)
- {
- Unit* target = m_targets.GetUnitTarget();
- if (!target || (target->IsFriendlyTo(m_caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD))
- return SPELL_FAILED_BAD_TARGETS;
- }
- else if (m_spellInfo->Id == 19938) // Awaken Peon
- {
- Unit* unit = m_targets.GetUnitTarget();
- if (!unit || !unit->HasAura(17743))
- return SPELL_FAILED_BAD_TARGETS;
- }
- else if (m_spellInfo->Id == 52264) // Deliver Stolen Horse
- {
- if (!m_caster->FindNearestCreature(28653, 5))
- return SPELL_FAILED_OUT_OF_RANGE;
- }
- else if (m_spellInfo->Id == 31789) // Righteous Defense
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return SPELL_FAILED_DONT_REPORT;
-
- Unit* target = m_targets.GetUnitTarget();
- if (!target || !target->IsFriendlyTo(m_caster) || target->getAttackers().empty())
- return SPELL_FAILED_BAD_TARGETS;
-
- }
- break;
- }
case SPELL_EFFECT_LEARN_SPELL:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -5359,12 +5335,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_LEAP_BACK:
{
- // Spell 781 (Disengage) requires player to be in combat
- if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat())
- return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
-
- Unit* target = m_targets.GetUnitTarget();
- if (m_caster == target && m_caster->HasUnitState(UNIT_STATE_ROOT))
+ if (m_caster->HasUnitState(UNIT_STATE_ROOT))
{
if (m_caster->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_ROOTED;
@@ -5385,66 +5356,10 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}
- for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (m_spellInfo->Effects[i].ApplyAuraName)
{
- case SPELL_AURA_DUMMY:
- {
- //custom check
- switch (m_spellInfo->Id)
- {
- // Tag Murloc
- case 30877:
- {
- Unit* target = m_targets.GetUnitTarget();
- if (!target || target->GetEntry() != 17326)
- return SPELL_FAILED_BAD_TARGETS;
- break;
- }
- case 61336:
- if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm())
- return SPELL_FAILED_ONLY_SHAPESHIFT;
- break;
- case 1515:
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return SPELL_FAILED_BAD_TARGETS;
-
- if (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER)
- return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
-
- Creature* target = m_targets.GetUnitTarget()->ToCreature();
-
- if (target->getLevel() > m_caster->getLevel())
- return SPELL_FAILED_HIGHLEVEL;
-
- // use SMSG_PET_TAME_FAILURE?
- if (!target->GetCreatureTemplate()->isTameable (m_caster->ToPlayer()->CanTameExoticPets()))
- return SPELL_FAILED_BAD_TARGETS;
-
- if (m_caster->GetPetGUID())
- return SPELL_FAILED_ALREADY_HAVE_SUMMON;
-
- if (m_caster->GetCharmGUID())
- return SPELL_FAILED_ALREADY_HAVE_CHARM;
-
- break;
- }
- case 44795: // Parachute
- {
- float x, y, z;
- m_caster->GetPosition(x, y, z);
- float ground_Z = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z);
- if (fabs(ground_Z - z) < 0.1f)
- return SPELL_FAILED_DONT_REPORT;
- break;
- }
- default:
- break;
- }
- break;
- }
case SPELL_AURA_MOD_POSSESS_PET:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -5529,8 +5444,9 @@ SpellCastResult Spell::CheckCast(bool strict)
// allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive())
{
- if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
- if (pArea->flags & AREA_FLAG_NO_FLY_ZONE)
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
+ if (AreaTableEntry const* area = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
+ if (area->flags & AREA_FLAG_NO_FLY_ZONE || (Bf && !Bf->CanFlyIn()))
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
}
break;
@@ -5631,7 +5547,7 @@ SpellCastResult Spell::CheckCasterAuras() const
// We use bitmasks so the loop is done only once and not on every aura check below.
if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
@@ -5699,7 +5615,7 @@ SpellCastResult Spell::CheckCasterAuras() const
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune)
continue;
- if (auraInfo->GetSchoolMask() & school_immune)
+ if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
continue;
if (auraInfo->GetDispelMask() & dispel_immune)
continue;
@@ -5861,7 +5777,7 @@ SpellCastResult Spell::CheckPower()
// Check valid power type
if (m_spellInfo->PowerType >= MAX_POWERS)
{
- sLog->outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
return SPELL_FAILED_UNKNOWN;
}
@@ -6425,7 +6341,7 @@ void Spell::Delayed() // only called in DealDamage()
else
m_timer += delaytime;
- sLog->outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
WorldPacket data(SMSG_SPELL_DELAYED, 8+4);
data.append(m_caster->GetPackGUID());
@@ -6641,7 +6557,7 @@ SpellEvent::~SpellEvent()
}
else
{
- sLog->outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id);
ASSERT(false);
}
@@ -7162,15 +7078,29 @@ void Spell::CallScriptAfterHitHandlers()
}
}
-void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex)
+void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex)
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
- (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT);
- std::list<SpellScript::UnitTargetHandler>::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin();
+ (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT);
+ std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin();
for (; hookItr != hookItrEnd; ++hookItr)
if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
- (*hookItr).Call(*scritr, unitTargets);
+ (*hookItr).Call(*scritr, targets);
+
+ (*scritr)->_FinishScriptCall();
+ }
+}
+
+void Spell::CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex)
+{
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
+ {
+ (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT);
+ std::list<SpellScript::ObjectTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin();
+ for (; hookItr != hookItrEnd; ++hookItr)
+ if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
+ (*hookItr).Call(*scritr, target);
(*scritr)->_FinishScriptCall();
}
@@ -7204,12 +7134,6 @@ void Spell::PrepareTriggersExecutedOnHit()
// todo: move this to scripts
switch (m_spellInfo->SpellFamilyName)
{
- case SPELLFAMILY_GENERIC:
- {
- if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages
- m_preCastSpell = 11196; // Recently Bandaged
- break;
- }
case SPELLFAMILY_MAGE:
{
// Permafrost
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 8f43b9b2290..1376b0fbd40 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -630,7 +630,8 @@ class Spell
void CallScriptBeforeHitHandlers();
void CallScriptOnHitHandlers();
void CallScriptAfterHitHandlers();
- void CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex);
+ void CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex);
+ void CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex);
std::list<SpellScript*> m_loadedScripts;
struct HitTriggerSpell
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 4e05c9fdac2..11356e8b155 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -353,60 +353,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
return;
break;
}
- case 33671: // gruul's shatter
- case 50811: // krystallus shatter ( Normal )
- case 61547: // krystallus shatter ( Heroic )
- {
- // don't damage self and only players
- if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster);
- if (!radius)
- return;
- float distance = m_caster->GetDistance2d(unitTarget);
- damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * ((radius - distance)/radius));
- break;
- }
- // Loken Pulsing Shockwave
- case 59837:
- case 52942:
- {
- // don't damage self and only players
- if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster);
- if (!radius)
- return;
- float distance = m_caster->GetDistance2d(unitTarget);
- damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * distance);
- break;
- }
- // TODO: add spell specific target requirement hook for spells
- // Shadowbolts only affects targets with Shadow Mark (Gothik)
- case 27831:
- case 55638:
- if (!unitTarget->HasAura(27825))
- return;
- break;
- // Cataclysmic Bolt
- case 38441:
- {
- damage = unitTarget->CountPctFromMaxHealth(50);
- break;
- }
- case 20625: // Ritual of Doom Sacrifice
- case 29142: // Eyesore Blaster
- case 35139: // Throw Boom's Doom
- case 42393: // Brewfest - Attack Keg
- case 55269: // Deathly Stare
- case 56578: // Rapid-Fire Harpoon
- case 62775: // Tympanic Tantrum
- {
- damage = unitTarget->CountPctFromMaxHealth(damage);
- break;
- }
// Gargoyle Strike
case 51963:
{
@@ -419,11 +365,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
case SPELLFAMILY_WARRIOR:
{
- // Bloodthirst
- if (m_spellInfo->SpellFamilyFlags[1] & 0x400)
- ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
// Shield Slam
- else if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209)
{
uint8 level = m_caster->getLevel();
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f));
@@ -484,7 +427,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (aura)
{
uint32 pdamage = uint32(std::max(aura->GetAmount(), 0));
- pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
+ pdamage = m_caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
+ pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1));
uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude);
damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir));
@@ -519,19 +463,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
case SPELLFAMILY_PRIEST:
{
- // Shadow Word: Death - deals damage equal to damage done to caster
- if (m_spellInfo->SpellFamilyFlags[1] & 0x2)
- {
- int32 back_damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
- // Pain and Suffering reduces damage
- if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0))
- AddPctN(back_damage, -aurEff->GetAmount());
-
- if (back_damage < int32(unitTarget->GetHealth()))
- m_caster->CastCustomSpell(m_caster, 32409, &back_damage, 0, 0, true);
- }
// Improved Mind Blast (Mind Blast in shadow form bonus)
- else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
+ if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
{
Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER);
for (Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i)
@@ -666,19 +599,19 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (found)
damage += m_spellInfo->Effects[EFFECT_1].CalcValue();
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Player* caster = m_caster->ToPlayer())
{
// Add Ammo and Weapon damage plus RAP * 0.1
- Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
- if (item)
+ if (Item* item = caster->GetWeaponForAttack(RANGED_ATTACK))
{
- float dmg_min = item->GetTemplate()->Damage->DamageMin;
- float dmg_max = item->GetTemplate()->Damage->DamageMax;
+ ItemTemplate const* weaponTemplate = item->GetTemplate();
+ float dmg_min = weaponTemplate->Damage[0].DamageMin;
+ float dmg_max = weaponTemplate->Damage[0].DamageMax;
if (dmg_max == 0.0f && dmg_min > dmg_max)
damage += int32(dmg_min);
else
damage += irand(int32(dmg_min), int32(dmg_max));
- damage += int32(m_caster->ToPlayer()->GetAmmoDPS()*item->GetTemplate()->Delay*0.001f);
+ damage += int32(caster->GetAmmoDPS() * weaponTemplate->Delay * 0.001f);
}
}
}
@@ -729,7 +662,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
if (m_originalCaster && damage > 0 && apply_direct_bonus)
- damage = m_originalCaster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
+ {
+ damage = m_originalCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
+ damage = unitTarget->SpellDamageBonusTaken(m_originalCaster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
+ }
m_damage += damage;
}
@@ -828,7 +764,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (!spellInfo)
{
- sLog->outError("EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);
return;
}
@@ -1086,7 +1022,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex)
if (!spellInfo)
{
- sLog->outError("Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
return;
}
@@ -1102,10 +1038,6 @@ void Spell::EffectForceCast(SpellEffIndex effIndex)
case 52349: // Overtake
unitTarget->CastCustomSpell(unitTarget, spellInfo->Id, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID);
return;
- case 72378: // Blood Nova
- case 73058: // Blood Nova
- m_caster->CastSpell(unitTarget, damage, true); // additional spell cast
- break;
}
}
@@ -1135,7 +1067,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
if (!spellInfo)
{
- sLog->outError("EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
return;
}
@@ -1244,7 +1176,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
// If not exist data for dest location - return
if (!m_targets.HasDst())
{
- sLog->outError("Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id);
return;
}
@@ -1412,7 +1344,8 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
return;
// add spell damage bonus
- damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
+ damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
+ damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
int32 power = damage;
@@ -1569,13 +1502,13 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
if (!targetAura)
{
- sLog->outError("Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
return;
}
int32 tickheal = targetAura->GetAmount();
if (Unit* auraCaster = targetAura->GetCaster())
- tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT);
+ tickheal = auraCaster->SpellHealingBonusDone(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT);
//int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1;
//It is said that talent bonus should not be included
@@ -1596,11 +1529,12 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
//addhealth += tickheal * tickcount;
//addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth, HEAL, unitTarget);
}
- // Glyph of Nourish
+ // Nourish
else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x2000000)
{
- addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
+ addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
+ // Glyph of Nourish
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0))
{
Unit::AuraEffectList const& Periodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL);
@@ -1611,14 +1545,13 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
}
}
}
- // Lifebloom - final heal coef multiplied by original DoT stack
- else if (m_spellInfo->Id == 33778)
- addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL, m_spellValue->EffectBasePoints[1]);
// Death Pact - return pct of max health to caster
else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000)
- addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL);
+ addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL);
else
- addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
+ addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL);
+
+ addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL);
// Remove Grievious bite if fully healed
if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth()))
@@ -1644,7 +1577,10 @@ void Spell::EffectHealPct(SpellEffIndex /*effIndex*/)
if (m_spellInfo->Id == 59754 && unitTarget == m_caster)
return;
- m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL);
+ uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL);
+ heal = unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL);
+
+ m_healing += heal;
}
void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/)
@@ -1659,7 +1595,9 @@ void Spell::EffectHealMechanical(SpellEffIndex /*effIndex*/)
if (!m_originalCaster)
return;
- m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL);
+ uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, uint32(damage), HEAL);
+
+ m_healing += unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL);
}
void Spell::EffectHealthLeech(SpellEffIndex effIndex)
@@ -1670,7 +1608,8 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex)
if (!unitTarget || !unitTarget->isAlive() || damage < 0)
return;
- damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
+ damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
+ damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage);
@@ -1682,7 +1621,9 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex)
if (m_caster->isAlive())
{
- healthGain = m_caster->SpellHealingBonus(m_caster, m_spellInfo, healthGain, HEAL);
+ healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL);
+ healthGain = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, HEAL);
+
m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain));
}
}
@@ -2036,7 +1977,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
// Players shouldn't be able to loot gameobjects that are currently despawned
if (!gameObjTarget->isSpawned() && !player->isGameMaster())
{
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!",
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!",
player->GetName(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow());
return;
}
@@ -2334,7 +2275,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB);
if (!properties)
{
- sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);
return;
}
@@ -2452,7 +2393,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
if (properties->Category == SUMMON_CATEGORY_ALLY)
{
- summon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_originalCaster->GetGUID());
+ summon->SetOwnerGUID(m_originalCaster->GetGUID());
summon->setFaction(m_originalCaster->getFaction());
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
}
@@ -2479,12 +2420,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
return;
// The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
- uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED;
- if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()))
- spell = spellProto->Id;
+ uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue());
+ if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
+ spellId = spellInfo->Id;
// Hard coded enter vehicle spell
- m_originalCaster->CastSpell(summon, spell, true);
+ m_originalCaster->CastSpell(summon, spellId, true);
uint32 faction = properties->Faction;
if (!faction)
@@ -2857,6 +2799,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
// add new enchanting if equipped
item_owner->ApplyEnchantment(itemTarget, PERM_ENCHANTMENT_SLOT, true);
+ item_owner->RemoveTradeableItem(itemTarget);
itemTarget->ClearSoulboundTradeable(item_owner);
}
}
@@ -2894,7 +2837,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
}
if (!add_socket)
{
- sLog->outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.",
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.",
m_spellInfo->Id, SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET);
return;
}
@@ -2921,6 +2864,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
// add new enchanting if equipped
item_owner->ApplyEnchantment(itemTarget, PRISMATIC_ENCHANTMENT_SLOT, true);
+ item_owner->RemoveTradeableItem(itemTarget);
itemTarget->ClearSoulboundTradeable(item_owner);
}
@@ -2959,14 +2903,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
case 10: spell_id = 36758; break; // 14%
case 11: spell_id = 36760; break; // 20%
default:
- sLog->outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage);
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
- sLog->outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
return;
}
@@ -2993,14 +2937,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
if (!enchant_id)
{
- sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex);
return;
}
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant)
{
- sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id);
return;
}
@@ -3324,6 +3268,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
fixed_bonus += (aur->GetStackAmount() - 1) * CalculateDamage(2, unitTarget);
}
}
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x8000000) // Mocking Blow
+ {
+ if (unitTarget->IsImmunedToSpellEffect(m_spellInfo,EFFECT_1) || unitTarget->GetTypeId() == TYPEID_PLAYER)
+ {
+ m_damage = 0;
+ return;
+ }
+ }
break;
}
case SPELLFAMILY_ROGUE:
@@ -3376,7 +3328,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
if (m_spellInfo->Id == 20467)
{
spell_bonus += int32(0.08f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
- spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()));
+ spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()));
}
break;
}
@@ -3424,7 +3376,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// Blood Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x400000)
{
- AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f);
+ float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
+ // Death Knight T8 Melee 4P Bonus
+ if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
+ AddPctF(bonusPct, aurEff->GetAmount());
+ AddPctF(totalDamagePercentMod, bonusPct);
// Glyph of Blood Strike
if (m_caster->GetAuraEffect(59332, EFFECT_0))
@@ -3451,7 +3407,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
if (roll_chance_i(aurEff->GetAmount()))
consumeDiseases = false;
- AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f);
+ float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f;
+ // Death Knight T8 Melee 4P Bonus
+ if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
+ AddPctF(bonusPct, aurEff->GetAmount());
+ AddPctF(totalDamagePercentMod, bonusPct);
break;
}
// Blood-Caked Strike - Blood-Caked Blade
@@ -3463,7 +3423,12 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// Heart Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000)
{
- AddPctN(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()));
+ float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
+ // Death Knight T8 Melee 4P Bonus
+ if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
+ AddPctF(bonusPct, aurEff->GetAmount());
+
+ AddPctF(totalDamagePercentMod, bonusPct);
break;
}
break;
@@ -3545,8 +3510,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
uint32 eff_damage(std::max(weaponDamage, 0));
// Add melee damage bonuses (also check for negative)
- m_caster->MeleeDamageBonus(unitTarget, &eff_damage, m_attackType, m_spellInfo);
- m_damage += eff_damage;
+ uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo);
+
+ m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo);
}
void Spell::EffectThreat(SpellEffIndex /*effIndex*/)
@@ -3571,16 +3537,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/)
if (!unitTarget || !unitTarget->isAlive())
return;
- int32 addhealth;
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands
- {
- if (m_caster->GetGUID() == unitTarget->GetGUID())
- {
- m_caster->CastSpell(m_caster, 25771, true); // Forbearance
- m_caster->CastSpell(m_caster, 61988, true); // Immune shield marker (serverside)
- m_caster->CastSpell(m_caster, 61987, true); // Avenging Wrath marker
- }
- }
+ int32 addhealth = 0;
// damage == 0 - heal for caster max health
if (damage == 0)
@@ -3588,8 +3545,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/)
else
addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
- if (m_originalCaster)
- m_healing += m_originalCaster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
+ m_healing += addhealth;
}
void Spell::EffectInterruptCast(SpellEffIndex effIndex)
@@ -3617,8 +3573,8 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
{
if (m_originalCaster)
{
- int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false, 1 << effIndex);
- unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), duration/*GetSpellDuration(m_spellInfo)*/);
+ int32 duration = m_spellInfo->GetDuration();
+ unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effIndex));
}
ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id);
unitTarget->InterruptSpell(CurrentSpellTypes(i), false);
@@ -3812,12 +3768,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- uint32 spell_id = 0;
- switch (urand(1, 5))
- {
- case 1: spell_id = 8854; break;
- default: spell_id = 8855; break;
- }
+ uint32 spell_id = roll_chance_i(20) ? 8854 : 8855;
m_caster->CastSpell(m_caster, spell_id, true, NULL);
return;
@@ -3864,10 +3815,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE);
return;
}
- // Escape artist
- case 20589:
- m_caster->RemoveMovementImpairingAuras();
- return;
// Decimate
case 28374:
case 54426:
@@ -3898,15 +3845,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
DoCreateItem(effIndex, item);
break;
}
- // Improved Sprint
- case 30918:
- {
- // Removes snares and roots.
- unitTarget->RemoveMovementImpairingAuras();
- break;
- }
- // Spirit Walk
- case 58876:
+ case 20589: // Escape artist
+ case 30918: // Improved Sprint
{
// Removes snares and roots.
unitTarget->RemoveMovementImpairingAuras();
@@ -3924,96 +3864,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
}
break;
- case 48025: // Headless Horseman's Mount
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill and zone
- bool canFly = true;
- uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
- if (v_map != 530 && v_map != 571)
- canFly = false;
-
- if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
- canFly = false;
-
- float x, y, z;
- unitTarget->GetPosition(x, y, z);
- uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
- AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
- if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
- canFly = false;
-
- switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
- {
- case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;
- case 150: unitTarget->CastSpell(unitTarget, 48024, true); break;
- case 225:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 51617, true);
- else
- unitTarget->CastSpell(unitTarget, 48024, true);
- }break;
- case 300:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 48023, true);
- else
- unitTarget->CastSpell(unitTarget, 48024, true);
- }break;
- }
- return;
- }
- case 47977: // Magic Broom
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill and zone
- bool canFly = true;
- uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
- if (v_map != 530 && v_map != 571)
- canFly = false;
-
- if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
- canFly = false;
-
- float x, y, z;
- unitTarget->GetPosition(x, y, z);
- uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
- AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
- if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
- canFly = false;
-
- switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
- {
- case 75: unitTarget->CastSpell(unitTarget, 42680, true); break;
- case 150: unitTarget->CastSpell(unitTarget, 42683, true); break;
- case 225:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 42667, true);
- else
- unitTarget->CastSpell(unitTarget, 42683, true);
- }break;
- case 300:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 42668, true);
- else
- unitTarget->CastSpell(unitTarget, 42683, true);
- }break;
- }
- return;
- }
// Mug Transformation
case 41931:
{
@@ -4205,25 +4055,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
if (unitTarget)
unitTarget->CastSpell(m_caster, damage, true);
return;
- // Winged Steed of the Ebon Blade
- case 54729:
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill
- if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
- {
- if (skillval >= 300)
- unitTarget->CastSpell(unitTarget, 54727, true);
- else
- unitTarget->CastSpell(unitTarget, 54726, true);
- }
- return;
- }
case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -4306,188 +4137,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->CastSpell(m_caster, 63919, true);
return;
}
- case 71342: // Big Love Rocket
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill and zone
- bool canFly = true;
- uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
- if (v_map != 530 && v_map != 571)
- canFly = false;
-
- if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
- canFly = false;
-
- float x, y, z;
- unitTarget->GetPosition(x, y, z);
- uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
- AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
- if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
- canFly = false;
-
- switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
- {
- case 0: unitTarget->CastSpell(unitTarget, 71343, true); break;
- case 75: unitTarget->CastSpell(unitTarget, 71344, true); break;
- case 150: unitTarget->CastSpell(unitTarget, 71345, true); break;
- case 225:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 71346, true);
- else
- unitTarget->CastSpell(unitTarget, 71345, true);
- }break;
- case 300:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 71347, true);
- else
- unitTarget->CastSpell(unitTarget, 71345, true);
- }break;
- }
- return;
- }
- case 72286: // Invincible
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill and zone
- bool canFly = true;
- uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
- if (v_map != 530 && v_map != 571)
- canFly = false;
-
- if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
- canFly = false;
-
- float x, y, z;
- unitTarget->GetPosition(x, y, z);
- uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
- AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
- if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
- canFly = false;
-
- switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
- {
- case 75: unitTarget->CastSpell(unitTarget, 72281, true); break;
- case 150: unitTarget->CastSpell(unitTarget, 72282, true); break;
- case 225:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 72283, true);
- else
- unitTarget->CastSpell(unitTarget, 72282, true);
- }break;
- case 300:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 72284, true);
- else
- unitTarget->CastSpell(unitTarget, 72282, true);
- }break;
- }
- return;
- }
- case 74856: // Blazing Hippogryph
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill
- if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
- {
- if (skillval >= 300)
- unitTarget->CastSpell(unitTarget, 74855, true);
- else
- unitTarget->CastSpell(unitTarget, 74854, true);
- }
- return;
- }
- case 75614: // Celestial Steed
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts and client crashes upon dismounting
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill and zone
- bool canFly = true;
- uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
- if (v_map != 530 && v_map != 571)
- canFly = false;
-
- if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
- canFly = false;
-
- float x, y, z;
- unitTarget->GetPosition(x, y, z);
- uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
- AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
- if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
- canFly = false;
-
- switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
- {
- case 75: unitTarget->CastSpell(unitTarget, 75619, true); break;
- case 150: unitTarget->CastSpell(unitTarget, 75620, true); break;
- case 225:
- {
- if (canFly)
- unitTarget->CastSpell(unitTarget, 75617, true);
- else
- unitTarget->CastSpell(unitTarget, 75620, true);
- }break;
- case 300:
- {
- if (canFly)
- {
- if (unitTarget->ToPlayer()->Has310Flyer(false))
- unitTarget->CastSpell(unitTarget, 76153, true);
- else
- unitTarget->CastSpell(unitTarget, 75618, true);
- }
- else
- unitTarget->CastSpell(unitTarget, 75620, true);
- }break;
- }
- return;
- }
- case 75973: // X-53 Touring Rocket
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Prevent stacking of mounts
- unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // Triggered spell id dependent on riding skill
- if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
- {
- if (skillval >= 300)
- {
- if (unitTarget->ToPlayer()->Has310Flyer(false))
- unitTarget->CastSpell(unitTarget, 76154, true);
- else
- unitTarget->CastSpell(unitTarget, 75972, true);
- }
- else
- unitTarget->CastSpell(unitTarget, 75957, true);
- }
- return;
- }
case 59317: // Teleporting
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4547,7 +4196,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 31893: spell_heal = 48084; break;
case 31883: spell_heal = 48085; break;
default:
- sLog->outError("Unknown Lightwell spell caster %u", m_caster->GetEntry());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown Lightwell spell caster %u", m_caster->GetEntry());
return;
}
@@ -4664,7 +4313,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 57774: spellId1 = 20185; break; // Judgement of Light
case 53408: spellId1 = 20186; break; // Judgement of Wisdom
default:
- sLog->outError("Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id);
return;
}
// all seals have aura dummy in 2 effect
@@ -4937,7 +4586,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/)
Player* target = (Player*)m_caster;
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell Effect: Stuck");
- sLog->outDetail("Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", target->GetName(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", target->GetName(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
if (target->isInFlight())
return;
@@ -5103,16 +4752,14 @@ void Spell::EffectDisEnchant(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- Player* p_caster = (Player*)m_caster;
if (!itemTarget || !itemTarget->GetTemplate()->DisenchantID)
return;
- p_caster->UpdateCraftSkill(m_spellInfo->Id);
-
- m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING);
+ if (Player* caster = m_caster->ToPlayer())
+ {
+ caster->UpdateCraftSkill(m_spellInfo->Id);
+ caster->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING);
+ }
// item will be removed at disenchanting end
}
@@ -5125,16 +4772,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- Player* player = (Player*)unitTarget;
- uint16 currentDrunk = player->GetDrunkValue();
- uint16 drunkMod = damage * 256;
- if (currentDrunk + drunkMod > 0xFFFF)
+ Player* player = unitTarget->ToPlayer();
+ uint8 currentDrunk = player->GetDrunkValue();
+ uint8 drunkMod = damage;
+ if (currentDrunk + drunkMod > 100)
{
- currentDrunk = 0xFFFF;
- player->CastSpell(player, 67468, false);
+ currentDrunk = 100;
+ if (rand_chance() < 25.0f)
+ player->CastSpell(player, 67468, false); // Drunken Vomit
}
else
currentDrunk += drunkMod;
+
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}
@@ -5546,6 +5195,10 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss())
return;
+ // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT/STUN
+ if (unitTarget->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
+ return;
+
// Typhoon
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x01000000)
{
@@ -5730,9 +5383,9 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/)
}
if (!pet)
return;
-
+
player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation());
-
+
pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
pet->setDeathState(ALIVE);
@@ -5852,7 +5505,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (!goinfo)
{
- sLog->outErrorDb("Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id);
return;
}
@@ -5956,7 +5609,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, pGameObj);
- sLog->outStaticDebug("AddObject at SpellEfects.cpp EffectTransmitted");
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AddObject at SpellEfects.cpp EffectTransmitted");
//m_caster->AddGameObject(pGameObj);
//m_ObjToDel.push_back(pGameObj);
@@ -6499,7 +6152,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex)
if (!sSoundEntriesStore.LookupEntry(soundid))
{
- sLog->outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
return;
}
@@ -6543,6 +6196,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
case 58730: // Restricted Flight Area
case 58600: // Restricted Flight Area
unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
+ unitTarget->PlayDirectSound(9417); // Fel Reaver sound
break;
}
@@ -6550,7 +6204,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
if (!sSoundEntriesStore.LookupEntry(soundid))
{
- sLog->outError("EffectPlayerNotification: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectPlayerNotification: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
return;
}
@@ -6660,7 +6314,7 @@ void Spell::EffectBind(SpellEffIndex effIndex)
SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id);
if (!st)
{
- sLog->outError("Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id);
return;
}
@@ -6688,11 +6342,11 @@ void Spell::EffectBind(SpellEffIndex effIndex)
data << uint32(area_id);
player->SendDirectMessage(&data);
- sLog->outStaticDebug("New homebind X : %f", loc.m_positionX);
- sLog->outStaticDebug("New homebind Y : %f", loc.m_positionY);
- sLog->outStaticDebug("New homebind Z : %f", loc.m_positionZ);
- sLog->outStaticDebug("New homebind MapId : %u", loc.m_mapId);
- sLog->outStaticDebug("New homebind AreaId : %u", area_id);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind X : %f", loc.m_positionX);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Y : %f", loc.m_positionY);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind Z : %f", loc.m_positionZ);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind MapId : %u", loc.m_mapId);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "New homebind AreaId : %u", area_id);
// zone update
data.Initialize(SMSG_PLAYERBOUND, 8+4);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 07ab71207f1..7b3f9a1bef9 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -351,7 +351,7 @@ bool SpellEffectInfo::IsEffect() const
bool SpellEffectInfo::IsEffect(SpellEffects effectName) const
{
- return Effect == effectName;
+ return Effect == uint32(effectName);
}
bool SpellEffectInfo::IsAura() const
@@ -450,6 +450,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
if (!basePointsPerLevel && (_spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION && _spellInfo->SpellLevel) &&
Effect != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
Effect != SPELL_EFFECT_KNOCK_BACK &&
+ Effect != SPELL_EFFECT_ADD_EXTRA_ATTACKS &&
ApplyAuraName != SPELL_AURA_MOD_SPEED_ALWAYS &&
ApplyAuraName != SPELL_AURA_MOD_SPEED_NOT_STACK &&
ApplyAuraName != SPELL_AURA_MOD_INCREASE_SPEED &&
@@ -1261,7 +1262,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
if (!shapeInfo)
{
- sLog->outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
return SPELL_CAST_OK;
}
actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells
@@ -1735,6 +1736,7 @@ AuraStateType SpellInfo::GetAuraState() const
switch (Id)
{
case 71465: // Divine Surge
+ case 50241: // Evasive Charges
return AURA_STATE_UNKNOWN22;
default:
break;
@@ -1972,6 +1974,33 @@ uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const
return (castTime > 0) ? uint32(castTime) : 0;
}
+uint32 SpellInfo::GetMaxTicks() const
+{
+ int32 DotDuration = GetDuration();
+ if (DotDuration == 0)
+ return 1;
+
+ // 200% limit
+ if (DotDuration > 30000)
+ DotDuration = 30000;
+
+ for (uint8 x = 0; x < MAX_SPELL_EFFECTS; x++)
+ {
+ if (Effects[x].Effect == SPELL_EFFECT_APPLY_AURA)
+ switch (Effects[x].ApplyAuraName)
+ {
+ case SPELL_AURA_PERIODIC_DAMAGE:
+ case SPELL_AURA_PERIODIC_HEAL:
+ case SPELL_AURA_PERIODIC_LEECH:
+ if (Effects[x].Amplitude != 0)
+ return DotDuration / Effects[x].Amplitude;
+ break;
+ }
+ }
+
+ return 6;
+}
+
uint32 SpellInfo::GetRecoveryTime() const
{
return RecoveryTime > CategoryRecoveryTime ? RecoveryTime : CategoryRecoveryTime;
@@ -1988,7 +2017,7 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
// Else drain all power
if (PowerType < MAX_POWERS)
return caster->GetPower(Powers(PowerType));
- sLog->outError("SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id);
return 0;
}
@@ -2017,7 +2046,7 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Not implemented yet!");
break;
default:
- sLog->outError("CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id);
return 0;
}
}
@@ -2176,14 +2205,15 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELLFAMILY_GENERIC:
switch (Id)
{
+ case 29214: // Wrath of the Plaguebringer
case 34700: // Allergic Reaction
+ case 54836: // Wrath of the Plaguebringer
case 61987: // Avenging Wrath Marker
case 61988: // Divine Shield exclude aura
- case 62532: // Conservator's Grip
return false;
+ case 30877: // Tag Murloc
case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny
- case 30877: // Tag Murloc
case 62344: // Fists of Stone
return true;
default:
@@ -2269,6 +2299,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELL_EFFECT_HEAL_PCT:
case SPELL_EFFECT_ENERGIZE_PCT:
return true;
+ case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
+ return false;
// non-positive aura use
case SPELL_EFFECT_APPLY_AURA:
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index b82f7dbd61d..54430cd7116 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -440,6 +440,8 @@ public:
int32 GetDuration() const;
int32 GetMaxDuration() const;
+ uint32 GetMaxTicks() const;
+
uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const;
uint32 GetRecoveryTime() const;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index cf200f19010..5493f1a2649 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -30,6 +30,8 @@
#include "CreatureAI.h"
#include "MapManager.h"
#include "BattlegroundIC.h"
+#include "BattlefieldWG.h"
+#include "BattlefieldMgr.h"
bool IsPrimaryProfessionSkill(uint32 skill)
{
@@ -370,7 +372,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (player)
ChatHandler(player).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
else
- sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
+ sLog->outError(LOG_FILTER_SQL, "Craft spell %u not have create item entry.", spellInfo->Id);
}
return false;
}
@@ -384,7 +386,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (player)
ChatHandler(player).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
else
- sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ sLog->outError(LOG_FILTER_SQL, "Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
}
return false;
}
@@ -402,7 +404,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (player)
ChatHandler(player).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
else
- sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
}
return false;
}
@@ -422,7 +424,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (player)
ChatHandler(player).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
else
- sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
+ sLog->outError(LOG_FILTER_SQL, "Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
}
return false;
}
@@ -454,7 +456,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
if (mode >= MAX_DIFFICULTY)
{
- sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
return spellId; //return source spell
}
@@ -477,7 +479,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
if (difficultyEntry->SpellID[mode] <= 0)
{
- sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
+ sLog->outError(LOG_FILTER_SQL, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
return spellId;
}
@@ -1120,6 +1122,16 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
break;
}
+ case 58730: // No fly Zone - Wintergrasp
+ {
+ if (!player)
+ return false;
+
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+ if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
+ return false;
+ break;
+ }
case 68719: // Oil Refinery - Isle of Conquest.
case 68720: // Quarry - Isle of Conquest.
{
@@ -1135,6 +1147,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
}
+ case 56618: // Horde Controls Factory Phase Shift
+ case 56617: // Alliance Controls Factory Phase Shift
+ {
+ if (!player)
+ return false;
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+
+ if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
+ return false;
+
+ // team that controls the workshop in the specified area
+ uint32 team = bf->GetData(newArea);
+
+ if (team == TEAM_HORDE)
+ return spellId == 56618;
+ else if (team == TEAM_ALLIANCE)
+ return spellId == 56617;
+ }
+ break;
}
return true;
@@ -1155,8 +1187,8 @@ void SpellMgr::LoadSpellRanks()
if (!result)
{
- sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
+
return;
}
@@ -1195,13 +1227,13 @@ void SpellMgr::LoadSpellRanks()
SpellInfo const* first = GetSpellInfo(lastSpell);
if (!first)
{
- sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
continue;
}
// check if chain is long enough
if (rankChain.size() < 2)
{
- sLog->outErrorDb("There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell);
+ sLog->outError(LOG_FILTER_SQL, "There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell);
continue;
}
int32 curRank = 0;
@@ -1212,14 +1244,14 @@ void SpellMgr::LoadSpellRanks()
SpellInfo const* spell = GetSpellInfo(itr->first);
if (!spell)
{
- sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
valid = false;
break;
}
++curRank;
if (itr->second != curRank)
{
- sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank);
valid = false;
break;
}
@@ -1251,8 +1283,8 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
- sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SpellMgr::LoadSpellRequired()
@@ -1267,8 +1299,8 @@ void SpellMgr::LoadSpellRequired()
if (!result)
{
- sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty.");
+
return;
}
@@ -1284,26 +1316,26 @@ void SpellMgr::LoadSpellRequired()
SpellInfo const* spell = GetSpellInfo(spell_id);
if (!spell)
{
- sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
+ sLog->outError(LOG_FILTER_SQL, "spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
continue;
}
SpellInfo const* req_spell = GetSpellInfo(spell_req);
if (!req_spell)
{
- sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
+ sLog->outError(LOG_FILTER_SQL, "req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
continue;
}
if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
{
- sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
+ sLog->outError(LOG_FILTER_SQL, "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
continue;
}
if (IsSpellRequiringSpell(spell_id, spell_req))
{
- sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
+ sLog->outError(LOG_FILTER_SQL, "duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
continue;
}
@@ -1312,8 +1344,8 @@ void SpellMgr::LoadSpellRequired()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SpellMgr::LoadSpellLearnSkills()
@@ -1350,8 +1382,7 @@ void SpellMgr::LoadSpellLearnSkills()
}
}
- sLog->outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLearnSpells()
@@ -1364,8 +1395,7 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
return;
}
@@ -1383,19 +1413,19 @@ void SpellMgr::LoadSpellLearnSpells()
if (!GetSpellInfo(spell_id))
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` does not exist", spell_id);
continue;
}
if (!GetSpellInfo(node.spell))
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
continue;
}
if (GetTalentSpellCost(node.spell))
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell);
continue;
}
@@ -1437,7 +1467,7 @@ void SpellMgr::LoadSpellLearnSpells()
{
if (itr->second.spell == dbc_node.spell)
{
- sLog->outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.",
+ sLog->outError(LOG_FILTER_SQL, "Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.",
spell, dbc_node.spell);
found = true;
break;
@@ -1453,8 +1483,7 @@ void SpellMgr::LoadSpellLearnSpells()
}
}
- sLog->outString(">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellTargetPositions()
@@ -1467,8 +1496,7 @@ void SpellMgr::LoadSpellTargetPositions()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
- sLog->outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
return;
}
@@ -1490,20 +1518,20 @@ void SpellMgr::LoadSpellTargetPositions()
MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
if (!mapEntry)
{
- sLog->outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId);
continue;
}
if (st.target_X==0 && st.target_Y==0 && st.target_Z==0)
{
- sLog->outErrorDb("Spell (ID:%u) target coordinates not provided.", Spell_ID);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target coordinates not provided.", Spell_ID);
continue;
}
SpellInfo const* spellInfo = GetSpellInfo(Spell_ID);
if (!spellInfo)
{
- sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
continue;
}
@@ -1518,7 +1546,7 @@ void SpellMgr::LoadSpellTargetPositions()
uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z);
if (area_id != uint32(spellInfo->Effects[i].MiscValue))
{
- sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id);
break;
}
}
@@ -1529,7 +1557,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
if (!found)
{
- sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID);
+ sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID);
continue;
}
@@ -1573,8 +1601,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
}*/
- sLog->outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroups()
@@ -1588,8 +1615,7 @@ void SpellMgr::LoadSpellGroups()
QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
if (!result)
{
- sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
return;
}
@@ -1602,7 +1628,7 @@ void SpellMgr::LoadSpellGroups()
uint32 group_id = fields[0].GetUInt32();
if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX)
{
- sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` is in core range, but is not defined in core!", group_id);
+ sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id);
continue;
}
int32 spell_id = fields[1].GetInt32();
@@ -1618,7 +1644,7 @@ void SpellMgr::LoadSpellGroups()
{
if (groups.find(abs(itr->second)) == groups.end())
{
- sLog->outErrorDb("SpellGroup id %u listed in `spell_groups` does not exist", abs(itr->second));
+ sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second));
mSpellGroupSpell.erase(itr++);
}
else
@@ -1630,12 +1656,12 @@ void SpellMgr::LoadSpellGroups()
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_group` does not exist", itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_group` does not exist", itr->second);
mSpellGroupSpell.erase(itr++);
}
else if (spellInfo->GetRank() > 1)
{
- sLog->outErrorDb("Spell %u listed in `spell_group` is not first rank of spell", itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_group` is not first rank of spell", itr->second);
mSpellGroupSpell.erase(itr++);
}
else
@@ -1655,8 +1681,7 @@ void SpellMgr::LoadSpellGroups()
}
}
- sLog->outString(">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroupStackRules()
@@ -1669,8 +1694,7 @@ void SpellMgr::LoadSpellGroupStackRules()
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
- sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
return;
}
@@ -1683,7 +1707,7 @@ void SpellMgr::LoadSpellGroupStackRules()
uint8 stack_rule = fields[1].GetInt8();
if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX)
{
- sLog->outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule);
+ sLog->outError(LOG_FILTER_SQL, "SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule);
continue;
}
@@ -1691,7 +1715,7 @@ void SpellMgr::LoadSpellGroupStackRules()
if (spellGroup.first == spellGroup.second)
{
- sLog->outErrorDb("SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id);
+ sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id);
continue;
}
@@ -1700,8 +1724,7 @@ void SpellMgr::LoadSpellGroupStackRules()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellProcEvents()
@@ -1714,8 +1737,7 @@ void SpellMgr::LoadSpellProcEvents()
QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
return;
}
@@ -1730,7 +1752,7 @@ void SpellMgr::LoadSpellProcEvents()
SpellInfo const* spell = GetSpellInfo(entry);
if (!spell)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` does not exist", entry);
continue;
}
@@ -1753,7 +1775,7 @@ void SpellMgr::LoadSpellProcEvents()
{
if (spe.procFlags == 0)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
continue;
}
customProc++;
@@ -1762,10 +1784,10 @@ void SpellMgr::LoadSpellProcEvents()
} while (result->NextRow());
if (customProc)
- sLog->outString(">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SpellMgr::LoadSpellProcs()
@@ -1778,8 +1800,7 @@ void SpellMgr::LoadSpellProcs()
QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
if (!result)
{
- sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
return;
}
@@ -1800,7 +1821,7 @@ void SpellMgr::LoadSpellProcs()
SpellInfo const* spellEntry = GetSpellInfo(spellId);
if (!spellEntry)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` does not exist", spellId);
continue;
}
@@ -1808,7 +1829,7 @@ void SpellMgr::LoadSpellProcs()
{
if (GetFirstSpellInChain(spellId) != uint32(spellId))
{
- sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
continue;
}
}
@@ -1835,7 +1856,7 @@ void SpellMgr::LoadSpellProcs()
{
if (mSpellProcMap.find(spellId) != mSpellProcMap.end())
{
- sLog->outErrorDb("Spell %u listed in `spell_proc` has duplicate entry in the table", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` has duplicate entry in the table", spellId);
break;
}
SpellProcEntry procEntry = SpellProcEntry(baseProcEntry);
@@ -1850,47 +1871,47 @@ void SpellMgr::LoadSpellProcs()
// validate data
if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask);
if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName);
if (procEntry.chance < 0)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId);
procEntry.chance = 0;
}
if (procEntry.ratePerMinute < 0)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId);
procEntry.ratePerMinute = 0;
}
if (cooldown < 0)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId);
procEntry.cooldown = 0;
}
if (procEntry.chance == 0 && procEntry.ratePerMinute == 0)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId);
if (procEntry.charges > 99)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId);
procEntry.charges = 99;
}
if (!procEntry.typeMask)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId);
if (procEntry.spellTypeMask & ~PROC_SPELL_PHASE_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask);
if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK)))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId);
if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId);
if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask);
if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId);
if (procEntry.hitMask & ~PROC_HIT_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask);
if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH)))))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId);
mSpellProcMap[spellId] = procEntry;
@@ -1905,8 +1926,7 @@ void SpellMgr::LoadSpellProcs()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellBonusess()
@@ -1919,8 +1939,7 @@ void SpellMgr::LoadSpellBonusess()
QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if (!result)
{
- sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
return;
}
@@ -1933,7 +1952,7 @@ void SpellMgr::LoadSpellBonusess()
SpellInfo const* spell = GetSpellInfo(entry);
if (!spell)
{
- sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_bonus_data` does not exist", entry);
continue;
}
@@ -1946,8 +1965,7 @@ void SpellMgr::LoadSpellBonusess()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellThreats()
@@ -1960,8 +1978,7 @@ void SpellMgr::LoadSpellThreats()
QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
if (!result)
{
- sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
return;
}
@@ -1974,7 +1991,7 @@ void SpellMgr::LoadSpellThreats()
if (!GetSpellInfo(entry))
{
- sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_threat` does not exist", entry);
continue;
}
@@ -1987,8 +2004,7 @@ void SpellMgr::LoadSpellThreats()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSkillLineAbilityMap()
@@ -2009,8 +2025,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
++count;
}
- sLog->outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellPetAuras()
@@ -2023,8 +2038,7 @@ void SpellMgr::LoadSpellPetAuras()
QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
if (!result)
{
- sLog->outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
return;
}
@@ -2046,21 +2060,21 @@ void SpellMgr::LoadSpellPetAuras()
SpellInfo const* spellInfo = GetSpellInfo(spell);
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_pet_auras` does not exist", spell);
continue;
}
if (spellInfo->Effects[eff].Effect != SPELL_EFFECT_DUMMY &&
(spellInfo->Effects[eff].Effect != SPELL_EFFECT_APPLY_AURA ||
spellInfo->Effects[eff].ApplyAuraName != SPELL_AURA_DUMMY))
{
- sLog->outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
continue;
}
SpellInfo const* spellInfo2 = GetSpellInfo(aura);
if (!spellInfo2)
{
- sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
+ sLog->outError(LOG_FILTER_SQL, "Aura %u listed in `spell_pet_auras` does not exist", aura);
continue;
}
@@ -2071,8 +2085,7 @@ void SpellMgr::LoadSpellPetAuras()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Fill custom data about enchancments
@@ -2094,7 +2107,7 @@ void SpellMgr::LoadEnchantCustomAttr()
continue;
// TODO: find a better check
- if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_UNK13) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT))
+ if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT))
continue;
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
@@ -2112,8 +2125,7 @@ void SpellMgr::LoadEnchantCustomAttr()
}
}
- sLog->outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellEnchantProcData()
@@ -2126,8 +2138,7 @@ void SpellMgr::LoadSpellEnchantProcData()
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
return;
}
@@ -2141,7 +2152,7 @@ void SpellMgr::LoadSpellEnchantProcData()
SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
if (!ench)
{
- sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
+ sLog->outError(LOG_FILTER_SQL, "Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
continue;
}
@@ -2156,8 +2167,7 @@ void SpellMgr::LoadSpellEnchantProcData()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLinked()
@@ -2170,8 +2180,7 @@ void SpellMgr::LoadSpellLinked()
QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
return;
}
@@ -2187,13 +2196,13 @@ void SpellMgr::LoadSpellLinked()
SpellInfo const* spellInfo = GetSpellInfo(abs(trigger));
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
continue;
}
spellInfo = GetSpellInfo(abs(effect));
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
continue;
}
@@ -2209,8 +2218,7 @@ void SpellMgr::LoadSpellLinked()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadPetLevelupSpellMap()
@@ -2266,8 +2274,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
}
}
- sLog->outString(">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
}
bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells)
@@ -2351,10 +2358,9 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outString(">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString("Loading summonable creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates...");
oldMSTime = getMSTime();
// different summon spells
@@ -2395,8 +2401,7 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outString(">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellAreas()
@@ -2414,8 +2419,8 @@ void SpellMgr::LoadSpellAreas()
if (!result)
{
- sLog->outString(">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
+
return;
}
@@ -2443,7 +2448,7 @@ void SpellMgr::LoadSpellAreas()
}
else
{
- sLog->outErrorDb("Spell %u listed in `spell_area` does not exist", spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` does not exist", spell);
continue;
}
@@ -2472,20 +2477,20 @@ void SpellMgr::LoadSpellAreas()
if (!ok)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` already listed with similar requirements.", spell);
continue;
}
}
if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId))
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId);
continue;
}
if (spellArea.questStart && !sObjectMgr->GetQuestTemplate(spellArea.questStart))
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart);
continue;
}
@@ -2493,13 +2498,13 @@ void SpellMgr::LoadSpellAreas()
{
if (!sObjectMgr->GetQuestTemplate(spellArea.questEnd))
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd);
continue;
}
if (spellArea.questEnd == spellArea.questStart && !spellArea.questStartCanActive)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell, spellArea.questEnd);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell, spellArea.questEnd);
continue;
}
}
@@ -2509,13 +2514,13 @@ void SpellMgr::LoadSpellAreas()
SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell));
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
continue;
}
if (uint32(abs(spellArea.auraSpell)) == spellArea.spellId)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell));
continue;
}
@@ -2535,7 +2540,7 @@ void SpellMgr::LoadSpellAreas()
if (chain)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
continue;
}
@@ -2551,7 +2556,7 @@ void SpellMgr::LoadSpellAreas()
if (chain)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
continue;
}
}
@@ -2559,13 +2564,13 @@ void SpellMgr::LoadSpellAreas()
if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask);
continue;
}
if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender);
continue;
}
@@ -2595,8 +2600,7 @@ void SpellMgr::LoadSpellAreas()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellInfoStore()
@@ -2612,8 +2616,7 @@ void SpellMgr::LoadSpellInfoStore()
mSpellInfoMap[i] = new SpellInfo(spellEntry);
}
- sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::UnloadSpellInfoStore()
@@ -2925,8 +2928,7 @@ void SpellMgr::LoadSpellCustomAttr()
CreatureAI::FillAISpellInfo();
- sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadDbcDataCorrections()
@@ -2960,8 +2962,10 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->Id)
{
- case 40244: case 40245: // Simon Game Visual
- case 40246: case 40247: // Simon Game Visual
+ case 40244: // Simon Game Visual
+ case 40245: // Simon Game Visual
+ case 40246: // Simon Game Visual
+ case 40247: // Simon Game Visual
case 42835: // Spout, remove damage effect, only anim is needed
spellInfo->Effect[0] = 0;
break;
@@ -2973,7 +2977,6 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectImplicitTargetB[0] = 0;
break;
case 63665: // Charge (Argent Tournament emote on riders)
- case 31447: // Mark of Kaz'rogal (needs target selection script)
case 31298: // Sleep (needs target selection script)
case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed)
case 2895: // Wrath of Air Totem rank 1 (Aura)
@@ -3045,6 +3048,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 48246: // Ball of Flame
spellInfo->MaxAffectedTargets = 1;
break;
+ case 36384: // Skartax Purple Beam
+ spellInfo->MaxAffectedTargets = 2;
+ break;
case 41376: // Spite
case 39992: // Needle Spine
case 29576: // Multi-Shot
@@ -3084,7 +3090,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 50312: // Unholy Frenzy
spellInfo->MaxAffectedTargets = 15;
break;
- case 33711: //Murmur's Touch
+ case 33711: // Murmur's Touch
case 38794:
spellInfo->MaxAffectedTargets = 1;
spellInfo->EffectTriggerSpell[0] = 33760;
@@ -3125,6 +3131,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 51852: // The Eye of Acherus (no spawn in phase 2 in db)
spellInfo->EffectMiscValue[0] |= 1;
break;
+ case 51912: // Crafty's Ultra-Advanced Proto-Typical Shortening Blaster
+ spellInfo->EffectAmplitude[0] = 3000;
+ break;
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_7_YARDS;
break;
@@ -3234,9 +3243,24 @@ void SpellMgr::LoadDbcDataCorrections()
// this needs research on modifier applying rules, does not seem to be in Attributes fields
spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000);
break;
- case 63163: // Apply Enchanted Bridle (Argent Tournament)
- spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1
- spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0)
+ case 64949: // Idol of the Flourishing Life
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x00000000, 0x02000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 34231: // Libram of the Lightbringer
+ case 60792: // Libram of Tolerance
+ case 64956: // Libram of the Resolute
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x80000000, 0x00000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 28851: // Libram of Light
+ case 28853: // Libram of Divinity
+ case 32403: // Blessed Book of Nagrand
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x40000000, 0x00000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 45602: // Ride Carpet
+ spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)"
break;
case 64745: // Item - Death Knight T8 Tank 4P Bonus
case 64936: // Item - Warrior T8 Protection 4P Bonus
@@ -3252,9 +3276,16 @@ void SpellMgr::LoadDbcDataCorrections()
case 53313: // Entangling Roots (Rank 8) -- Nature's Grasp Proc
spellInfo->CastingTimeIndex = 1;
break;
+ case 59414: // Pulsing Shockwave Aura (Loken)
+ // this flag breaks movement, remove it
+ spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1;
+ break;
case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with
spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE;
break;
+ case 70650: // Death Knight T10 Tank 2P Bonus
+ spellInfo->EffectApplyAuraName[0] = SPELL_AURA_ADD_PCT_MODIFIER;
+ break;
// ULDUAR SPELLS
//
case 62374: // Pursued (Flame Leviathan)
@@ -3293,10 +3324,18 @@ void SpellMgr::LoadDbcDataCorrections()
// that will be clear if we get more spells with problem like this
spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY;
break;
- case 62584: // Lifebinder's Gift
- case 64185: // Lifebinder's Gift
- spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY;
- spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY;
+ case 62301: // Cosmic Smash (Algalon the Observer)
+ spellInfo->MaxAffectedTargets = 1;
+ break;
+ case 64598: // Cosmic Smash (Algalon the Observer)
+ spellInfo->MaxAffectedTargets = 3;
+ break;
+ case 62293: // Cosmic Smash (Algalon the Observer)
+ spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_CASTER;
+ break;
+ case 62311: // Cosmic Smash (Algalon the Observer)
+ case 64596: // Cosmic Smash (Algalon the Observer)
+ spellInfo->rangeIndex = 6; // 100yd
break;
// ENDOF ULDUAR SPELLS
//
@@ -3333,13 +3372,22 @@ void SpellMgr::LoadDbcDataCorrections()
case 70835: // Bone Storm (Lord Marrowgar)
case 70836: // Bone Storm (Lord Marrowgar)
case 72864: // Death Plague (Rotting Frost Giant)
- case 72378: // Blood Nova (Deathbringer Saurfang)
- case 73058: // Blood Nova (Deathbringer Saurfang)
case 71160: // Plague Stench (Stinky)
case 71161: // Plague Stench (Stinky)
case 71123: // Decimate (Stinky & Precious)
spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd
break;
+ case 72378: // Blood Nova (Deathbringer Saurfang)
+ case 73058: // Blood Nova (Deathbringer Saurfang)
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS;
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS;
+ break;
+ case 72769: // Scent of Blood (Deathbringer Saurfang)
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS;
+ // no break
+ case 72771: // Scent of Blood (Deathbringer Saurfang)
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS;
+ break;
case 72723: // Resistant Skin (Deathbringer Saurfang adds)
// this spell initially granted Shadow damage immunity, however it was removed but the data was left in client
spellInfo->Effect[2] = 0;
@@ -3347,9 +3395,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 70460: // Coldflame Jets (Traps after Saurfang)
spellInfo->DurationIndex = 1; // 10 seconds
break;
- case 71413: // Green Ooze Summon (Professor Putricide)
- case 71414: // Orange Ooze Summon (Professor Putricide)
- spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST;
+ case 71412: // Green Ooze Summon (Professor Putricide)
+ case 71415: // Orange Ooze Summon (Professor Putricide)
+ spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY;
break;
case 71159: // Awaken Plagued Zombies
spellInfo->DurationIndex = 21;
@@ -3407,7 +3455,7 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 70598: // Sindragosa's Fury
- spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER;
+ spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST;
break;
case 69846: // Frost Bomb
spellInfo->speed = 0.0f; // This spell's summon happens instantly
@@ -3517,11 +3565,6 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->SpellFamilyName)
{
- case SPELLFAMILY_DRUID:
- // Starfall Target Selection
- if (spellInfo->SpellFamilyFlags[2] & 0x100)
- spellInfo->MaxAffectedTargets = 2;
- break;
case SPELLFAMILY_PALADIN:
// Seals of the Pure should affect Seal of Righteousness
if (spellInfo->SpellIconID == 25 && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
@@ -3540,6 +3583,5 @@ void SpellMgr::LoadDbcDataCorrections()
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
properties->Type = SUMMON_TYPE_TOTEM;
- sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index 521070f7879..dcf3c38fe4f 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -605,7 +605,7 @@ class SpellMgr
// Accessors (const or static functions)
public:
- // Spell correctess for client using
+ // Spell correctness for client using
static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true);
// Spell difficulty
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 81f8bbd78c5..1399934efeb 100755
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -25,7 +25,7 @@ bool _SpellScript::_Validate(SpellInfo const* entry)
{
if (!Validate(entry))
{
- sLog->outError("TSCR: Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str());
return false;
}
return true;
@@ -203,52 +203,110 @@ void SpellScript::HitHandler::Call(SpellScript* spellScript)
(spellScript->*pHitHandlerScript)();
}
-SpellScript::UnitTargetHandler::UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType)
- : _SpellScript::EffectHook(_effIndex), targetType(_targetType)
+SpellScript::TargetHook::TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area)
+ : _SpellScript::EffectHook(_effectIndex), targetType(_targetType), area(_area)
{
- pUnitTargetHandlerScript = _pUnitTargetHandlerScript;
}
-std::string SpellScript::UnitTargetHandler::ToString()
+std::string SpellScript::TargetHook::ToString()
{
std::ostringstream oss;
oss << "Index: " << EffIndexToString() << " Target: " << targetType;
return oss.str();
}
-bool SpellScript::UnitTargetHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
+bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
if (!targetType)
return false;
- return (effIndex == EFFECT_ALL) || (spellEntry->Effects[effIndex].TargetA.GetTarget() == targetType || spellEntry->Effects[effIndex].TargetB.GetTarget() == targetType);
+
+ if (spellEntry->Effects[effIndex].TargetA.GetTarget() != targetType &&
+ spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType)
+ return false;
+
+ SpellImplicitTargetInfo targetInfo(targetType);
+ switch (targetInfo.GetSelectionCategory())
+ {
+ case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE
+ return !area;
+ case TARGET_SELECT_CATEGORY_NEARBY: // BOTH
+ return true;
+ case TARGET_SELECT_CATEGORY_CONE: // AREA
+ case TARGET_SELECT_CATEGORY_AREA: // AREA
+ return area;
+ case TARGET_SELECT_CATEGORY_DEFAULT:
+ switch (targetInfo.GetObjectType())
+ {
+ case TARGET_OBJECT_TYPE_SRC: // EMPTY
+ case TARGET_OBJECT_TYPE_DEST: // EMPTY
+ return false;
+ default:
+ switch (targetInfo.GetReferenceType())
+ {
+ case TARGET_REFERENCE_TYPE_CASTER: // SINGLE
+ return !area;
+ case TARGET_REFERENCE_TYPE_TARGET: // BOTH
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
+ : TargetHook(_effIndex, _targetType, true)
+{
+ pObjectAreaTargetSelectHandlerScript = _pObjectAreaTargetSelectHandlerScript;
}
-void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Unit*>& unitTargets)
+void SpellScript::ObjectAreaTargetSelectHandler::Call(SpellScript* spellScript, std::list<WorldObject*>& targets)
{
- (spellScript->*pUnitTargetHandlerScript)(unitTargets);
+ (spellScript->*pObjectAreaTargetSelectHandlerScript)(targets);
+}
+
+SpellScript::ObjectTargetSelectHandler::ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
+ : TargetHook(_effIndex, _targetType, false)
+{
+ pObjectTargetSelectHandlerScript = _pObjectTargetSelectHandlerScript;
+}
+
+void SpellScript::ObjectTargetSelectHandler::Call(SpellScript* spellScript, WorldObject*& target)
+{
+ (spellScript->*pObjectTargetSelectHandlerScript)(target);
}
bool SpellScript::_Validate(SpellInfo const* entry)
{
- for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)
+ for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
- for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)
+ for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
- for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)
+ for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
- for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)
+ for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
- for (std::list<UnitTargetHandler>::iterator itr = OnUnitTargetSelect.begin(); itr != OnUnitTargetSelect.end(); ++itr)
+ for (std::list<ObjectAreaTargetSelectHandler>::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnUnitTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+
+ for (std::list<ObjectTargetSelectHandler>::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
return _SpellScript::_Validate(entry);
}
@@ -320,29 +378,34 @@ SpellInfo const* SpellScript::GetSpellInfo()
return m_spell->GetSpellInfo();
}
-WorldLocation const* SpellScript::GetTargetDest()
+WorldLocation const* SpellScript::GetExplTargetDest()
{
if (m_spell->m_targets.HasDst())
return m_spell->m_targets.GetDstPos();
return NULL;
}
-void SpellScript::SetTargetDest(WorldLocation& loc)
+void SpellScript::SetExplTargetDest(WorldLocation& loc)
{
m_spell->m_targets.SetDst(loc);
}
-Unit* SpellScript::GetTargetUnit()
+WorldObject* SpellScript::GetExplTargetWorldObject()
+{
+ return m_spell->m_targets.GetObjectTarget();
+}
+
+Unit* SpellScript::GetExplTargetUnit()
{
return m_spell->m_targets.GetUnitTarget();
}
-GameObject* SpellScript::GetTargetGObj()
+GameObject* SpellScript::GetExplTargetGObj()
{
return m_spell->m_targets.GetGOTarget();
}
-Item* SpellScript::GetTargetItem()
+Item* SpellScript::GetExplTargetItem()
{
return m_spell->m_targets.GetItemTarget();
}
@@ -351,7 +414,7 @@ Unit* SpellScript::GetHitUnit()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->unitTarget;
@@ -361,7 +424,7 @@ Creature* SpellScript::GetHitCreature()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
if (m_spell->unitTarget)
@@ -374,7 +437,7 @@ Player* SpellScript::GetHitPlayer()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
if (m_spell->unitTarget)
@@ -387,7 +450,7 @@ Item* SpellScript::GetHitItem()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->itemTarget;
@@ -397,17 +460,17 @@ GameObject* SpellScript::GetHitGObj()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->gameObjTarget;
}
-WorldLocation const* SpellScript::GetHitDest()
+WorldLocation* SpellScript::GetHitDest()
{
if (!IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->destTarget;
@@ -417,7 +480,7 @@ int32 SpellScript::GetHitDamage()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return 0;
}
return m_spell->m_damage;
@@ -427,7 +490,7 @@ void SpellScript::SetHitDamage(int32 damage)
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_spell->m_damage = damage;
@@ -437,7 +500,7 @@ int32 SpellScript::GetHitHeal()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return 0;
}
return m_spell->m_healing;
@@ -447,7 +510,7 @@ void SpellScript::SetHitHeal(int32 heal)
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_spell->m_healing = heal;
@@ -457,7 +520,7 @@ Aura* SpellScript::GetHitAura()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
if (!m_spell->m_spellAura)
@@ -471,7 +534,7 @@ void SpellScript::PreventHitAura()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
if (m_spell->m_spellAura)
@@ -482,7 +545,7 @@ void SpellScript::PreventHitEffect(SpellEffIndex effIndex)
{
if (!IsInHitPhase() && !IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_hitPreventEffectMask |= 1 << effIndex;
@@ -493,7 +556,7 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex)
{
if (!IsInHitPhase() && !IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_hitPreventDefaultEffectMask |= 1 << effIndex;
@@ -503,7 +566,7 @@ int32 SpellScript::GetEffectValue()
{
if (!IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return 0;
}
return m_spell->damage;
@@ -534,7 +597,7 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
{
if (!IsInCheckCastHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
@@ -550,67 +613,67 @@ bool AuraScript::_Validate(SpellInfo const* entry)
{
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
if (!entry->HasAreaAuraEffect())
- sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<AuraDispelHandler>::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr)
if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
- sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<AuraDispelHandler>::iterator itr = AfterDispel.begin(); itr != AfterDispel.end(); ++itr)
if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
- sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectPeriodicHandler>::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectUpdatePeriodicHandler>::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectCalcAmountHandler>::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectCalcPeriodicHandler>::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectCalcSpellModHandler>::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectAbsorbHandler>::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectAbsorbHandler>::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectManaShieldHandler>::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectManaShieldHandler>::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
return _SpellScript::_Validate(entry);
}
@@ -773,6 +836,7 @@ bool AuraScript::_IsDefaultActionPrevented()
case AURA_SCRIPT_HOOK_EFFECT_APPLY:
case AURA_SCRIPT_HOOK_EFFECT_REMOVE:
case AURA_SCRIPT_HOOK_EFFECT_PERIODIC:
+ case AURA_SCRIPT_HOOK_EFFECT_ABSORB:
return m_defaultActionPrevented;
default:
ASSERT(false && "AuraScript::_IsDefaultActionPrevented is called in a wrong place");
@@ -787,10 +851,11 @@ void AuraScript::PreventDefaultAction()
case AURA_SCRIPT_HOOK_EFFECT_APPLY:
case AURA_SCRIPT_HOOK_EFFECT_REMOVE:
case AURA_SCRIPT_HOOK_EFFECT_PERIODIC:
+ case AURA_SCRIPT_HOOK_EFFECT_ABSORB:
m_defaultActionPrevented = true;
break;
default:
- sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
break;
}
}
@@ -970,7 +1035,7 @@ Unit* AuraScript::GetTarget() const
case AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD:
return m_auraApplication->GetTarget();
default:
- sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
}
return NULL;
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index e84a56c8dbb..376e7f18edc 100755
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -131,7 +131,8 @@ enum SpellScriptHookType
SPELL_SCRIPT_HOOK_BEFORE_HIT,
SPELL_SCRIPT_HOOK_HIT,
SPELL_SCRIPT_HOOK_AFTER_HIT,
- SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT,
+ SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT,
+ SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT,
SPELL_SCRIPT_HOOK_CHECK_CAST,
SPELL_SCRIPT_HOOK_BEFORE_CAST,
SPELL_SCRIPT_HOOK_ON_CAST,
@@ -154,7 +155,8 @@ class SpellScript : public _SpellScript
typedef void(CLASSNAME::*SpellEffectFnType)(SpellEffIndex); \
typedef void(CLASSNAME::*SpellHitFnType)(); \
typedef void(CLASSNAME::*SpellCastFnType)(); \
- typedef void(CLASSNAME::*SpellUnitTargetFnType)(std::list<Unit*>&); \
+ typedef void(CLASSNAME::*SpellObjectAreaTargetSelectFnType)(std::list<WorldObject*>&); \
+ typedef void(CLASSNAME::*SpellObjectTargetSelectFnType)(WorldObject*&);
SPELLSCRIPT_FUNCTION_TYPE_DEFINES(SpellScript)
@@ -196,16 +198,33 @@ class SpellScript : public _SpellScript
SpellHitFnType pHitHandlerScript;
};
- class UnitTargetHandler : public _SpellScript::EffectHook
+ class TargetHook : public _SpellScript::EffectHook
{
public:
- UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType);
+ TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area);
+ bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
- bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType);
- void Call(SpellScript* spellScript, std::list<Unit*>& unitTargets);
- private:
- SpellUnitTargetFnType pUnitTargetHandlerScript;
+ protected:
uint16 targetType;
+ bool area;
+ };
+
+ class ObjectAreaTargetSelectHandler : public TargetHook
+ {
+ public:
+ ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
+ void Call(SpellScript* spellScript, std::list<WorldObject*>& targets);
+ private:
+ SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript;
+ };
+
+ class ObjectTargetSelectHandler : public TargetHook
+ {
+ public:
+ ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
+ void Call(SpellScript* spellScript, WorldObject*& targets);
+ private:
+ SpellObjectTargetSelectFnType pObjectTargetSelectHandlerScript;
};
#define SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
@@ -213,7 +232,8 @@ class SpellScript : public _SpellScript
class CheckCastHandlerFunction : public SpellScript::CheckCastHandler { public: CheckCastHandlerFunction(SpellCheckCastFnType _checkCastHandlerScript) : SpellScript::CheckCastHandler((SpellScript::SpellCheckCastFnType)_checkCastHandlerScript) {} }; \
class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) {} }; \
- class UnitTargetHandlerFunction : public SpellScript::UnitTargetHandler { public: UnitTargetHandlerFunction(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::UnitTargetHandler((SpellScript::SpellUnitTargetFnType)_pUnitTargetHandlerScript, _effIndex, _targetType) {} }; \
+ 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) {} };
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
public:
@@ -267,15 +287,21 @@ class SpellScript : public _SpellScript
// where function is: void function()
#define SpellHitFn(F) HitHandlerFunction(&F)
- // example: OnUnitTargetSelect += SpellUnitTargetFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
- // where function is void function(std::list<Unit*>& targetList)
- HookList<UnitTargetHandler> OnUnitTargetSelect;
- #define SpellUnitTargetFn(F, I, N) UnitTargetHandlerFunction(&F, I, N)
+ // example: OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
+ // where function is void function(std::list<WorldObject*>& targets)
+ HookList<ObjectAreaTargetSelectHandler> OnObjectAreaTargetSelect;
+ #define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N)
+
+ // example: OnObjectTargetSelect += SpellObjectTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
+ // where function is void function(WorldObject*& target)
+ HookList<ObjectTargetSelectHandler> OnObjectTargetSelect;
+ #define SpellObjectTargetSelectFn(F, I, N) ObjectTargetSelectHandlerFunction(&F, I, N)
// hooks are executed in following order, at specified event of spell:
// 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled
// 2. OnCheckCast - allows to override result of CheckCast function
- // 3. OnUnitTargetSelect - executed just before adding selected targets to final target list
+ // 3a. OnObjectAreaTargetSelect - executed just before adding selected targets to final target list (for area targets)
+ // 3b. OnObjectTargetSelect - executed just before adding selected target to final target list (for single unit targets)
// 4. OnCast - executed just before spell is launched (creates missile) or executed
// 5. AfterCast - executed after spell missile is launched and immediate spell actions are done
// 6. OnEffectLaunch - executed just before specified effect handler call - when spell missile is launched
@@ -295,25 +321,35 @@ class SpellScript : public _SpellScript
SpellInfo const* GetSpellInfo();
SpellValue const* GetSpellValue();
- // methods useable after spell targets are set
- // accessors to the "focus" targets of the spell
- // note: do not confuse these with spell hit targets
+ // methods useable after spell is prepared
+ // accessors to the explicit targets of the spell
+ // explicit target - target selected by caster (player, game client, or script - DoCast(explicitTarget, ...), required for spell to be cast
+ // examples:
+ // -shadowstep - explicit target is the unit you want to go behind of
+ // -chain heal - explicit target is the unit to be healed first
+ // -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected
+ // you can determine if spell requires explicit targets by dbc columns:
+ // - Targets - mask of explicit target types
+ // - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too
+
// returns: WorldLocation which was selected as a spell destination or NULL
- WorldLocation const* GetTargetDest();
+ WorldLocation const* GetExplTargetDest();
- void SetTargetDest(WorldLocation& loc);
+ void SetExplTargetDest(WorldLocation& loc);
- // returns: Unit which was selected as a spell target or NULL
- Unit* GetTargetUnit();
+ // returns: WorldObject which was selected as an explicit spell target or NULL if there's no target
+ WorldObject* GetExplTargetWorldObject();
- // returns: GameObject which was selected as a spell target or NULL
- GameObject* GetTargetGObj();
+ // returns: Unit which was selected as an explicit spell target or NULL if there's no target
+ Unit* GetExplTargetUnit();
- // returns: Item which was selected as a spell target or NULL
- Item* GetTargetItem();
+ // returns: GameObject which was selected as an explicit spell target or NULL if there's no target
+ GameObject* GetExplTargetGObj();
- // methods useable only during spell hit on target, or during spell launch on target:
+ // returns: Item which was selected as an explicit spell target or NULL if there's no target
+ Item* GetExplTargetItem();
+ // methods useable only during spell hit on target, or during spell launch on target:
// returns: target of current effect if it was Unit otherwise NULL
Unit* GetHitUnit();
// returns: target of current effect if it was Creature otherwise NULL
@@ -325,7 +361,7 @@ class SpellScript : public _SpellScript
// returns: target of current effect if it was GameObject otherwise NULL
GameObject* GetHitGObj();
// returns: destination of current effect
- WorldLocation const* GetHitDest();
+ WorldLocation* GetHitDest();
// setter/getter for for damage done by spell to target of spell hit
// returns damage calculated before hit, and real dmg done after hit
int32 GetHitDamage();
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 2f79eaff06a..7818527b34b 100755
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -77,8 +77,8 @@ void CreatureTextMgr::LoadCreatureTexts()
if (!result)
{
- sLog->outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
+
return;
}
@@ -104,25 +104,25 @@ void CreatureTextMgr::LoadCreatureTexts()
if (temp.sound)
{
if (!sSoundEntriesStore.LookupEntry(temp.sound)){
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
if (!GetLanguageDescByID(temp.lang))
{
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
if (temp.emote)
{
if (!sEmotesStore.LookupEntry(temp.emote))
{
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
temp.emote = EMOTE_ONESHOT_NONE;
}
}
@@ -136,8 +136,8 @@ void CreatureTextMgr::LoadCreatureTexts()
++textCount;
} while (result->NextRow());
- sLog->outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
+
}
void CreatureTextMgr::LoadCreatureTextLocales()
@@ -166,8 +166,8 @@ void CreatureTextMgr::LoadCreatureTextLocales()
++textCount;
} while (result->NextRow());
- sLog->outString(">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
+
}
uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/)
@@ -178,7 +178,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry());
if (sList == mTextMap.end())
{
- sLog->outErrorDb("CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName(), source->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName(), source->GetEntry());
return 0;
}
@@ -186,7 +186,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
CreatureTextHolder::const_iterator itr = textHolder.find(textGroup);
if (itr == textHolder.end())
{
- sLog->outErrorDb("CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry());
return 0;
}
@@ -383,7 +383,7 @@ void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id)
if (std::find(repeats.begin(), repeats.end(), id) == repeats.end())
repeats.push_back(id);
else
- sLog->outErrorDb("CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry(), uint32(id));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry(), uint32(id));
}
CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup)
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index f82c01adf31..0a4682db759 100755
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -144,11 +144,24 @@ void GmTicket::SendResponse(WorldSession* session) const
data << uint32(1); // responseID
data << uint32(_id); // ticketID
data << _message.c_str();
- data << _response.c_str();
- // 3 null strings (unused)
- data << uint8(0);
- data << uint8(0);
- data << uint8(0);
+
+ size_t len = _response.size();
+ char const* s = _response.c_str();
+
+ for (int i = 0; i < 4; i++)
+ {
+ if (len)
+ {
+ size_t writeLen = std::min<size_t>(len, 3999);
+ data.append(s, writeLen);
+
+ len -= writeLen;
+ s += writeLen;
+ }
+
+ data << uint8(0);
+ }
+
session->SendPacket(&data);
}
@@ -250,8 +263,8 @@ void TicketMgr::LoadTickets()
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outString(">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
+
return;
}
@@ -277,8 +290,8 @@ void TicketMgr::LoadTickets()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void TicketMgr::LoadSurveys()
@@ -290,8 +303,8 @@ void TicketMgr::LoadSurveys()
if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys"))
_lastSurveyId = (*result)[0].GetUInt32();
- sLog->outString(">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
}
void TicketMgr::AddTicket(GmTicket* ticket)
@@ -371,17 +384,7 @@ void TicketMgr::SendTicket(WorldSession* session, GmTicket* ticket) const
// we've got the easy stuff done by now.
// Now we need to go through the client logic for displaying various levels of ticket load
- if (ticket)
- ticket->WritePacket(data);
- else
- {
- // we can't actually get any numbers here...
- data << float(0);
- data << float(0);
- data << float(1);
- data << uint8(0);
- data << uint8(0);
- }
+ ticket->WritePacket(data);
}
session->SendPacket(&data);
}
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index b734d90b040..f87b81c8be8 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -29,7 +29,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
if (!sWorld->getBoolConfig(CONFIG_CLEAN_CHARACTER_DB))
return;
- sLog->outString("Cleaning character database...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Cleaning character database...");
uint32 oldMSTime = getMSTime();
@@ -63,8 +63,8 @@ void CharacterDatabaseCleaner::CleanDatabase()
sWorld->SetCleaningFlags(flags);
- sLog->outString(">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
}
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
@@ -72,7 +72,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
QueryResult result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table);
if (!result)
{
- sLog->outString("Table %s is empty.", table);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Table %s is empty.", table);
return;
}
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index 476a19b6885..f6d0de28d28 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -320,7 +320,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
case DTT_CHARACTER:
{
if (result->GetFieldCount() <= 68) // avoid crashes on next check
- sLog->outCrash("PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table.");
+ sLog->outFatal(LOG_FILTER_GENERAL, "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table.");
if (result->Fetch()[68].GetUInt32()) // characters.deleteInfos_Account - if filled error
return false;
@@ -496,7 +496,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
std::string tn = gettablename(line);
if (tn.empty())
{
- sLog->outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
@@ -513,7 +513,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (i == DUMP_TABLE_COUNT)
{
- sLog->outError("LoadPlayerDump: Unknown table: '%s'!", tn.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "LoadPlayerDump: Unknown table: '%s'!", tn.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
@@ -662,7 +662,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
break;
}
default:
- sLog->outError("Unknown dump table type: %u", type);
+ sLog->outError(LOG_FILTER_GENERAL, "Unknown dump table type: %u", type);
break;
}
diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp
index fa30adde72a..d651fbd4ce1 100644
--- a/src/server/game/Warden/Warden.cpp
+++ b/src/server/game/Warden/Warden.cpp
@@ -105,9 +105,8 @@ void Warden::Update()
// Kick player if client response delays more than set in config
if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS)
{
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), _session->GetLatency(), _session->GetRemoteAddress().c_str(),
- secsToTimeString(maxClientResponseDelay, true).c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
+ _session->GetPlayerName(false).c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str());
_session->KickPlayer();
}
else
@@ -187,10 +186,15 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
duration << sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_BAN_DURATION) << "s";
std::string accountName;
AccountMgr::GetName(_session->GetAccountId(), accountName);
- sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), "Warden Anticheat violation","Server");
+ std::stringstream banReason;
+ banReason << "Warden Anticheat Violation";
+ // Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL)
+ if (check)
+ banReason << ": " << check->Comment << " (CheckId: " << check->CheckId << ")";
+
+ sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), banReason.str(),"Server");
return "Ban";
- break;
}
default:
break;
@@ -206,7 +210,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size()));
recvData.hexlike();
- switch(opcode)
+ switch (opcode)
{
case WARDEN_CMSG_MODULE_MISSING:
_warden->SendModuleToClient();
diff --git a/src/server/game/Warden/Warden.h b/src/server/game/Warden/Warden.h
index e06ea7dca25..d16890b31b9 100644
--- a/src/server/game/Warden/Warden.h
+++ b/src/server/game/Warden/Warden.h
@@ -107,7 +107,7 @@ class Warden
public:
Warden();
- ~Warden();
+ virtual ~Warden();
virtual void Init(WorldSession* session, BigNumber* k) = 0;
virtual ClientWardenModule* GetModuleForClient() = 0;
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index 90d1cfc0140..f6daba76c1a 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -43,8 +43,8 @@ void WardenCheckMgr::LoadWardenChecks()
// Check if Warden is enabled by config before loading anything
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
- sLog->outString(">> Warden disabled, loading checks skipped.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped.");
+
return;
}
@@ -52,8 +52,8 @@ void WardenCheckMgr::LoadWardenChecks()
if (!result)
{
- sLog->outString(">> Loaded 0 Warden checks. DB table `warden_checks` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!");
+
return;
}
@@ -63,8 +63,8 @@ void WardenCheckMgr::LoadWardenChecks()
CheckStore.resize(maxCheckId + 1);
- // 0 1 2 3 4 5 6
- result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str FROM warden_checks ORDER BY id ASC");
+ // 0 1 2 3 4 5 6 7
+ result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str, comment FROM warden_checks ORDER BY id ASC");
uint32 count = 0;
do
@@ -78,9 +78,11 @@ void WardenCheckMgr::LoadWardenChecks()
uint32 address = fields[4].GetUInt32();
uint8 length = fields[5].GetUInt8();
std::string str = fields[6].GetString();
+ std::string comment = fields[7].GetString();
WardenCheck* wardenCheck = new WardenCheck();
wardenCheck->Type = checkType;
+ wardenCheck->CheckId = id;
// Initialize action with default action from config
wardenCheck->Action = WardenActions(sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_FAIL_ACTION));
@@ -119,7 +121,7 @@ void WardenCheckMgr::LoadWardenChecks()
if (checkType == MPQ_CHECK || checkType == MEM_CHECK)
{
- WardenCheckResult *wr = new WardenCheckResult();
+ WardenCheckResult* wr = new WardenCheckResult();
wr->Result.SetHexStr(checkResult.c_str());
int len = checkResult.size() / 2;
if (wr->Result.GetNumBytes() < len)
@@ -134,23 +136,36 @@ void WardenCheckMgr::LoadWardenChecks()
CheckResultStore[id] = wr;
}
+ if (comment.empty())
+ wardenCheck->Comment = "Undocumented Check";
+ else
+ wardenCheck->Comment = comment;
+
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u warden checks.", count);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count);
+
}
void WardenCheckMgr::LoadWardenOverrides()
{
+ // Check if Warden is enabled by config before loading anything
+ if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
+ {
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped.");
+
+ return;
+ }
+
// 0 1
QueryResult result = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action");
if (!result)
{
- sLog->outString(">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!");
+
return;
}
@@ -167,10 +182,10 @@ void WardenCheckMgr::LoadWardenOverrides()
// Check if action value is in range (0-2, see WardenActions enum)
if (action > WARDEN_ACTION_BAN)
- sLog->outError("Warden check override action out of range (ID: %u, action: %u)", checkId, action);
+ sLog->outError(LOG_FILTER_WARDEN, "Warden check override action out of range (ID: %u, action: %u)", checkId, action);
// Check if check actually exists before accessing the CheckStore vector
else if (checkId > CheckStore.size())
- sLog->outError("Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action);
+ sLog->outError(LOG_FILTER_WARDEN, "Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action);
else
{
CheckStore[checkId]->Action = WardenActions(action);
@@ -179,8 +194,8 @@ void WardenCheckMgr::LoadWardenOverrides()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u warden action overrides.", count);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden action overrides.", count);
+
}
WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id)
diff --git a/src/server/game/Warden/WardenCheckMgr.h b/src/server/game/Warden/WardenCheckMgr.h
index 45de18081c2..7a83d8f0c6d 100644
--- a/src/server/game/Warden/WardenCheckMgr.h
+++ b/src/server/game/Warden/WardenCheckMgr.h
@@ -36,6 +36,8 @@ struct WardenCheck
uint32 Address; // PROC_CHECK, MEM_CHECK, PAGE_CHECK
uint8 Length; // PROC_CHECK, MEM_CHECK, PAGE_CHECK
std::string Str; // LUA, MPQ, DRIVER
+ std::string Comment;
+ uint16 CheckId;
enum WardenActions Action;
};
diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp
index a60ae765013..9c90662105a 100644
--- a/src/server/game/Warden/WardenMac.cpp
+++ b/src/server/game/Warden/WardenMac.cpp
@@ -43,8 +43,8 @@ void WardenMac::Init(WorldSession *pClient, BigNumber *K)
_session = pClient;
// Generate Warden Key
SHA1Randx WK(K->AsByteArray(), K->GetNumBytes());
- WK.generate(_inputKey, 16);
- WK.generate(_outputKey, 16);
+ WK.Generate(_inputKey, 16);
+ WK.Generate(_outputKey, 16);
/*
Seed: 4D808D2C77D905C41A6380EC08586AFE (0x05 packet)
Hash: <?> (0x04 packet)
@@ -152,9 +152,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -222,7 +220,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
// return;
//}
- bool found = false;
+ //bool found = false;
std::string str = "Test string!";
@@ -238,7 +236,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
if (memcmp(sha1Hash, sha1.GetDigest(), 20))
{
sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: SHA1 hash is wrong!");
- found = true;
+ //found = true;
}
MD5_CTX ctx;
@@ -253,7 +251,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
if (memcmp(ourMD5Hash, theirsMD5Hash, 16))
{
sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: MD5 hash is wrong!");
- found = true;
+ //found = true;
}
_session->KickPlayer();
diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp
index a7485d7da51..20f09ec5bda 100644
--- a/src/server/game/Warden/WardenWin.cpp
+++ b/src/server/game/Warden/WardenWin.cpp
@@ -47,8 +47,8 @@ void WardenWin::Init(WorldSession* session, BigNumber *k)
_session = session;
// Generate Warden Key
SHA1Randx WK(k->AsByteArray(), k->GetNumBytes());
- WK.generate(_inputKey, 16);
- WK.generate(_outputKey, 16);
+ WK.Generate(_inputKey, 16);
+ WK.Generate(_outputKey, 16);
memcpy(_seed, Module.Seed, 16);
@@ -156,9 +156,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -343,9 +341,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length))
{
buff.rpos(buff.wpos());
- sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed checksum. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -356,9 +352,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
// TODO: test it.
if (result == 0x00)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "TIMING CHECK FAIL result 0x00");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed timing check. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -500,9 +494,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (checkFailed > 0)
{
WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed);
-
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed Warden check %u. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), checkFailed, Penalty(check).c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerName(false).c_str(), checkFailed, Penalty(check).c_str());
}
// Set hold off timer, minimum timer should at least be 1 second
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index 965e6bf3805..896e7161606 100755
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
@@ -37,7 +37,7 @@ Weather::Weather(uint32 zone, WeatherData const* weatherChances)
m_type = WEATHER_TYPE_FINE;
m_grade = 0;
- sLog->outDetail("WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS)));
+ sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS)));
}
/// Launch a weather update
@@ -97,7 +97,7 @@ bool Weather::ReGenerate()
static char const* seasonName[WEATHER_SEASONS] = { "spring", "summer", "fall", "winter" };
- sLog->outDetail("Generating a change in %s weather for zone %u.", seasonName[season], m_zone);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Generating a change in %s weather for zone %u.", seasonName[season], m_zone);
if ((u < 60) && (m_grade < 0.33333334f)) // Get fair
{
@@ -258,7 +258,7 @@ bool Weather::UpdateWeather()
wthstr = "fine";
break;
}
- sLog->outDetail("Change the weather of zone %u to %s.", m_zone, wthstr);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Change the weather of zone %u to %s.", m_zone, wthstr);
sScriptMgr->OnWeatherChange(this, state, m_grade);
return true;
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index bb8fadf08bc..da62122d7a3 100755
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -93,8 +93,8 @@ void LoadWeatherData()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
+
return;
}
@@ -115,19 +115,19 @@ void LoadWeatherData()
if (wzc.data[season].rainChance > 100)
{
wzc.data[season].rainChance = 25;
- sLog->outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season);
+ sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season);
}
if (wzc.data[season].snowChance > 100)
{
wzc.data[season].snowChance = 25;
- sLog->outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season);
+ sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season);
}
if (wzc.data[season].stormChance > 100)
{
wzc.data[season].stormChance = 25;
- sLog->outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season);
+ sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season);
}
}
@@ -137,8 +137,8 @@ void LoadWeatherData()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SendFineWeatherUpdateToPlayer(Player* player)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index a5ec6be10d4..928a8184d5d 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -79,6 +79,7 @@
#include "WardenCheckMgr.h"
#include "Warden.h"
#include "CalendarMgr.h"
+#include "BattlefieldMgr.h"
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
@@ -270,7 +271,7 @@ void World::AddSession_(WorldSession* s)
{
AddQueuedPlayer (s);
UpdateMaxSessionCounters();
- sLog->outDetail("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
+ sLog->outInfo(LOG_FILTER_GENERAL, "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
return;
}
@@ -287,7 +288,7 @@ void World::AddSession_(WorldSession* s)
float popu = (float)GetActiveSessionCount(); // updated number of users on the server
popu /= pLimit;
popu *= 2;
- sLog->outDetail("Server Population (%f).", popu);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Server Population (%f).", popu);
}
}
@@ -398,11 +399,10 @@ void World::LoadConfigSettings(bool reload)
{
if (!ConfigMgr::Load())
{
- sLog->outError("World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str());
return;
}
-
- sLog->ReloadConfig(); // Reload log levels and filters
+ sLog->LoadFromConfig();
}
///- Read the player limit and the Message of the day from the config file
@@ -422,27 +422,27 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1);
if (rate_values[RATE_HEALTH] < 0)
{
- sLog->outError("Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
rate_values[RATE_HEALTH] = 1;
}
rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1);
if (rate_values[RATE_POWER_MANA] < 0)
{
- sLog->outError("Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
rate_values[RATE_POWER_MANA] = 1;
}
rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1);
rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1);
if (rate_values[RATE_POWER_RAGE_LOSS] < 0)
{
- sLog->outError("Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
rate_values[RATE_POWER_RAGE_LOSS] = 1;
}
rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1);
if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0)
{
- sLog->outError("Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1;
}
rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f);
@@ -466,7 +466,7 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f);
if (rate_values[RATE_REPAIRCOST] < 0.0f)
{
- sLog->outError("Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
rate_values[RATE_REPAIRCOST] = 0.0f;
}
rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f);
@@ -503,13 +503,13 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)
{
- sLog->outError("Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
rate_values[RATE_TALENT] = 1.0f;
}
rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f);
if (rate_values[RATE_MOVESPEED] < 0)
{
- sLog->outError("Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
rate_values[RATE_MOVESPEED] = 1.0f;
}
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED];
@@ -518,12 +518,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f);
if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE)
{
- sLog->outError("TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE;
}
else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE)
{
- sLog->outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE;
}
@@ -531,12 +531,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f)
{
- sLog->outError("DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f)
{
- sLog->outError("DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f;
@@ -544,25 +544,25 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f;
}
///- Read other configuration items from the config file
@@ -572,7 +572,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1);
if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9)
{
- sLog->outError("Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
m_int_configs[CONFIG_COMPRESSION] = 1;
}
m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true);
@@ -596,14 +596,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0);
if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL)
{
- sLog->outError("PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0;
}
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
{
- sLog->outError("GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
}
if (reload)
@@ -612,7 +612,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100);
if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
{
- sLog->outError("MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY;
}
if (reload)
@@ -624,7 +624,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
if (val != m_int_configs[CONFIG_PORT_WORLD])
- sLog->outError("WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
}
else
m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
@@ -643,7 +643,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("GameType", 0);
if (val != m_int_configs[CONFIG_GAME_TYPE])
- sLog->outError("GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
}
else
m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0);
@@ -652,7 +652,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
if (val != m_int_configs[CONFIG_REALM_ZONE])
- sLog->outError("RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
}
else
m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
@@ -674,21 +674,21 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2);
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
{
- sLog->outError("MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2);
if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME)
{
- sLog->outError("MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2);
if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME)
{
- sLog->outError("MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
m_int_configs[CONFIG_MIN_PET_NAME] = 2;
}
@@ -699,7 +699,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10);
if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError("CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10;
}
@@ -707,14 +707,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50);
if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM])
{
- sLog->outError("CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM];
}
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1);
if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
}
@@ -723,7 +723,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0);
if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)
{
- sLog->outError("SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
m_int_configs[CONFIG_SKIP_CINEMATICS] = 0;
}
@@ -731,14 +731,14 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
- sLog->outError("MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
}
else
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL)
{
- sLog->outError("MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL;
}
@@ -747,25 +747,25 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1);
if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1)
{
- sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1;
}
else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55);
if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1)
{
- sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55;
}
else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
@@ -773,12 +773,12 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0);
if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
{
- sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
}
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT)
{
- sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT);
m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT;
}
@@ -786,20 +786,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000);
if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0)
{
- sLog->outError("MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0;
}
m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0);
if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0)
{
- sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0);
m_int_configs[CONFIG_START_HONOR_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS])
{
- sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS];
}
@@ -807,20 +807,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000);
if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0)
{
- sLog->outError("MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0;
}
m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0);
if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0)
{
- sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0);
m_int_configs[CONFIG_START_ARENA_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS])
{
- sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS];
}
@@ -828,7 +828,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60);
if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError("RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60);
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60;
}
@@ -848,7 +848,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9);
if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9)
{
- sLog->outError("MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9;
}
@@ -863,13 +863,13 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1);
if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL])
{
- sLog->outError("GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL];
}
else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL)
{
- sLog->outError("GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL;
}
m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false);
@@ -884,7 +884,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10);
if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0)
{
- sLog->outError("UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
m_int_configs[CONFIG_UPTIME_UPDATE] = 10;
}
if (reload)
@@ -897,7 +897,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10);
if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0)
{
- sLog->outError("LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10;
}
if (reload)
@@ -906,7 +906,7 @@ void World::LoadConfigSettings(bool reload)
m_timers[WUPDATE_CLEANDB].Reset();
}
m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
- sLog->outString("Will clear `logs` table of entries older than %i seconds every %u minutes.",
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.",
m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100);
@@ -931,7 +931,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2);
if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
{
- sLog->outError("MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
}
@@ -946,7 +946,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("Expansion", 1);
if (val != m_int_configs[CONFIG_EXPANSION])
- sLog->outError("Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
}
else
m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1);
@@ -978,7 +978,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6);
if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
{
- sLog->outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
}
@@ -1025,6 +1025,7 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_BG_XP_FOR_KILL] = ConfigMgr::GetBoolDefault("Battleground.GiveXPForKills", false);
m_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = ConfigMgr::GetIntDefault ("Arena.MaxRatingDifference", 150);
m_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = ConfigMgr::GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
+ m_int_configs[CONFIG_ARENA_RATED_UPDATE_TIMER] = ConfigMgr::GetIntDefault ("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS);
m_bool_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = ConfigMgr::GetBoolDefault("Arena.AutoDistributePoints", false);
m_int_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = ConfigMgr::GetIntDefault ("Arena.AutoDistributeInterval", 7);
m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE] = ConfigMgr::GetBoolDefault("Arena.QueueAnnouncer.Enable", false);
@@ -1044,10 +1045,10 @@ void World::LoadConfigSettings(bool reload)
if (clientCacheId > 0)
{
m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId;
- sLog->outString("Client cache version set to: %u", clientCacheId);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId);
}
else
- sLog->outError("ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
}
m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR);
@@ -1063,12 +1064,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE;
}
@@ -1076,12 +1077,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError("Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE;
}
@@ -1089,12 +1090,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError("Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE;
}
@@ -1115,12 +1116,12 @@ void World::LoadConfigSettings(bool reload)
if (reload)
{
if (dataPath != m_dataPath)
- sLog->outError("DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
}
else
{
m_dataPath = dataPath;
- sLog->outString("Using DataDir %s", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str());
}
m_bool_configs[CONFIG_ENABLE_MMAPS] = ConfigMgr::GetBoolDefault("mmap.enablePathFinding", true);
@@ -1134,19 +1135,19 @@ void World::LoadConfigSettings(bool reload)
std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", "");
if (!enableHeight)
- sLog->outError("VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS);
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str());
- sLog->outString("WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
- sLog->outString("WORLD: VMap data directory is: %svmaps", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str());
m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49);
m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true);
m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false);
if (m_bool_configs[CONFIG_START_ALL_SPELLS])
- sLog->outString("WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!");
+ sLog->outWarn(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!");
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0);
m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false);
m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false);
@@ -1207,6 +1208,14 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true);
// call ScriptMgr if we're reloading the configuration
+ m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMax", 100);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMin", 0);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
+ m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30);
+ m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150);
+ m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
+
if (reload)
sScriptMgr->OnConfigLoad(reload);
}
@@ -1245,7 +1254,7 @@ void World::SetInitialWorldSettings()
!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{
- sLog->outError("Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
exit(1);
}
@@ -1256,8 +1265,8 @@ void World::SetInitialWorldSettings()
sGameEventMgr->Initialize();
///- Loading strings. Getting no records means core load has to be canceled because no error message can be output.
- sLog->outString();
- sLog->outString("Loading Trinity strings...");
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings...");
if (!sObjectMgr->LoadTrinityStrings())
exit(1); // Error message displayed in function already
@@ -1281,36 +1290,36 @@ void World::SetInitialWorldSettings()
CharacterDatabase.Execute(stmt);
///- Load the DBC files
- sLog->outString("Initialize data stores...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize data stores...");
LoadDBCStores(m_dataPath);
DetectDBCLang();
- sLog->outString("Loading spell dbc data corrections...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell dbc data corrections...");
sSpellMgr->LoadDbcDataCorrections();
- sLog->outString("Loading SpellInfo store...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store...");
sSpellMgr->LoadSpellInfoStore();
- sLog->outString("Loading SkillLineAbilityMultiMap Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data...");
sSpellMgr->LoadSkillLineAbilityMap();
- sLog->outString("Loading spell custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell custom attributes...");
sSpellMgr->LoadSpellCustomAttr();
- sLog->outString("Loading GameObject models...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObject models...");
LoadGameObjectModelList();
- sLog->outString("Loading Script Names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Names...");
sObjectMgr->LoadScriptNames();
- sLog->outString("Loading Instance Template...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Instance Template...");
sObjectMgr->LoadInstanceTemplate();
// Must be called before `creature_respawn`/`gameobject_respawn` tables
- sLog->outString("Loading instances...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading instances...");
sInstanceSaveMgr->LoadInstances();
- sLog->outString("Loading Localization strings...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Localization strings...");
uint32 oldMSTime = getMSTime();
sObjectMgr->LoadCreatureLocales();
sObjectMgr->LoadGameObjectLocales();
@@ -1323,314 +1332,308 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadPointOfInterestLocales();
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
- sLog->outString(">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString("Loading Page Texts...");
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts...");
sObjectMgr->LoadPageTexts();
- sLog->outString("Loading Game Object Templates..."); // must be after LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr->LoadGameObjectTemplate();
- sLog->outString("Loading Spell Rank Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data...");
sSpellMgr->LoadSpellRanks();
- sLog->outString("Loading Spell Required Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data...");
sSpellMgr->LoadSpellRequired();
- sLog->outString("Loading Spell Group types...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types...");
sSpellMgr->LoadSpellGroups();
- sLog->outString("Loading Spell Learn Skills...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills...");
sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
- sLog->outString("Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
- sLog->outString("Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
- sLog->outString("Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
- sLog->outString("Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
- sLog->outString("Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
- sLog->outString("Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
- sLog->outString("Loading NPC Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts...");
sObjectMgr->LoadGossipText();
- sLog->outString("Loading Enchant Spells Proc datas...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas...");
sSpellMgr->LoadSpellEnchantProcData();
- sLog->outString("Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
- sLog->outString("Loading Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Disables");
DisableMgr::LoadDisables(); // must be before loading quests and items
- sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
sObjectMgr->LoadItemTemplates();
- sLog->outString("Loading Item set names..."); // must be after LoadItemPrototypes
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes
sObjectMgr->LoadItemSetNames();
- sLog->outString("Loading Creature Model Based Info Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data...");
sObjectMgr->LoadCreatureModelInfo();
- sLog->outString("Loading Equipment templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");
sObjectMgr->LoadEquipmentTemplates();
- sLog->outString("Loading Creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates...");
sObjectMgr->LoadCreatureTemplates();
- sLog->outString("Loading Creature template addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons...");
sObjectMgr->LoadCreatureTemplateAddons();
- sLog->outString("Loading Reputation Reward Rates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates...");
sObjectMgr->LoadReputationRewardRate();
- sLog->outString("Loading Creature Reputation OnKill Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data...");
sObjectMgr->LoadReputationOnKill();
- sLog->outString("Loading Reputation Spillover Data..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data...");
sObjectMgr->LoadReputationSpilloverTemplate();
- sLog->outString("Loading Points Of Interest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data...");
sObjectMgr->LoadPointsOfInterest();
- sLog->outString("Loading Creature Base Stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats...");
sObjectMgr->LoadCreatureClassLevelStats();
- sLog->outString("Loading Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data...");
sObjectMgr->LoadCreatures();
- sLog->outString("Loading pet levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells...");
sSpellMgr->LoadPetLevelupSpellMap();
- sLog->outString("Loading pet default spells additional to levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells...");
sSpellMgr->LoadPetDefaultSpells();
- sLog->outString("Loading Creature Addon Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data...");
sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
- sLog->outString("Loading Creature Respawn Data..."); // must be after PackInstances()
- sObjectMgr->LoadCreatureRespawnTimes();
-
- sLog->outString("Loading Gameobject Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data...");
sObjectMgr->LoadGameobjects();
- sLog->outString("Loading Gameobject Respawn Data..."); // must be after PackInstances()
- sObjectMgr->LoadGameobjectRespawnTimes();
-
- sLog->outString("Loading Creature Linked Respawn...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn...");
sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
- sLog->outString("Loading Weather Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Weather Data...");
WeatherMgr::LoadWeatherData();
- sLog->outString("Loading Quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests...");
sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
- sLog->outString("Checking Quest Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables");
DisableMgr::CheckQuestDisables(); // must be after loading quests
- sLog->outString("Loading Quest POI");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest POI");
sObjectMgr->LoadQuestPOI();
- sLog->outString("Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations...");
sObjectMgr->LoadQuestRelations(); // must be after quest load
- sLog->outString("Loading Objects Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data...");
sPoolMgr->LoadFromDB();
- sLog->outString("Loading Game Event Data..."); // must be after loading pools fully
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully
sGameEventMgr->LoadFromDB();
- sLog->outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
sObjectMgr->LoadNPCSpellClickSpells();
- sLog->outString("Loading Vehicle Template Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories...");
sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outString("Loading Vehicle Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories...");
sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outString("Loading Dungeon boss data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data...");
sObjectMgr->LoadInstanceEncounters();
- sLog->outString("Loading LFG rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards...");
sLFGMgr->LoadRewards();
- sLog->outString("Loading SpellArea Data..."); // must be after quest load
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load
sSpellMgr->LoadSpellAreas();
- sLog->outString("Loading AreaTrigger definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
- sLog->outString("Loading Access Requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements...");
sObjectMgr->LoadAccessRequirements(); // must be after item template load
- sLog->outString("Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
- sLog->outString("Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
- sLog->outString("Loading AreaTrigger script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names...");
sObjectMgr->LoadAreaTriggerScripts();
- sLog->outString("Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
- sLog->outString("Loading spell pet auras...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
- sLog->outString("Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
- sLog->outString("Loading enchant custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes...");
sSpellMgr->LoadEnchantCustomAttr();
- sLog->outString("Loading linked spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading linked spells...");
sSpellMgr->LoadSpellLinked();
- sLog->outString("Loading Player Create Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data...");
sObjectMgr->LoadPlayerInfo();
- sLog->outString("Loading Exploration BaseXP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data...");
sObjectMgr->LoadExplorationBaseXP();
- sLog->outString("Loading Pet Name Parts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts...");
sObjectMgr->LoadPetNames();
CharacterDatabaseCleaner::CleanDatabase();
- sLog->outString("Loading the max pet number...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading the max pet number...");
sObjectMgr->LoadPetNumber();
- sLog->outString("Loading pet level stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet level stats...");
sObjectMgr->LoadPetLevelInfo();
- sLog->outString("Loading Player Corpses...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses...");
sObjectMgr->LoadCorpses();
- sLog->outString("Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
// Loot tables
LoadLootTables();
- sLog->outString("Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
- sLog->outString("Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
- sLog->outString("Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
- sLog->outString("Loading Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievements...");
sAchievementMgr->LoadAchievementReferenceList();
- sLog->outString("Loading Achievement Criteria Lists...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists...");
sAchievementMgr->LoadAchievementCriteriaList();
- sLog->outString("Loading Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
- sLog->outString("Loading Achievement Rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards...");
sAchievementMgr->LoadRewards();
- sLog->outString("Loading Achievement Reward Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales...");
sAchievementMgr->LoadRewardLocales();
- sLog->outString("Loading Completed Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements...");
sAchievementMgr->LoadCompletedAchievements();
// Delete expired auctions before loading
- sLog->outString("Deleting expired auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions...");
sAuctionMgr->DeleteExpiredAuctionsAtStartup();
///- Load dynamic data tables from the database
- sLog->outString("Loading Item Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions...");
sAuctionMgr->LoadAuctionItems();
- sLog->outString("Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Auctions...");
sAuctionMgr->LoadAuctions();
sGuildMgr->LoadGuilds();
- sLog->outString("Loading ArenaTeams...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams...");
sArenaTeamMgr->LoadArenaTeams();
- sLog->outString("Loading Groups...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Groups...");
sGroupMgr->LoadGroups();
- sLog->outString("Loading ReservedNames...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames...");
sObjectMgr->LoadReservedPlayersNames();
- sLog->outString("Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
- sLog->outString("Loading BattleMasters...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters...");
sBattlegroundMgr->LoadBattleMastersEntry();
- sLog->outString("Loading GameTeleports...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports...");
sObjectMgr->LoadGameTele();
- sLog->outString("Loading Gossip menu...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu...");
sObjectMgr->LoadGossipMenu();
- sLog->outString("Loading Gossip menu options...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options...");
sObjectMgr->LoadGossipMenuItems();
- sLog->outString("Loading Vendors...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vendors...");
sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
- sLog->outString("Loading Trainers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trainers...");
sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate
- sLog->outString("Loading Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Waypoints...");
sWaypointMgr->Load();
- sLog->outString("Loading SmartAI Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints...");
sSmartWaypointMgr->LoadFromDB();
- sLog->outString("Loading Creature Formations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations...");
sFormationMgr->LoadCreatureFormations();
- sLog->outString("Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
LoadWorldStates();
- sLog->outString("Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Conditions...");
sConditionMgr->LoadConditions();
- sLog->outString("Loading faction change achievement pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs...");
sObjectMgr->LoadFactionChangeAchievements();
- sLog->outString("Loading faction change spell pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs...");
sObjectMgr->LoadFactionChangeSpells();
- sLog->outString("Loading faction change item pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs...");
sObjectMgr->LoadFactionChangeItems();
- sLog->outString("Loading faction change reputation pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs...");
sObjectMgr->LoadFactionChangeReputations();
- sLog->outString("Loading GM tickets...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets...");
sTicketMgr->LoadTickets();
- sLog->outString("Loading GM surveys...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM surveys...");
sTicketMgr->LoadSurveys();
- sLog->outString("Loading client addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading client addons...");
AddonMgr::LoadFromDB();
///- Handle outdated emails (delete/return)
- sLog->outString("Returning old mails...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Returning old mails...");
sObjectMgr->ReturnOrDeleteOldMails(false);
- sLog->outString("Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts...");
LoadAutobroadcasts();
///- Load and initialize scripts
@@ -1641,42 +1644,42 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadWaypointScripts();
- sLog->outString("Loading Scripts text locales..."); // must be after Load*Scripts calls
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls
sObjectMgr->LoadDbScriptStrings();
- sLog->outString("Loading CreatureEventAI Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts...");
sEventAIMgr->LoadCreatureEventAI_Texts();
- sLog->outString("Loading CreatureEventAI Summons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Summons...");
sEventAIMgr->LoadCreatureEventAI_Summons();
- sLog->outString("Loading CreatureEventAI Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
- sLog->outString("Loading spell script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell script names...");
sObjectMgr->LoadSpellScriptNames();
- sLog->outString("Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
- sLog->outString("Loading Creature Text Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales...");
sCreatureTextMgr->LoadCreatureTextLocales();
- sLog->outString("Initializing Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initializing Scripts...");
sScriptMgr->Initialize();
sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
- sLog->outString("Validating spell scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Validating spell scripts...");
sObjectMgr->ValidateSpellScripts();
- sLog->outString("Loading SmartAI scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
- sLog->outString("Loading Calendar data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Calendar data...");
sCalendarMgr->LoadFromDB();
///- Initialize game time and timers
- sLog->outString("Initialize game time and timers");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers");
m_gameTime = time(NULL);
m_startTime = m_gameTime;
@@ -1703,17 +1706,16 @@ void World::SetInitialWorldSettings()
mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
//1440
mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
- sLog->outDetail("Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
///- Initilize static helper structures
AIRegistry::Initialize();
- Player::InitVisibleBits();
///- Initialize MapManager
- sLog->outString("Starting Map System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Map System");
sMapMgr->Initialize();
- sLog->outString("Starting Game Event system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Game Event system...");
uint32 nextGameEvent = sGameEventMgr->StartSystem();
m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
@@ -1723,61 +1725,55 @@ void World::SetInitialWorldSettings()
// Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
Channel::CleanOldChannelsInDB();
- sLog->outString("Starting Arena Season...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Arena Season...");
sGameEventMgr->StartArenaSeason();
sTicketMgr->Initialize();
///- Initialize Battlegrounds
- sLog->outString("Starting Battleground System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System");
sBattlegroundMgr->CreateInitialBattlegrounds();
sBattlegroundMgr->InitAutomaticArenaPointDistribution();
///- Initialize outdoor pvp
- sLog->outString("Starting Outdoor PvP System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System");
sOutdoorPvPMgr->InitOutdoorPvP();
- sLog->outString("Loading Transports...");
+ ///- Initialize Battlefield
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battlefield System");
+ sBattlefieldMgr->InitBattlefield();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports...");
sMapMgr->LoadTransports();
- sLog->outString("Loading Transport NPCs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transport NPCs...");
sMapMgr->LoadTransportNPCs();
///- Initialize Warden
- sLog->outString("Loading Warden Checks..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks...");
sWardenCheckMgr->LoadWardenChecks();
- sLog->outString("Loading Warden Action Overrides..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides...");
sWardenCheckMgr->LoadWardenOverrides();
- sLog->outString("Deleting expired bans...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired bans...");
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
- sLog->outString("Calculate next daily quest reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time...");
InitDailyQuestResetTime();
- sLog->outString("Calculate next weekly quest reset time..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time...");
InitWeeklyQuestResetTime();
- sLog->outString("Calculate random battleground reset time..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time...");
InitRandomBGResetTime();
LoadCharacterNameData();
- // possibly enable db logging; avoid massive startup spam by doing it here.
- if (sLog->GetLogDBLater())
- {
- sLog->outString("Enabling database logging...");
- sLog->SetLogDBLater(false);
- sLog->SetLogDB(true);
- }
- else
- sLog->SetLogDB(false);
-
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
- sLog->outString();
- sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
- sLog->outString();
+
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
+ sLog->EnableDBAppenders();
}
void World::DetectDBCLang()
@@ -1786,7 +1782,7 @@ void World::DetectDBCLang()
if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
{
- sLog->outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
m_lang_confid = LOCALE_enUS;
}
@@ -1814,14 +1810,14 @@ void World::DetectDBCLang()
if (default_locale >= TOTAL_LOCALES)
{
- sLog->outError("Unable to determine your DBC Locale! (corrupt DBC?)");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)");
exit(1);
}
m_defaultDbcLocale = LocaleConstant(default_locale);
- sLog->outString("Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
+
}
void World::RecordTimeDiff(const char *text, ...)
@@ -1844,7 +1840,7 @@ void World::RecordTimeDiff(const char *text, ...)
va_start(ap, text);
vsnprintf(str, 256, text, ap);
va_end(ap);
- sLog->outDetail("Difftime %s: %u.", str, diff);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Difftime %s: %u.", str, diff);
}
m_currentTime = thisTime;
@@ -1860,8 +1856,8 @@ void World::LoadAutobroadcasts()
if (!result)
{
- sLog->outString(">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
+
return;
}
@@ -1878,8 +1874,8 @@ void World::LoadAutobroadcasts()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
/// Update the World !
@@ -1891,7 +1887,7 @@ void World::Update(uint32 diff)
{
if (m_updateTimeSum > m_int_configs[CONFIG_INTERVAL_LOG_UPDATE])
{
- sLog->outBasic("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
m_updateTimeSum = m_updateTime;
m_updateTimeCount = 1;
}
@@ -2011,6 +2007,9 @@ void World::Update(uint32 diff)
sOutdoorPvPMgr->Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
+ sBattlefieldMgr->Update(diff);
+ RecordTimeDiff("BattlefieldMgr");
+
///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed())
{
@@ -2045,7 +2044,7 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_PINGDB].Passed())
{
m_timers[WUPDATE_PINGDB].Reset();
- sLog->outDetail("Ping MySQL to keep connection alive");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive");
CharacterDatabase.KeepAlive();
LoginDatabase.KeepAlive();
WorldDatabase.KeepAlive();
@@ -2519,7 +2518,7 @@ void World::ShutdownMsg(bool show, Player* player)
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME;
SendServerMessage(msgid, str.c_str(), player);
- sLog->outStaticDebug("Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str());
}
}
@@ -2537,7 +2536,7 @@ void World::ShutdownCancel()
m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
SendServerMessage(msgid);
- sLog->outStaticDebug("Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
+ sLog->outDebug(LOG_FILTER_GENERAL, "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
sScriptMgr->OnShutdownCancel();
}
@@ -2593,7 +2592,7 @@ void World::ProcessCliCommands()
CliCommandHolder* command = NULL;
while (cliCmdQueue.next(command))
{
- sLog->outDetail("CLI command under processing...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "CLI command under processing...");
zprint = command->m_print;
callbackArg = command->m_callbackArg;
CliHandler handler(callbackArg, zprint);
@@ -2634,7 +2633,7 @@ void World::SendAutoBroadcast()
sWorld->SendGlobalMessage(&data);
}
- sLog->outDetail("AutoBroadcast: '%s'", msg.c_str());
+ sLog->outDebug(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str());
}
void World::UpdateRealmCharCount(uint32 accountId)
@@ -2736,7 +2735,7 @@ void World::InitRandomBGResetTime()
void World::ResetDailyQuests()
{
- sLog->outDetail("Daily quests reset for all characters.");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Daily quests reset for all characters.");
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY);
CharacterDatabase.Execute(stmt);
@@ -2797,7 +2796,7 @@ void World::ResetEventSeasonalQuests(uint16 event_id)
void World::ResetRandomBG()
{
- sLog->outDetail("Random BG status reset for all characters.");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Random BG status reset for all characters.");
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_BATTLEGROUND_RANDOM);
CharacterDatabase.Execute(stmt);
@@ -2861,8 +2860,8 @@ void World::LoadWorldStates()
if (!result)
{
- sLog->outString(">> Loaded 0 world states. DB table `worldstates` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!");
+
return;
}
@@ -2876,8 +2875,8 @@ void World::LoadWorldStates()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
// Setting a worldstate will save it to DB
@@ -2933,12 +2932,12 @@ void World::ProcessQueryCallbacks()
void World::LoadCharacterNameData()
{
- sLog->outString("Loading character name data");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data");
QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL");
if (!result)
{
- sLog->outError("No character name data loaded, empty query");
+ sLog->outError(LOG_FILTER_SQL, "No character name data loaded, empty query");
return;
}
@@ -2952,7 +2951,7 @@ void World::LoadCharacterNameData()
++count;
} while (result->NextRow());
- sLog->outString("Loaded name data for %u characters", count);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count);
}
void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass)
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index ec3d09006bd..8e97e99fa3f 100755..100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -165,6 +165,7 @@ enum WorldBoolConfigs
CONFIG_QUEST_IGNORE_AUTO_COMPLETE,
CONFIG_WARDEN_ENABLED,
CONFIG_ENABLE_MMAPS,
+ CONFIG_WINTERGRASP_ENABLE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -280,6 +281,7 @@ enum WorldIntConfigs
CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH,
CONFIG_ARENA_MAX_RATING_DIFFERENCE,
CONFIG_ARENA_RATING_DISCARD_TIMER,
+ CONFIG_ARENA_RATED_UPDATE_TIMER,
CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS,
CONFIG_ARENA_SEASON_ID,
CONFIG_ARENA_START_RATING,
@@ -318,6 +320,12 @@ enum WorldIntConfigs
CONFIG_WARDEN_CLIENT_BAN_DURATION,
CONFIG_WARDEN_NUM_MEM_CHECKS,
CONFIG_WARDEN_NUM_OTHER_CHECKS,
+ CONFIG_WINTERGRASP_PLR_MAX,
+ CONFIG_WINTERGRASP_PLR_MIN,
+ CONFIG_WINTERGRASP_PLR_MIN_LVL,
+ CONFIG_WINTERGRASP_BATTLETIME,
+ CONFIG_WINTERGRASP_NOBATTLETIME,
+ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH,
INT_CONFIG_VALUE_COUNT
};
diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt
index 3d210858137..619e2730f79 100644
--- a/src/server/scripts/CMakeLists.txt
+++ b/src/server/scripts/CMakeLists.txt
@@ -82,6 +82,8 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
+ ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
+ ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index d14e71aac4a..d5ebeab3b8a 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -12,34 +12,37 @@ set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
Commands/cs_account.cpp
Commands/cs_achievement.cpp
+ Commands/cs_ban.cpp
+ Commands/cs_bf.cpp
+ Commands/cs_cast.cpp
+ Commands/cs_character.cpp
Commands/cs_debug.cpp
+ Commands/cs_disable.cpp
Commands/cs_event.cpp
Commands/cs_gm.cpp
Commands/cs_go.cpp
Commands/cs_gobject.cpp
- Commands/cs_gps.cpp
+ Commands/cs_guild.cpp
Commands/cs_honor.cpp
+ Commands/cs_instance.cpp
Commands/cs_learn.cpp
+ Commands/cs_list.cpp
+ Commands/cs_lookup.cpp
+ Commands/cs_message.cpp
Commands/cs_misc.cpp
Commands/cs_modify.cpp
Commands/cs_npc.cpp
Commands/cs_quest.cpp
Commands/cs_reload.cpp
+ Commands/cs_reset.cpp
Commands/cs_tele.cpp
+ Commands/cs_ticket.cpp
+ Commands/cs_server.cpp
Commands/cs_titles.cpp
Commands/cs_wp.cpp
-# Commands/cs_character.cpp
-# Commands/cs_list.cpp
-# Commands/cs_lookup.cpp
# Commands/cs_pdump.cpp
-# Commands/cs_guild.cpp
-# Commands/cs_cast.cpp
-# Commands/cs_reset.cpp
-# Commands/cs_instance.cpp
-# Commands/cs_server.cpp
# Commands/cs_channel.cpp
# Commands/cs_pet.cpp
-# Commands/cs_ticket.cpp
# Commands/cs_aura.cpp
# Commands/cs_unaura.cpp
# Commands/cs_nameannounce.cpp
@@ -66,10 +69,6 @@ set(scripts_STAT_SRCS
# Commands/cs_save.cpp
# Commands/cs_saveall.cpp
# Commands/cs_kick.cpp
-# Commands/cs_ban.cpp
-# Commands/cs_unban.cpp
-# Commands/cs_baninfo.cpp
-# Commands/cs_banlist.cpp
# Commands/cs_start.cpp
# Commands/cs_taxicheat.cpp
# Commands/cs_linkgrave.cpp
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index b52102479b5..1024a3acf15 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -38,7 +38,7 @@ public:
{ "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL },
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL },
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand accountCommandTable[] =
{
@@ -50,12 +50,12 @@ public:
{ "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable },
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL },
{ "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "account", SEC_PLAYER, true, NULL, "", accountCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
@@ -110,7 +110,11 @@ public:
case AOR_OK:
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
if (handler->GetSession())
- sLog->outChar("Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ {
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password."
+ , handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str()
+ , handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ }
break;
case AOR_NAME_TOO_LONG:
handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
@@ -232,8 +236,8 @@ public:
}
else
handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str());
-
- } while (result->NextRow());
+ }
+ while (result->NextRow());
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR);
return true;
@@ -377,7 +381,6 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
}
// Let set addon state only for lesser (strong) security level
@@ -535,8 +538,8 @@ public:
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* password = strtok(NULL, " ");
- char* passwordConfirmation = strtok(NULL, " ");
+ char* password = strtok(NULL, " ");
+ char* passwordConfirmation = strtok(NULL, " ");
if (!account || !password || !passwordConfirmation)
return false;
@@ -589,7 +592,6 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
new file mode 100644
index 00000000000..bfb52d342e1
--- /dev/null
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -0,0 +1,718 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: ban_commandscript
+%Complete: 100
+Comment: All ban related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "AccountMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+
+class ban_commandscript : public CommandScript
+{
+public:
+ ban_commandscript() : CommandScript("ban_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand unbanCommandTable[] =
+ {
+ { "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "", NULL },
+ { "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "", NULL },
+ { "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "", NULL },
+ { "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand banlistCommandTable[] =
+ {
+ { "account", SEC_ADMINISTRATOR, true, &HandleBanListAccountCommand, "", NULL },
+ { "character", SEC_ADMINISTRATOR, true, &HandleBanListCharacterCommand, "", NULL },
+ { "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand baninfoCommandTable[] =
+ {
+ { "account", SEC_ADMINISTRATOR, true, &HandleBanInfoAccountCommand, "", NULL },
+ { "character", SEC_ADMINISTRATOR, true, &HandleBanInfoCharacterCommand, "", NULL },
+ { "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand banCommandTable[] =
+ {
+ { "account", SEC_ADMINISTRATOR, true, &HandleBanAccountCommand, "", NULL },
+ { "character", SEC_ADMINISTRATOR, true, &HandleBanCharacterCommand, "", NULL },
+ { "playeraccount", SEC_ADMINISTRATOR, true, &HandleBanAccountByCharCommand, "", NULL },
+ { "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable },
+ { "baninfo", SEC_ADMINISTRATOR, true, NULL, "", baninfoCommandTable },
+ { "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable },
+ { "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleBanAccountCommand(ChatHandler* handler, char const* args)
+ {
+ return HandleBanHelper(BAN_ACCOUNT, args, handler);
+ }
+
+ static bool HandleBanCharacterCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* nameStr = strtok((char*)args, " ");
+ if (!nameStr)
+ return false;
+
+ std::string name = nameStr;
+
+ char* durationStr = strtok(NULL, " ");
+ if (!durationStr || !atoi(durationStr))
+ return false;
+
+ char* reasonStr = strtok(NULL, "");
+ if (!reasonStr)
+ return false;
+
+ if (!normalizePlayerName(name))
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
+ {
+ case BAN_SUCCESS:
+ {
+ if (atoi(durationStr) > 0)
+ handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
+ else
+ handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
+ break;
+ }
+ case BAN_NOTFOUND:
+ {
+ handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ default:
+ break;
+ }
+
+ return true;
+ }
+
+ static bool HandleBanAccountByCharCommand(ChatHandler* handler, char const* args)
+ {
+ return HandleBanHelper(BAN_CHARACTER, args, handler);
+ }
+
+ static bool HandleBanIPCommand(ChatHandler* handler, char const* args)
+ {
+ return HandleBanHelper(BAN_IP, args, handler);
+ }
+
+ static bool HandleBanHelper(BanMode mode, char const* args, ChatHandler* handler)
+ {
+ if (!*args)
+ return false;
+
+ char* cnameOrIP = strtok((char*)args, " ");
+ if (!cnameOrIP)
+ return false;
+
+ std::string nameOrIP = cnameOrIP;
+
+ char* durationStr = strtok(NULL, " ");
+ if (!durationStr || !atoi(durationStr))
+ return false;
+
+ char* reasonStr = strtok(NULL, "");
+ if (!reasonStr)
+ return false;
+
+ switch (mode)
+ {
+ case BAN_ACCOUNT:
+ if (!AccountMgr::normalizeString(nameOrIP))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ break;
+ case BAN_CHARACTER:
+ if (!normalizePlayerName(nameOrIP))
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ break;
+ case BAN_IP:
+ if (!IsIPAddress(nameOrIP.c_str()))
+ return false;
+ break;
+ }
+
+ switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
+ {
+ case BAN_SUCCESS:
+ if (atoi(durationStr) > 0)
+ handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
+ else
+ handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reasonStr);
+ break;
+ case BAN_SYNTAX_ERROR:
+ return false;
+ case BAN_NOTFOUND:
+ switch (mode)
+ {
+ default:
+ handler->PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
+ break;
+ case BAN_CHARACTER:
+ handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
+ break;
+ case BAN_IP:
+ handler->PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
+ break;
+ }
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandleBanInfoAccountCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* nameStr = strtok((char*)args, "");
+ if (!nameStr)
+ return false;
+
+ std::string accountName = nameStr;
+ if (!AccountMgr::normalizeString(accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 accountId = AccountMgr::GetId(accountName);
+ if (!accountId)
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ return true;
+ }
+
+ return HandleBanInfoHelper(accountId, accountName.c_str(), handler);
+ }
+
+ static bool HandleBanInfoHelper(uint32 accountId, char const* accountName, ChatHandler* handler)
+ {
+ QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountId);
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountName);
+ return true;
+ }
+
+ handler->PSendSysMessage(LANG_BANINFO_BANHISTORY, accountName);
+ do
+ {
+ Field* fields = result->Fetch();
+
+ time_t unbanDate = time_t(fields[3].GetUInt32());
+ bool active = false;
+ if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(NULL)))
+ active = true;
+ bool permanent = (fields[1].GetUInt64() == uint64(0));
+ std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
+ handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
+ fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
+ }
+ while (result->NextRow());
+
+ return true;
+ }
+
+ static bool HandleBanInfoCharacterCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* target = sObjectAccessor->FindPlayerByName(args);
+ uint32 targetGuid = 0;
+ std::string name(args);
+
+ if (!target)
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
+ stmt->setString(0, name);
+ PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
+
+ if (!resultCharacter)
+ {
+ handler->PSendSysMessage(LANG_BANINFO_NOCHARACTER);
+ return false;
+ }
+
+ targetGuid = (*resultCharacter)[0].GetUInt32();
+ }
+ else
+ targetGuid = target->GetGUIDLow();
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
+ stmt->setUInt32(0, targetGuid);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_CHAR_NOT_BANNED, name.c_str());
+ return true;
+ }
+
+ handler->PSendSysMessage(LANG_BANINFO_BANHISTORY, name.c_str());
+ do
+ {
+ Field* fields = result->Fetch();
+ time_t unbanDate = time_t(fields[3].GetUInt32());
+ bool active = false;
+ if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(NULL)))
+ active = true;
+ bool permanent = (fields[1].GetUInt32() == uint32(0));
+ std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
+ handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
+ fields[0].GetCString(), banTime.c_str(), active ? handler->GetTrinityString(LANG_BANINFO_YES) : handler->GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
+ }
+ while (result->NextRow());
+
+ return true;
+ }
+
+ static bool HandleBanInfoIPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* ipStr = strtok((char*)args, "");
+ if (!ipStr)
+ return false;
+
+ if (!IsIPAddress(ipStr))
+ return false;
+
+ std::string IP = ipStr;
+
+ LoginDatabase.EscapeString(IP);
+ QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str());
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_BANINFO_NOIP);
+ return true;
+ }
+
+ Field* fields = result->Fetch();
+ bool permanent = !fields[6].GetUInt64();
+ handler->PSendSysMessage(LANG_BANINFO_IPENTRY,
+ fields[0].GetCString(), fields[1].GetCString(), permanent ? handler->GetTrinityString(LANG_BANINFO_NEVER) : fields[2].GetCString(),
+ permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString());
+
+
+ return true;
+ }
+
+ static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
+ LoginDatabase.Execute(stmt);
+
+ char* filterStr = strtok((char*)args, " ");
+ std::string filter = filterStr ? filterStr : "";
+
+ PreparedQueryResult result;
+
+ if (filter.empty())
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
+ result = LoginDatabase.Query(stmt);
+ }
+ else
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
+ stmt->setString(0, filter);
+ result = LoginDatabase.Query(stmt);
+ }
+
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_BANLIST_NOACCOUNT);
+ return true;
+ }
+
+ return HandleBanListHelper(result, handler);
+ }
+
+ static bool HandleBanListHelper(PreparedQueryResult result, ChatHandler* handler)
+ {
+ handler->PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT);
+
+ // Chat short output
+ if (handler->GetSession())
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 accountid = fields[0].GetUInt32();
+
+ QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid);
+ if (banResult)
+ {
+ Field* fields2 = banResult->Fetch();
+ handler->PSendSysMessage("%s", fields2[0].GetCString());
+ }
+ }
+ while (result->NextRow());
+ }
+ // Console wide output
+ else
+ {
+ handler->SendSysMessage(LANG_BANLIST_ACCOUNTS);
+ handler->SendSysMessage(" ===============================================================================");
+ handler->SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER);
+ do
+ {
+ handler->SendSysMessage("-------------------------------------------------------------------------------");
+ Field* fields = result->Fetch();
+ uint32 accountId = fields[0].GetUInt32();
+
+ std::string accountName;
+
+ // "account" case, name can be get in same query
+ if (result->GetFieldCount() > 1)
+ accountName = fields[1].GetString();
+ // "character" case, name need extract from another DB
+ else
+ AccountMgr::GetName(accountId, accountName);
+
+ // No SQL injection. id is uint32.
+ QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", accountId);
+ if (banInfo)
+ {
+ Field* fields2 = banInfo->Fetch();
+ do
+ {
+ time_t timeBan = time_t(fields2[0].GetUInt32());
+ tm* tmBan = localtime(&timeBan);
+
+ if (fields2[0].GetUInt32() == fields2[1].GetUInt32())
+ {
+ handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
+ accountName.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
+ fields2[2].GetCString(), fields2[3].GetCString());
+ }
+ else
+ {
+ time_t timeUnban = time_t(fields2[1].GetUInt32());
+ tm* tmUnban = localtime(&timeUnban);
+ handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
+ accountName.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
+ tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min,
+ fields2[2].GetCString(), fields2[3].GetCString());
+ }
+ }
+ while (banInfo->NextRow());
+ }
+ }
+ while (result->NextRow());
+
+ handler->SendSysMessage(" ===============================================================================");
+ }
+
+ return true;
+ }
+
+ static bool HandleBanListCharacterCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* filterStr = strtok((char*)args, " ");
+ if (!filterStr)
+ return false;
+
+ std::string filter(filterStr);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
+ stmt->setString(0, filter);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_BANLIST_NOCHARACTER);
+ return true;
+ }
+
+ handler->PSendSysMessage(LANG_BANLIST_MATCHINGCHARACTER);
+
+ // Chat short output
+ if (handler->GetSession())
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
+ stmt2->setUInt32(0, fields[0].GetUInt32());
+ PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
+ if (banResult)
+ handler->PSendSysMessage("%s", (*banResult)[0].GetCString());
+ }
+ while (result->NextRow());
+ }
+ // Console wide output
+ else
+ {
+ handler->SendSysMessage(LANG_BANLIST_CHARACTERS);
+ handler->SendSysMessage(" =============================================================================== ");
+ handler->SendSysMessage(LANG_BANLIST_CHARACTERS_HEADER);
+ do
+ {
+ handler->SendSysMessage("-------------------------------------------------------------------------------");
+
+ Field* fields = result->Fetch();
+
+ std::string char_name = fields[1].GetString();
+
+ PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
+ stmt2->setUInt32(0, fields[0].GetUInt32());
+ PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
+ if (banInfo)
+ {
+ Field* banFields = banInfo->Fetch();
+ do
+ {
+ time_t timeBan = time_t(banFields[0].GetUInt32());
+ tm* tmBan = localtime(&timeBan);
+
+ if (banFields[0].GetUInt32() == banFields[1].GetUInt32())
+ {
+ handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
+ char_name.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
+ banFields[2].GetCString(), banFields[3].GetCString());
+ }
+ else
+ {
+ time_t timeUnban = time_t(banFields[1].GetUInt32());
+ tm* tmUnban = localtime(&timeUnban);
+ handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
+ char_name.c_str(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
+ tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min,
+ banFields[2].GetCString(), banFields[3].GetCString());
+ }
+ }
+ while (banInfo->NextRow());
+ }
+ }
+ while (result->NextRow());
+ handler->SendSysMessage(" =============================================================================== ");
+ }
+
+ return true;
+ }
+
+ static bool HandleBanListIPCommand(ChatHandler* handler, char const* args)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
+ LoginDatabase.Execute(stmt);
+
+ char* filterStr = strtok((char*)args, " ");
+ std::string filter = filterStr ? filterStr : "";
+ LoginDatabase.EscapeString(filter);
+
+ PreparedQueryResult result;
+
+ if (filter.empty())
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
+ result = LoginDatabase.Query(stmt);
+ }
+ else
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
+ stmt->setString(0, filter);
+ result = LoginDatabase.Query(stmt);
+ }
+
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_BANLIST_NOIP);
+ return true;
+ }
+
+ handler->PSendSysMessage(LANG_BANLIST_MATCHINGIP);
+ // Chat short output
+ if (handler->GetSession())
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ handler->PSendSysMessage("%s", fields[0].GetCString());
+ }
+ while (result->NextRow());
+ }
+ // Console wide output
+ else
+ {
+ handler->SendSysMessage(LANG_BANLIST_IPS);
+ handler->SendSysMessage(" ===============================================================================");
+ handler->SendSysMessage(LANG_BANLIST_IPS_HEADER);
+ do
+ {
+ handler->SendSysMessage("-------------------------------------------------------------------------------");
+ Field* fields = result->Fetch();
+ time_t timeBan = time_t(fields[1].GetUInt32());
+ tm* tmBan = localtime(&timeBan);
+ if (fields[1].GetUInt32() == fields[2].GetUInt32())
+ {
+ handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
+ fields[0].GetCString(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
+ fields[3].GetCString(), fields[4].GetCString());
+ }
+ else
+ {
+ time_t timeUnban = time_t(fields[2].GetUInt32());
+ tm* tmUnban = localtime(&timeUnban);
+ handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
+ fields[0].GetCString(), tmBan->tm_year%100, tmBan->tm_mon+1, tmBan->tm_mday, tmBan->tm_hour, tmBan->tm_min,
+ tmUnban->tm_year%100, tmUnban->tm_mon+1, tmUnban->tm_mday, tmUnban->tm_hour, tmUnban->tm_min,
+ fields[3].GetCString(), fields[4].GetCString());
+ }
+ }
+ while (result->NextRow());
+
+ handler->SendSysMessage(" ===============================================================================");
+ }
+
+ return true;
+ }
+
+ static bool HandleUnBanAccountCommand(ChatHandler* handler, char const* args)
+ {
+ return HandleUnBanHelper(BAN_ACCOUNT, args, handler);
+ }
+
+ static bool HandleUnBanCharacterCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* nameStr = strtok((char*)args, " ");
+ if (!nameStr)
+ return false;
+
+ std::string name = nameStr;
+
+ if (!normalizePlayerName(name))
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (!sWorld->RemoveBanCharacter(name))
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandleUnBanAccountByCharCommand(ChatHandler* handler, char const* args)
+ {
+ return HandleUnBanHelper(BAN_CHARACTER, args, handler);
+ }
+
+ static bool HandleUnBanIPCommand(ChatHandler* handler, char const* args)
+ {
+ return HandleUnBanHelper(BAN_IP, args, handler);
+ }
+
+ static bool HandleUnBanHelper(BanMode mode, char const* args, ChatHandler* handler)
+ {
+ if (!*args)
+ return false;
+
+ char* nameOrIPStr = strtok((char*)args, " ");
+ if (!nameOrIPStr)
+ return false;
+
+ std::string nameOrIP = nameOrIPStr;
+
+ switch (mode)
+ {
+ case BAN_ACCOUNT:
+ if (!AccountMgr::normalizeString(nameOrIP))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ break;
+ case BAN_CHARACTER:
+ if (!normalizePlayerName(nameOrIP))
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ break;
+ case BAN_IP:
+ if (!IsIPAddress(nameOrIP.c_str()))
+ return false;
+ break;
+ }
+
+ if (sWorld->RemoveBanAccount(mode, nameOrIP))
+ handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
+ else
+ handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
+
+ return true;
+ }
+};
+
+void AddSC_ban_commandscript()
+{
+ new ban_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp
new file mode 100644
index 00000000000..7284e6ad6b7
--- /dev/null
+++ b/src/server/scripts/Commands/cs_bf.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2008-2011 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/>.
+ */
+
+/* ScriptData
+Name: bf_commandscript
+%Complete: 100
+Comment: All bf related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "BattlefieldMgr.h"
+
+class bf_commandscript : public CommandScript
+{
+public:
+ bf_commandscript() : CommandScript("bf_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand battlefieldcommandTable[] =
+ {
+ { "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "", NULL },
+ { "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "", NULL },
+ { "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "", NULL },
+ { "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "", NULL },
+ { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleBattlefieldStart(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->StartBattle();
+
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->EndBattle(true);
+
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ if (bf->IsEnabled())
+ {
+ bf->ToggleBattlefield(false);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
+ }
+ else
+ {
+ bf->ToggleBattlefield(true);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
+ }
+
+ return true;
+ }
+
+ static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->EndBattle(false);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ uint32 time = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+ char* time_str = strtok(NULL, " ");
+ if (!time_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ time = atoi(time_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->SetTimer(time * IN_MILLISECONDS);
+ bf->SendInitWorldStatesToAll();
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
+
+ return true;
+ }
+};
+
+void AddSC_bf_commandscript()
+{
+ new bf_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp
new file mode 100644
index 00000000000..70cfb8cb830
--- /dev/null
+++ b/src/server/scripts/Commands/cs_cast.cpp
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: cast_commandscript
+%Complete: 100
+Comment: All cast related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+
+class cast_commandscript : public CommandScript
+{
+public:
+ cast_commandscript() : CommandScript("cast_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand castCommandTable[] =
+ {
+ { "back", SEC_ADMINISTRATOR, false, &HandleCastBackCommand, "", NULL },
+ { "dist", SEC_ADMINISTRATOR, false, &HandleCastDistCommand, "", NULL },
+ { "self", SEC_ADMINISTRATOR, false, &HandleCastSelfCommand, "", NULL },
+ { "target", SEC_ADMINISTRATOR, false, &HandleCastTargetCommad, "", NULL },
+ { "dest", SEC_ADMINISTRATOR, false, &HandleCastDestCommand, "", NULL },
+ { "", SEC_ADMINISTRATOR, false, &HandleCastCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleCastCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* triggeredStr = strtok(NULL, " ");
+ if (triggeredStr)
+ {
+ int l = strlen(triggeredStr);
+ if (strncmp(triggeredStr, "triggered", l) != 0)
+ return false;
+ }
+
+ bool triggered = (triggeredStr != NULL);
+
+ handler->GetSession()->GetPlayer()->CastSpell(target, spellId, triggered);
+
+ return true;
+ }
+
+ static bool HandleCastBackCommand(ChatHandler* handler, char const* args)
+ {
+ Creature* caster = handler->getSelectedCreature();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* triggeredStr = strtok(NULL, " ");
+ if (triggeredStr)
+ {
+ int l = strlen(triggeredStr);
+ if (strncmp(triggeredStr, "triggered", l) != 0)
+ return false;
+ }
+
+ bool triggered = (triggeredStr != NULL);
+
+ caster->CastSpell(handler->GetSession()->GetPlayer(), spellId, triggered);
+
+ return true;
+ }
+
+ static bool HandleCastDistCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* distStr = strtok(NULL, " ");
+
+ float dist = 0;
+
+ if (distStr)
+ sscanf(distStr, "%f", &dist);
+
+ char* triggeredStr = strtok(NULL, " ");
+ if (triggeredStr)
+ {
+ int l = strlen(triggeredStr);
+ if (strncmp(triggeredStr, "triggered", l) != 0)
+ return false;
+ }
+
+ bool triggered = (triggeredStr != NULL);
+
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
+
+ handler->GetSession()->GetPlayer()->CastSpell(x, y, z, spellId, triggered);
+
+ return true;
+ }
+
+ static bool HandleCastSelfCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo)
+ return false;
+
+ if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->CastSpell(target, spellId, false);
+
+ return true;
+ }
+
+ static bool HandleCastTargetCommad(ChatHandler* handler, char const* args)
+ {
+ Creature* caster = handler->getSelectedCreature();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (!caster->getVictim())
+ {
+ handler->SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* triggeredStr = strtok(NULL, " ");
+ if (triggeredStr)
+ {
+ int l = strlen(triggeredStr);
+ if (strncmp(triggeredStr, "triggered", l) != 0)
+ return false;
+ }
+
+ bool triggered = (triggeredStr != NULL);
+
+ caster->CastSpell(caster->getVictim(), spellId, triggered);
+
+ return true;
+ }
+
+ static bool HandleCastDestCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* caster = handler->getSelectedUnit();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* posX = strtok(NULL, " ");
+ char* posY = strtok(NULL, " ");
+ char* posZ = strtok(NULL, " ");
+
+ if (!posX || !posY || !posZ)
+ return false;
+
+ float x = float(atof(posX));
+ float y = float(atof(posY));
+ float z = float(atof(posZ));
+
+ char* triggeredStr = strtok(NULL, " ");
+ if (triggeredStr)
+ {
+ int l = strlen(triggeredStr);
+ if (strncmp(triggeredStr, "triggered", l) != 0)
+ return false;
+ }
+
+ bool triggered = (triggeredStr != NULL);
+
+ caster->CastSpell(x, y, z, spellId, triggered);
+
+ return true;
+ }
+};
+
+void AddSC_cast_commandscript()
+{
+ new cast_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
new file mode 100644
index 00000000000..f5fbfa33cae
--- /dev/null
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -0,0 +1,924 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: character_commandscript
+%Complete: 100
+Comment: All character related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "AccountMgr.h"
+#include "ObjectMgr.h"
+#include "PlayerDump.h"
+
+class character_commandscript : public CommandScript
+{
+public:
+ character_commandscript() : CommandScript("character_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand pdumpCommandTable[] =
+ {
+ { "load", SEC_ADMINISTRATOR, true, &HandlePDumpLoadCommand, "", NULL },
+ { "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand characterDeletedCommandTable[] =
+ {
+ { "delete", SEC_CONSOLE, true, &HandleCharacterDeletedDeleteCommand, "", NULL },
+ { "list", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedListCommand, "", NULL },
+ { "restore", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedRestoreCommand, "", NULL },
+ { "old", SEC_CONSOLE, true, &HandleCharacterDeletedOldCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand characterCommandTable[] =
+ {
+ { "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL },
+ { "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL },
+ { "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL },
+ { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable },
+ { "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL },
+ { "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL },
+ { "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL },
+ { "reputation", SEC_GAMEMASTER, true, &HandleCharacterReputationCommand, "", NULL },
+ { "titles", SEC_GAMEMASTER, true, &HandleCharacterTitlesCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable },
+ { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "", NULL },
+ { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ // Stores informations about a deleted character
+ struct DeletedInfo
+ {
+ uint32 lowGuid; ///< the low GUID from the character
+ std::string name; ///< the character name
+ uint32 accountId; ///< the account id
+ std::string accountName; ///< the account name
+ time_t deleteDate; ///< the date at which the character has been deleted
+ };
+
+ typedef std::list<DeletedInfo> DeletedInfoList;
+
+ /**
+ * Collects all GUIDs (and related info) from deleted characters which are still in the database.
+ *
+ * @param foundList a reference to an std::list which will be filled with info data
+ * @param searchString the search string which either contains a player GUID or a part fo the character-name
+ * @return returns false if there was a problem while selecting the characters (e.g. player name not normalizeable)
+ */
+ static bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString)
+ {
+ PreparedQueryResult result;
+ PreparedStatement* stmt;
+ if (!searchString.empty())
+ {
+ // search by GUID
+ if (isNumeric(searchString.c_str()))
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID);
+ stmt->setUInt32(0, uint32(atoi(searchString.c_str())));
+ result = CharacterDatabase.Query(stmt);
+ }
+ // search by name
+ else
+ {
+ if (!normalizePlayerName(searchString))
+ return false;
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
+ stmt->setString(0, searchString);
+ result = CharacterDatabase.Query(stmt);
+ }
+ }
+ else
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
+ result = CharacterDatabase.Query(stmt);
+ }
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+
+ DeletedInfo info;
+
+ info.lowGuid = fields[0].GetUInt32();
+ info.name = fields[1].GetString();
+ info.accountId = fields[2].GetUInt32();
+
+ // account name will be empty for not existed account
+ AccountMgr::GetName(info.accountId, info.accountName);
+ info.deleteDate = time_t(fields[3].GetUInt32());
+ foundList.push_back(info);
+ }
+ while (result->NextRow());
+ }
+
+ return true;
+ }
+
+ /**
+ * Shows all deleted characters which matches the given search string, expected non empty list
+ *
+ * @see HandleCharacterDeletedListCommand
+ * @see HandleCharacterDeletedRestoreCommand
+ * @see HandleCharacterDeletedDeleteCommand
+ * @see DeletedInfoList
+ *
+ * @param foundList contains a list with all found deleted characters
+ */
+ static void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList, ChatHandler* handler)
+ {
+ if (!handler->GetSession())
+ {
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER);
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
+ }
+
+ for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
+ {
+ std::string dateStr = TimeToTimestampStr(itr->deleteDate);
+
+ if (!handler->GetSession())
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
+ itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
+ itr->accountId, dateStr.c_str());
+ else
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
+ itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
+ itr->accountId, dateStr.c_str());
+ }
+
+ if (!handler->GetSession())
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
+ }
+
+ /**
+ * Restore a previously deleted character
+ *
+ * @see HandleCharacterDeletedListHelper
+ * @see HandleCharacterDeletedRestoreCommand
+ * @see HandleCharacterDeletedDeleteCommand
+ * @see DeletedInfoList
+ *
+ * @param delInfo the informations about the character which will be restored
+ */
+ static void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo, ChatHandler* handler)
+ {
+ if (delInfo.accountName.empty()) // account not exist
+ {
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ return;
+ }
+
+ // check character count
+ uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
+ if (charcount >= 10)
+ {
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ return;
+ }
+
+ if (sObjectMgr->GetPlayerGUIDByName(delInfo.name))
+ {
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
+ return;
+ }
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
+ stmt->setString(0, delInfo.name);
+ stmt->setUInt32(1, delInfo.accountId);
+ stmt->setUInt32(2, delInfo.lowGuid);
+ CharacterDatabase.Execute(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
+ stmt->setUInt32(0, delInfo.lowGuid);
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
+ sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8());
+ }
+
+ static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
+ {
+ if (player)
+ {
+ player->GiveLevel(newLevel);
+ player->InitTalentForLevel();
+ player->SetUInt32Value(PLAYER_XP, 0);
+
+ if (handler->needReportToTarget(player))
+ {
+ if (oldLevel == newLevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, handler->GetNameLink().c_str());
+ else if (oldLevel < newLevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel);
+ else // if (oldlevel > newlevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel);
+ }
+ }
+ else
+ {
+ // Update level and reset XP, everything else will be updated at login
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
+ stmt->setUInt8(0, uint8(newLevel));
+ stmt->setUInt32(1, GUID_LOPART(playerGuid));
+ CharacterDatabase.Execute(stmt);
+ }
+ }
+
+ static bool HandleCharacterTitlesCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ LocaleConstant loc = handler->GetSessionDbcLocale();
+ char const* targetName = target->GetName();
+ char const* knownStr = handler->GetTrinityString(LANG_KNOWN);
+
+ // Search in CharTitles.dbc
+ for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
+ {
+ CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
+
+ if (titleInfo && target->HasTitle(titleInfo))
+ {
+ std::string name = titleInfo->name[loc];
+ if (name.empty())
+ continue;
+
+ char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
+ ? handler->GetTrinityString(LANG_ACTIVE)
+ : "";
+
+ char titleNameStr[80];
+ snprintf(titleNameStr, 80, name.c_str(), targetName);
+
+ // send title in "id (idx:idx) - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
+ else
+ handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
+ }
+ }
+
+ return true;
+ }
+
+ //rename characters
+ static bool HandleCharacterRenameCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
+ target->SetAtLoginFlag(AT_LOGIN_RENAME);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string oldNameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
+ stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ CharacterDatabase.Execute(stmt);
+ }
+
+ return true;
+ }
+
+ static bool HandleCharacterLevelCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* levelStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
+ if (!levelStr)
+ return false;
+
+ // exception opt second arg: .character level $name
+ if (isalpha(levelStr[0]))
+ {
+ nameStr = levelStr;
+ levelStr = NULL; // current level will used
+ }
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(targetGuid);
+ int32 newlevel = levelStr ? atoi(levelStr) : oldlevel;
+
+ if (newlevel < 1)
+ return false; // invalid level
+
+ if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
+ newlevel = STRONG_MAX_LEVEL;
+
+ HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
+ }
+
+ return true;
+ }
+
+ // customize characters
+ static bool HandleCharacterCustomizeCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
+ stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
+ if (target)
+ {
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
+ target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
+ stmt->setUInt32(1, target->GetGUIDLow());
+ }
+ else
+ {
+ std::string oldNameLink = handler->playerLink(targetName);
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ }
+ CharacterDatabase.Execute(stmt);
+
+ return true;
+ }
+
+ static bool HandleCharacterChangeFactionCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
+ stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION));
+ if (target)
+ {
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
+ target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
+ stmt->setUInt32(1, target->GetGUIDLow());
+ }
+ else
+ {
+ std::string oldNameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ }
+ CharacterDatabase.Execute(stmt);
+
+ return true;
+ }
+
+ static bool HandleCharacterChangeRaceCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
+ stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE));
+ if (target)
+ {
+ // TODO : add text into database
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
+ target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
+ stmt->setUInt32(1, target->GetGUIDLow());
+ }
+ else
+ {
+ std::string oldNameLink = handler->playerLink(targetName);
+ // TODO : add text into database
+ handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ }
+ CharacterDatabase.Execute(stmt);
+
+ return true;
+ }
+
+ static bool HandleCharacterReputationCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ LocaleConstant loc = handler->GetSessionDbcLocale();
+
+ FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
+ for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
+ {
+ FactionState const& faction = itr->second;
+ FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID);
+ char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
+ ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
+ std::string rankName = handler->GetTrinityString(ReputationRankStrIndex[rank]);
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
+ else
+ ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
+
+ ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
+
+ if (faction.Flags & FACTION_FLAG_VISIBLE)
+ ss << handler->GetTrinityString(LANG_FACTION_VISIBLE);
+ if (faction.Flags & FACTION_FLAG_AT_WAR)
+ ss << handler->GetTrinityString(LANG_FACTION_ATWAR);
+ if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
+ ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED);
+ if (faction.Flags & FACTION_FLAG_HIDDEN)
+ ss << handler->GetTrinityString(LANG_FACTION_HIDDEN);
+ if (faction.Flags & FACTION_FLAG_INVISIBLE_FORCED)
+ ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
+ if (faction.Flags & FACTION_FLAG_INACTIVE)
+ ss << handler->GetTrinityString(LANG_FACTION_INACTIVE);
+
+ handler->SendSysMessage(ss.str().c_str());
+ }
+
+ return true;
+ }
+
+ /**
+ * Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string
+ *
+ * @see HandleCharacterDeletedListHelper
+ * @see HandleCharacterDeletedRestoreCommand
+ * @see HandleCharacterDeletedDeleteCommand
+ * @see DeletedInfoList
+ *
+ * @param args the search string which either contains a player GUID or a part fo the character-name
+ */
+ static bool HandleCharacterDeletedListCommand(ChatHandler* handler, char const* args)
+ {
+ DeletedInfoList foundList;
+ if (!GetDeletedCharacterInfoList(foundList, args))
+ return false;
+
+ // if no characters have been found, output a warning
+ if (foundList.empty())
+ {
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
+ return false;
+ }
+
+ HandleCharacterDeletedListHelper(foundList, handler);
+
+ return true;
+ }
+
+ /**
+ * Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string
+ *
+ * The command automatically calls '.character deleted list' command with the search string to show all restored characters.
+ *
+ * @see HandleCharacterDeletedRestoreHelper
+ * @see HandleCharacterDeletedListCommand
+ * @see HandleCharacterDeletedDeleteCommand
+ *
+ * @param args the search string which either contains a player GUID or a part of the character-name
+ */
+ static bool HandleCharacterDeletedRestoreCommand(ChatHandler* handler, char const* args)
+ {
+ // It is required to submit at least one argument
+ if (!*args)
+ return false;
+
+ std::string searchString;
+ std::string newCharName;
+ uint32 newAccount = 0;
+
+ // GCC by some strange reason fail build code without temporary variable
+ std::istringstream params(args);
+ params >> searchString >> newCharName >> newAccount;
+
+ DeletedInfoList foundList;
+ if (!GetDeletedCharacterInfoList(foundList, searchString))
+ return false;
+
+ if (foundList.empty())
+ {
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
+ return false;
+ }
+
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_RESTORE);
+ HandleCharacterDeletedListHelper(foundList, handler);
+
+ if (newCharName.empty())
+ {
+ // Drop not existed account cases
+ for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
+ HandleCharacterDeletedRestoreHelper(*itr, handler);
+ }
+ else if (foundList.size() == 1 && normalizePlayerName(newCharName))
+ {
+ DeletedInfo delInfo = foundList.front();
+
+ // update name
+ delInfo.name = newCharName;
+
+ // if new account provided update deleted info
+ if (newAccount && newAccount != delInfo.accountId)
+ {
+ delInfo.accountId = newAccount;
+ AccountMgr::GetName(newAccount, delInfo.accountName);
+ }
+
+ HandleCharacterDeletedRestoreHelper(delInfo, handler);
+ }
+ else
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
+
+ return true;
+ }
+
+ /**
+ * Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string
+ *
+ * @see Player::GetDeletedCharacterGUIDs
+ * @see Player::DeleteFromDB
+ * @see HandleCharacterDeletedListCommand
+ * @see HandleCharacterDeletedRestoreCommand
+ *
+ * @param args the search string which either contains a player GUID or a part fo the character-name
+ */
+ static bool HandleCharacterDeletedDeleteCommand(ChatHandler* handler, char const* args)
+ {
+ // It is required to submit at least one argument
+ if (!*args)
+ return false;
+
+ DeletedInfoList foundList;
+ if (!GetDeletedCharacterInfoList(foundList, args))
+ return false;
+
+ if (foundList.empty())
+ {
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
+ return false;
+ }
+
+ handler->SendSysMessage(LANG_CHARACTER_DELETED_DELETE);
+ HandleCharacterDeletedListHelper(foundList, handler);
+
+ // Call the appropriate function to delete them (current account for deleted characters is 0)
+ for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
+ Player::DeleteFromDB(itr->lowGuid, 0, false, true);
+
+ return true;
+ }
+
+ /**
+ * Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago
+ *
+ * @see Player::DeleteOldCharacters
+ * @see Player::DeleteFromDB
+ * @see HandleCharacterDeletedDeleteCommand
+ * @see HandleCharacterDeletedListCommand
+ * @see HandleCharacterDeletedRestoreCommand
+ *
+ * @param args the search string which either contains a player GUID or a part fo the character-name
+ */
+ static bool HandleCharacterDeletedOldCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
+
+ char* daysStr = strtok((char*)args, " ");
+ if (daysStr)
+ {
+ if (!isNumeric(daysStr))
+ return false;
+
+ keepDays = atoi(daysStr);
+ if (keepDays < 0)
+ return false;
+ }
+ // config option value 0 -> disabled and can't be used
+ else if (keepDays <= 0)
+ return false;
+
+ Player::DeleteOldCharacters(uint32(keepDays));
+
+ return true;
+ }
+
+ static bool HandleCharacterEraseCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* characterName_str = strtok((char*)args, " ");
+ if (!characterName_str)
+ return false;
+
+ std::string characterName = characterName_str;
+ if (!normalizePlayerName(characterName))
+ return false;
+
+ uint64 characterGuid;
+ uint32 accountId;
+
+ Player* player = sObjectAccessor->FindPlayerByName(characterName.c_str());
+ if (player)
+ {
+ characterGuid = player->GetGUID();
+ accountId = player->GetSession()->GetAccountId();
+ player->GetSession()->KickPlayer();
+ }
+ else
+ {
+ characterGuid = sObjectMgr->GetPlayerGUIDByName(characterName);
+ if (!characterGuid)
+ {
+ handler->PSendSysMessage(LANG_NO_PLAYER, characterName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ accountId = sObjectMgr->GetPlayerAccountIdByGUID(characterGuid);
+ }
+
+ std::string accountName;
+ AccountMgr::GetName(accountId, accountName);
+
+ Player::DeleteFromDB(characterGuid, accountId, true, true);
+ handler->PSendSysMessage(LANG_CHARACTER_DELETED, characterName.c_str(), GUID_LOPART(characterGuid), accountName.c_str(), accountId);
+
+ return true;
+ }
+
+ static bool HandleLevelUpCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* levelStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
+
+ // exception opt second arg: .character level $name
+ if (levelStr && isalpha(levelStr[0]))
+ {
+ nameStr = levelStr;
+ levelStr = NULL; // current level will used
+ }
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(targetGuid);
+ int32 addlevel = levelStr ? atoi(levelStr) : 1;
+ int32 newlevel = oldlevel + addlevel;
+
+ if (newlevel < 1)
+ newlevel = 1;
+
+ if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
+ newlevel = STRONG_MAX_LEVEL;
+
+ HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
+
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == NULL
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
+ }
+
+ return true;
+ }
+
+ static bool HandlePDumpLoadCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* fileStr = strtok((char*)args, " ");
+ if (!fileStr)
+ return false;
+
+ char* accountStr = strtok(NULL, " ");
+ if (!accountStr)
+ return false;
+
+ std::string accountName = accountStr;
+ if (!AccountMgr::normalizeString(accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 accountId = AccountMgr::GetId(accountName);
+ if (!accountId)
+ {
+ accountId = atoi(accountStr); // use original string
+ if (!accountId)
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!AccountMgr::GetName(accountId, accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* guidStr = NULL;
+ char* nameStr = strtok(NULL, " ");
+
+ std::string name;
+ if (nameStr)
+ {
+ name = nameStr;
+ // normalize the name if specified and check if it exists
+ if (!normalizePlayerName(name))
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS)
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ guidStr = strtok(NULL, " ");
+ }
+
+ uint32 guid = 0;
+
+ if (guidStr)
+ {
+ guid = uint32(atoi(guidStr));
+ if (!guid)
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ {
+ handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ switch (PlayerDumpReader().LoadDump(fileStr, accountId, name, guid))
+ {
+ case DUMP_SUCCESS:
+ handler->PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
+ break;
+ case DUMP_FILE_OPEN_ERROR:
+ handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_FILE_BROKEN:
+ handler->PSendSysMessage(LANG_DUMP_BROKEN, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_TOO_MANY_CHARS:
+ handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName.c_str(), accountId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandlePDumpWriteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* fileStr = strtok((char*)args, " ");
+ char* playerStr = strtok(NULL, " ");
+
+ if (!fileStr || !playerStr)
+ return false;
+
+ uint64 guid;
+ // character name can't start from number
+ if (isNumeric(playerStr))
+ guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER);
+ else
+ {
+ std::string name = handler->extractPlayerNameFromLink(playerStr);
+ if (name.empty())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ guid = sObjectMgr->GetPlayerGUIDByName(name);
+ }
+
+ if (!sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ {
+ handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ switch (PlayerDumpWriter().WriteDump(fileStr, uint32(guid)))
+ {
+ case DUMP_SUCCESS:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
+ break;
+ case DUMP_FILE_OPEN_ERROR:
+ handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_CHARACTER_DELETED:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+};
+
+void AddSC_character_commandscript()
+{
+ new character_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 679bb450800..7f25a11bcdd 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -95,6 +95,7 @@ public:
static ChatCommand commandTable[] =
{
{ "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable },
+ { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL },
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
@@ -409,7 +410,7 @@ public:
}
else
{
- sLog->outError("Sending opcode that has unknown type '%s'", type.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str());
break;
}
}
@@ -1319,6 +1320,16 @@ public:
return true;
}
+
+ static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+
+ handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
+ return true;
+ }
};
void AddSC_debug_commandscript()
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
new file mode 100644
index 00000000000..0bb376b08dd
--- /dev/null
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -0,0 +1,371 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: disable_commandscript
+%Complete: 100
+Comment: All disable related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "ObjectMgr.h"
+#include "Chat.h"
+#include "DisableMgr.h"
+#include "OutdoorPvP.h"
+
+class disable_commandscript : public CommandScript
+{
+public:
+ disable_commandscript() : CommandScript("disable_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand removeDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleRemoveDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleRemoveDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleRemoveDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand addDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleAddDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleAddDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleAddDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand disableCommandTable[] =
+ {
+ { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable },
+ { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleAddDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ char* flagsStr = strtok(NULL, " ");
+ uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0;
+
+ char* commentStr = strtok(NULL, "");
+ if (!commentStr)
+ return false;
+
+ std::string disableComment = commentStr;
+ uint32 entry = uint32(atoi(entryStr));
+
+ std::string disableTypeStr = "";
+
+ switch (disableType)
+ {
+ case DISABLE_TYPE_SPELL:
+ {
+ if (!sSpellMgr->GetSpellInfo(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "spell";
+ break;
+ }
+ case DISABLE_TYPE_QUEST:
+ {
+ if (!sObjectMgr->GetQuestTemplate(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "quest";
+ break;
+ }
+ case DISABLE_TYPE_MAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "map";
+ break;
+ }
+ case DISABLE_TYPE_BATTLEGROUND:
+ {
+ if (!sBattlemasterListStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "battleground";
+ break;
+ }
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ {
+ if (!sAchievementCriteriaStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "achievement criteria";
+ break;
+ }
+ case DISABLE_TYPE_OUTDOORPVP:
+ {
+ if (entry > MAX_OUTDOORPVP_TYPES)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "outdoorpvp";
+ break;
+ }
+ case DISABLE_TYPE_VMAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "vmap";
+ break;
+ }
+ default:
+ break;
+ }
+
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (result)
+ {
+ handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ stmt->setUInt16(2, flags);
+ stmt->setString(3, disableComment);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Add Disabled %s (Id: %u) for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str());
+ return true;
+ }
+
+ static bool HandleAddDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleAddDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleAddDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleAddDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleAddDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleAddDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ HandleAddDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ return true;
+ }
+
+ static bool HandleAddDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+
+ static bool HandleRemoveDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ uint32 entry = uint32(atoi(entryStr));
+
+ std::string disableTypeStr = "";
+
+ switch (disableType)
+ {
+ case DISABLE_TYPE_SPELL:
+ disableTypeStr = "spell";
+ break;
+ case DISABLE_TYPE_QUEST:
+ disableTypeStr = "quest";
+ break;
+ case DISABLE_TYPE_MAP:
+ disableTypeStr = "map";
+ break;
+ case DISABLE_TYPE_BATTLEGROUND:
+ disableTypeStr = "battleground";
+ break;
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ disableTypeStr = "achievement criteria";
+ break;
+ case DISABLE_TYPE_OUTDOORPVP:
+ disableTypeStr = "outdoorpvp";
+ break;
+ case DISABLE_TYPE_VMAP:
+ disableTypeStr = "vmap";
+ break;
+ }
+
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Remove Disabled %s (Id: %u)", disableTypeStr.c_str(), entry);
+ return true;
+ }
+
+ static bool HandleRemoveDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleRemoveDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleRemoveDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleRemoveDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ }
+
+ static bool HandleRemoveDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+};
+
+void AddSC_disable_commandscript()
+{
+ new disable_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index d449b3617f7..3dfc6f9c7e8 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -196,11 +196,16 @@ public:
return true;
}
+ const uint32 VISUAL_AURA = 37800;
std::string param = (char*)args;
+ Player* player = handler->GetSession()->GetPlayer();
if (param == "on")
{
- handler->GetSession()->GetPlayer()->SetGMVisible(true);
+ if (player->HasAura(VISUAL_AURA, 0))
+ player->RemoveAurasDueToSpell(VISUAL_AURA);
+
+ player->SetGMVisible(true);
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
return true;
}
@@ -208,7 +213,10 @@ public:
if (param == "off")
{
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
- handler->GetSession()->GetPlayer()->SetGMVisible(false);
+ player->SetGMVisible(false);
+
+ player->AddAura(VISUAL_AURA, player);
+
return true;
}
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 232aad9f21c..167c56c20a2 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -133,7 +133,7 @@ public:
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
{
// report to DB errors log as in loading case
- sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId);
handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId);
handler->SetSentErrorMessage(true);
return false;
diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp
deleted file mode 100644
index 59e2ec90905..00000000000
--- a/src/server/scripts/Commands/cs_gps.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2008-2012 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/>.
- */
-
-/* ScriptData
-Name: gps_commandscript
-%Complete: 100
-Comment: GPS/WPGPS commands
-Category: commandscripts
-EndScriptData */
-
-#include "ObjectAccessor.h"
-#include "ScriptMgr.h"
-#include "Chat.h"
-#include "CellImpl.h"
-
-class gps_commandscript : public CommandScript
-{
-public:
- gps_commandscript() : CommandScript("gps_commandscript") { }
-
- ChatCommand* GetCommands() const
- {
- static ChatCommand commandTable[] =
- {
- { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
- { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
-
- static bool HandleGPSCommand(ChatHandler* handler, char const* args)
- {
- WorldObject* object = NULL;
- if (*args)
- {
- uint64 guid = handler->extractGuidFromLink((char*)args);
- if (guid)
- object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
-
- if (!object)
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- object = handler->getSelectedUnit();
-
- if (!object)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
- Cell cell(cellCoord);
-
- uint32 zoneId, areaId;
- object->GetZoneAndAreaId(zoneId, areaId);
-
- MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
- AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
-
- float zoneX = object->GetPositionX();
- float zoneY = object->GetPositionY();
-
- Map2ZoneCoordinates(zoneX, zoneY, zoneId);
-
- Map const* map = object->GetMap();
- float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
- float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
-
- GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
-
- // 63? WHY?
- int gridX = 63 - gridCoord.x_coord;
- int gridY = 63 - gridCoord.y_coord;
-
- uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
- uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
-
- if (haveVMap)
- {
- if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
- handler->PSendSysMessage("You are outdoors");
- else
- handler->PSendSysMessage("You are indoors");
- }
- else
- handler->PSendSysMessage("no VMAP available for area info");
-
- handler->PSendSysMessage(LANG_MAP_POSITION,
- object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
- zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- object->GetPhaseMask(),
- object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
- cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
- zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
-
- LiquidData liquidStatus;
- ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
-
- if (status)
- handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
-
- return true;
- }
-
- static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
-
- sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
-
- handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
- return true;
- }
-};
-
-void AddSC_gps_commandscript()
-{
- new gps_commandscript();
-}
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
new file mode 100644
index 00000000000..a453122aef6
--- /dev/null
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: guild_commandscript
+%Complete: 100
+Comment: All guild related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "Guild.h"
+#include "GuildMgr.h"
+#include "ObjectAccessor.h"
+
+class guild_commandscript : public CommandScript
+{
+public:
+ guild_commandscript() : CommandScript("guild_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand guildCommandTable[] =
+ {
+ { "create", SEC_GAMEMASTER, true, &HandleGuildCreateCommand, "", NULL },
+ { "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "", NULL },
+ { "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "", NULL },
+ { "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "", NULL },
+ { "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ /** \brief GM command level 3 - Create a guild.
+ *
+ * This command allows a GM (level 3) to create a guild.
+ *
+ * The "args" parameter contains the name of the guild leader
+ * and then the name of the guild.
+ *
+ */
+ static bool HandleGuildCreateCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // if not guild name only (in "") then player name
+ Player* target;
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
+ return false;
+
+ char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ if (!tailStr)
+ return false;
+
+ char* guildStr = handler->extractQuotedArg(tailStr);
+ if (!guildStr)
+ return false;
+
+ std::string guildName = guildStr;
+
+ if (target->GetGuildId())
+ {
+ handler->SendSysMessage(LANG_PLAYER_IN_GUILD);
+ return true;
+ }
+
+ Guild* guild = new Guild;
+ if (!guild->Create(target, guildName))
+ {
+ delete guild;
+ handler->SendSysMessage(LANG_GUILD_NOT_CREATED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ sGuildMgr->AddGuild(guild);
+
+ return true;
+ }
+
+ static bool HandleGuildDeleteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* guildStr = handler->extractQuotedArg((char*)args);
+ if (!guildStr)
+ return false;
+
+ std::string guildName = guildStr;
+
+ Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
+ if (!targetGuild)
+ return false;
+
+ targetGuild->Disband();
+
+ return true;
+ }
+
+ static bool HandleGuildInviteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // if not guild name only (in "") then player name
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid))
+ return false;
+
+ char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
+ if (!tailStr)
+ return false;
+
+ char* guildStr = handler->extractQuotedArg(tailStr);
+ if (!guildStr)
+ return false;
+
+ std::string guildName = guildStr;
+ Guild* targetGuild = sGuildMgr->GetGuildByName(guildName);
+ if (!targetGuild)
+ return false;
+
+ // player's guild membership checked in AddMember before add
+ return targetGuild->AddMember(targetGuid);
+ }
+
+ static bool HandleGuildUninviteCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
+ if (!guildId)
+ return false;
+
+ Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
+ if (!targetGuild)
+ return false;
+
+ targetGuild->DeleteMember(targetGuid, false, true);
+ return true;
+ }
+
+ static bool HandleGuildRankCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* rankStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &rankStr);
+ if (!rankStr)
+ return false;
+
+ Player* target;
+ uint64 targetGuid;
+ std::string target_name;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
+ return false;
+
+ uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
+ if (!guildId)
+ return false;
+
+ Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
+ if (!targetGuild)
+ return false;
+
+ uint8 newRank = uint8(atoi(rankStr));
+ return targetGuild->ChangeMemberRank(targetGuid, newRank);
+ }
+};
+
+void AddSC_guild_commandscript()
+{
+ new guild_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
new file mode 100644
index 00000000000..f51727af2ef
--- /dev/null
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: instance_commandscript
+%Complete: 100
+Comment: All instance related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "Group.h"
+#include "InstanceSaveMgr.h"
+#include "InstanceScript.h"
+#include "MapManager.h"
+
+class instance_commandscript : public CommandScript
+{
+public:
+ instance_commandscript() : CommandScript("instance_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand instanceCommandTable[] =
+ {
+ { "listbinds", SEC_ADMINISTRATOR, false, &HandleInstanceListBindsCommand, "", NULL },
+ { "unbind", SEC_ADMINISTRATOR, false, &HandleInstanceUnbindCommand, "", NULL },
+ { "stats", SEC_ADMINISTRATOR, true, &HandleInstanceStatsCommand, "", NULL },
+ { "savedata", SEC_ADMINISTRATOR, false, &HandleInstanceSaveDataCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ return commandTable;
+ }
+
+ static std::string GetTimeString(uint64 time)
+ {
+ uint64 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE;
+ std::ostringstream ss;
+ if (days)
+ ss << days << "d ";
+ if (hours)
+ ss << hours << "h ";
+ ss << minute << 'm';
+ return ss.str();
+ }
+
+ static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ player = handler->GetSession()->GetPlayer();
+
+ uint32 counter = 0;
+ for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
+ {
+ Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
+ for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
+ {
+ InstanceSave* save = itr->second.save;
+ std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
+ handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
+ counter++;
+ }
+ }
+ handler->PSendSysMessage("player binds: %d", counter);
+
+ counter = 0;
+ if (Group* group = player->GetGroup())
+ {
+ for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
+ {
+ Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i));
+ for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
+ {
+ InstanceSave* save = itr->second.save;
+ std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
+ handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
+ counter++;
+ }
+ }
+ }
+ handler->PSendSysMessage("group binds: %d", counter);
+
+ return true;
+ }
+
+ static bool HandleInstanceUnbindCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ player = handler->GetSession()->GetPlayer();
+
+ char* map = strtok((char*)args, " ");
+ char* pDiff = strtok(NULL, " ");
+ int8 diff = -1;
+ if (pDiff)
+ diff = atoi(pDiff);
+ uint16 counter = 0;
+ uint16 MapId = 0;
+
+ if (strcmp(map, "all"))
+ {
+ MapId = uint16(atoi(map));
+ if (!MapId)
+ return false;
+ }
+
+ for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
+ {
+ Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
+ for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
+ {
+ InstanceSave* save = itr->second.save;
+ if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
+ {
+ std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
+ handler->PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
+ player->UnbindInstance(itr, Difficulty(i));
+ counter++;
+ }
+ else
+ ++itr;
+ }
+ }
+ handler->PSendSysMessage("instances unbound: %d", counter);
+
+ return true;
+ }
+
+ static bool HandleInstanceStatsCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->PSendSysMessage("instances loaded: %d", sMapMgr->GetNumInstances());
+ handler->PSendSysMessage("players in instances: %d", sMapMgr->GetNumPlayersInInstances());
+ handler->PSendSysMessage("instance saves: %d", sInstanceSaveMgr->GetNumInstanceSaves());
+ handler->PSendSysMessage("players bound: %d", sInstanceSaveMgr->GetNumBoundPlayersTotal());
+ handler->PSendSysMessage("groups bound: %d", sInstanceSaveMgr->GetNumBoundGroupsTotal());
+
+ return true;
+ }
+
+ static bool HandleInstanceSaveDataCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ Map* map = player->GetMap();
+ if (!map->IsDungeon())
+ {
+ handler->PSendSysMessage("Map is not a dungeon.");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (!((InstanceMap*)map)->GetInstanceScript())
+ {
+ handler->PSendSysMessage("Map has no instance data.");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ ((InstanceMap*)map)->GetInstanceScript()->SaveToDB();
+
+ return true;
+ }
+};
+
+void AddSC_instance_commandscript()
+{
+ new instance_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index ae573577d7e..cfdfc66f991 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -22,10 +22,10 @@ Comment: All learn related commands
Category: commandscripts
EndScriptData */
+#include "Chat.h"
#include "ScriptMgr.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
-#include "Chat.h"
#include "SpellInfo.h"
class learn_commandscript : public CommandScript
@@ -37,35 +37,36 @@ public:
{
static ChatCommand learnAllMyCommandTable[] =
{
- { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL },
- { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL },
- { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL },
- { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL },
+ { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL },
+ { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL },
+ { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand learnAllCommandTable[] =
{
- { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable },
- { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL },
- { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL },
- { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL },
- { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL },
- { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable },
+ { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL },
+ { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL },
+ { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL },
+ { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL },
+ { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand learnCommandTable[] =
{
- { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable },
- { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable },
+ { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
- { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable },
+ { "unlearn", SEC_ADMINISTRATOR, false, &HandleUnLearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
return commandTable;
}
@@ -466,6 +467,41 @@ public:
player->learnSpell(skillLine->spellId, false);
}
}
+
+ static bool HandleUnLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ char const* allStr = strtok(NULL, " ");
+ bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (allRanks)
+ spellId = sSpellMgr->GetFirstSpellInChain (spellId);
+
+ if (target->HasSpell(spellId))
+ target->removeSpell(spellId, false, !allRanks);
+ else
+ handler->SendSysMessage(LANG_FORGET_SPELL);
+
+ if (GetTalentSpellCost(spellId))
+ target->SendTalentsInfoData(false);
+
+ return true;
+ }
};
void AddSC_learn_commandscript()
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
new file mode 100644
index 00000000000..5c16a0963d3
--- /dev/null
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -0,0 +1,469 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: list_commandscript
+%Complete: 100
+Comment: All list related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "SpellAuraEffects.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+
+class list_commandscript : public CommandScript
+{
+public:
+ list_commandscript() : CommandScript("list_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand listCommandTable[] =
+ {
+ { "creature", SEC_ADMINISTRATOR, true, &HandleListCreatureCommand, "", NULL },
+ { "item", SEC_ADMINISTRATOR, true, &HandleListItemCommand, "", NULL },
+ { "object", SEC_ADMINISTRATOR, true, &HandleListObjectCommand, "", NULL },
+ { "auras", SEC_ADMINISTRATOR, false, &HandleListAurasCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleListCreatureCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
+ char* id = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
+ if (!id)
+ return false;
+
+ uint32 creatureId = atol(id);
+ if (!creatureId)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureId);
+ if (!cInfo)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* countStr = strtok(NULL, " ");
+ uint32 count = countStr ? atol(countStr) : 10;
+
+ if (count == 0)
+ return false;
+
+ QueryResult result;
+
+ uint32 creatureCount = 0;
+ result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", creatureId);
+ if (result)
+ creatureCount = (*result)[0].GetUInt64();
+
+ if (handler->GetSession())
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), creatureId, count);
+ }
+ else
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
+ creatureId, count);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 guid = fields[0].GetUInt32();
+ float x = fields[1].GetFloat();
+ float y = fields[2].GetFloat();
+ float z = fields[3].GetFloat();
+ uint16 mapId = fields[4].GetUInt16();
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapId);
+ else
+ handler->PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapId);
+ }
+ while (result->NextRow());
+ }
+
+ handler->PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, creatureId, creatureCount);
+
+ return true;
+ }
+
+ static bool HandleListItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* id = handler->extractKeyFromLink((char*)args, "Hitem");
+ if (!id)
+ return false;
+
+ uint32 itemId = atol(id);
+ if (!itemId)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
+ if (!itemTemplate)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* countStr = strtok(NULL, " ");
+ uint32 count = countStr ? atol(countStr) : 10;
+
+ if (count == 0)
+ return false;
+
+ PreparedQueryResult result;
+
+ // inventory case
+ uint32 inventoryCount = 0;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
+ stmt->setUInt32(0, itemId);
+ result = CharacterDatabase.Query(stmt);
+
+ if (result)
+ inventoryCount = (*result)[0].GetUInt64();
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY);
+ stmt->setUInt32(0, itemId);
+ stmt->setUInt32(1, count);
+ result = CharacterDatabase.Query(stmt);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 itemGuid = fields[0].GetUInt32();
+ uint32 itemBag = fields[1].GetUInt32();
+ uint8 itemSlot = fields[2].GetUInt8();
+ uint32 ownerGuid = fields[3].GetUInt32();
+ uint32 ownerAccountId = fields[4].GetUInt32();
+ std::string ownerName = fields[5].GetString();
+
+ char const* itemPos = 0;
+ if (Player::IsEquipmentPos(itemBag, itemSlot))
+ itemPos = "[equipped]";
+ else if (Player::IsInventoryPos(itemBag, itemSlot))
+ itemPos = "[in inventory]";
+ else if (Player::IsBankPos(itemBag, itemSlot))
+ itemPos = "[in bank]";
+ else
+ itemPos = "";
+
+ handler->PSendSysMessage(LANG_ITEMLIST_SLOT, itemGuid, ownerName.c_str(), ownerGuid, ownerAccountId, itemPos);
+ }
+ while (result->NextRow());
+
+ uint32 resultCount = uint32(result->GetRowCount());
+
+ if (count > resultCount)
+ count -= resultCount;
+ else if (count)
+ count = 0;
+ }
+
+ // mail case
+ uint32 mailCount = 0;
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM);
+ stmt->setUInt32(0, itemId);
+ result = CharacterDatabase.Query(stmt);
+
+ if (result)
+ mailCount = (*result)[0].GetUInt64();
+
+ if (count > 0)
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY);
+ stmt->setUInt32(0, itemId);
+ stmt->setUInt32(1, count);
+ result = CharacterDatabase.Query(stmt);
+ }
+ else
+ result = PreparedQueryResult(NULL);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 itemGuid = fields[0].GetUInt32();
+ uint32 itemSender = fields[1].GetUInt32();
+ uint32 itemReceiver = fields[2].GetUInt32();
+ uint32 itemSenderAccountId = fields[3].GetUInt32();
+ std::string itemSenderName = fields[4].GetString();
+ uint32 itemReceiverAccount = fields[5].GetUInt32();
+ std::string itemReceiverName = fields[6].GetString();
+
+ char const* itemPos = "[in mail]";
+
+ handler->PSendSysMessage(LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos);
+ }
+ while (result->NextRow());
+
+ uint32 resultCount = uint32(result->GetRowCount());
+
+ if (count > resultCount)
+ count -= resultCount;
+ else if (count)
+ count = 0;
+ }
+
+ // auction case
+ uint32 auctionCount = 0;
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM);
+ stmt->setUInt32(0, itemId);
+ result = CharacterDatabase.Query(stmt);
+
+ if (result)
+ auctionCount = (*result)[0].GetUInt64();
+
+ if (count > 0)
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY);
+ stmt->setUInt32(0, itemId);
+ stmt->setUInt32(1, count);
+ result = CharacterDatabase.Query(stmt);
+ }
+ else
+ result = PreparedQueryResult(NULL);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 itemGuid = fields[0].GetUInt32();
+ uint32 owner = fields[1].GetUInt32();
+ uint32 ownerAccountId = fields[2].GetUInt32();
+ std::string ownerName = fields[3].GetString();
+
+ char const* itemPos = "[in auction]";
+
+ handler->PSendSysMessage(LANG_ITEMLIST_AUCTION, itemGuid, ownerName.c_str(), owner, ownerAccountId, itemPos);
+ }
+ while (result->NextRow());
+ }
+
+ // guild bank case
+ uint32 guildCount = 0;
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM);
+ stmt->setUInt32(0, itemId);
+ result = CharacterDatabase.Query(stmt);
+
+ if (result)
+ guildCount = (*result)[0].GetUInt64();
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY);
+ stmt->setUInt32(0, itemId);
+ stmt->setUInt32(1, count);
+ result = CharacterDatabase.Query(stmt);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 itemGuid = fields[0].GetUInt32();
+ uint32 guildGuid = fields[1].GetUInt32();
+ std::string guildName = fields[2].GetString();
+
+ char const* itemPos = "[in guild bank]";
+
+ handler->PSendSysMessage(LANG_ITEMLIST_GUILD, itemGuid, guildName.c_str(), guildGuid, itemPos);
+ }
+ while (result->NextRow());
+
+ uint32 resultCount = uint32(result->GetRowCount());
+
+ if (count > resultCount)
+ count -= resultCount;
+ else if (count)
+ count = 0;
+ }
+
+ if (inventoryCount + mailCount + auctionCount + guildCount == 0)
+ {
+ handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, itemId, inventoryCount + mailCount + auctionCount + guildCount, inventoryCount, mailCount, auctionCount, guildCount);
+
+ return true;
+ }
+
+ static bool HandleListObjectCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
+ char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
+ if (!id)
+ return false;
+
+ uint32 gameObjectId = atol(id);
+ if (!gameObjectId)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(gameObjectId);
+ if (!gInfo)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* countStr = strtok(NULL, " ");
+ uint32 count = countStr ? atol(countStr) : 10;
+
+ if (count == 0)
+ return false;
+
+ QueryResult result;
+
+ uint32 objectCount = 0;
+ result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", gameObjectId);
+ if (result)
+ objectCount = (*result)[0].GetUInt64();
+
+ if (handler->GetSession())
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), gameObjectId, count);
+ }
+ else
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
+ gameObjectId, count);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 guid = fields[0].GetUInt32();
+ float x = fields[1].GetFloat();
+ float y = fields[2].GetFloat();
+ float z = fields[3].GetFloat();
+ uint16 mapId = fields[4].GetUInt16();
+ uint32 entry = fields[5].GetUInt32();
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapId);
+ else
+ handler->PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapId);
+ }
+ while (result->NextRow());
+ }
+
+ handler->PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, gameObjectId, objectCount);
+
+ return true;
+ }
+
+ static bool HandleListAurasCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char const* talentStr = handler->GetTrinityString(LANG_TALENT);
+ char const* passiveStr = handler->GetTrinityString(LANG_PASSIVE);
+
+ Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras();
+ handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());
+ for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
+ {
+ bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
+
+ AuraApplication const* aurApp = itr->second;
+ Aura const* aura = aurApp->GetBase();
+ char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()];
+
+ std::ostringstream ss_name;
+ ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
+
+ handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
+ aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
+ aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
+ (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
+ GUID_LOPART(aura->GetCasterGUID()));
+ }
+
+ for (uint16 i = 0; i < TOTAL_AURAS; ++i)
+ {
+ Unit::AuraEffectList const& auraList = unit->GetAuraEffectsByType(AuraType(i));
+ if (auraList.empty())
+ continue;
+
+ handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, auraList.size(), i);
+
+ for (Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr)
+ handler->PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), (*itr)->GetAmount());
+ }
+
+ return true;
+ }
+};
+
+void AddSC_list_commandscript()
+{
+ new list_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
new file mode 100644
index 00000000000..951ebc7714b
--- /dev/null
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -0,0 +1,1392 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: lookup_commandscript
+%Complete: 100
+Comment: All lookup related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "AccountMgr.h"
+#include "GameEventMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+
+class lookup_commandscript : public CommandScript
+{
+public:
+ lookup_commandscript() : CommandScript("lookup_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand lookupPlayerCommandTable[] =
+ {
+ { "ip", SEC_GAMEMASTER, true, &HandleLookupPlayerIpCommand, "", NULL },
+ { "account", SEC_GAMEMASTER, true, &HandleLookupPlayerAccountCommand, "", NULL },
+ { "email", SEC_GAMEMASTER, true, &HandleLookupPlayerEmailCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand lookupCommandTable[] =
+ {
+ { "area", SEC_MODERATOR, true, &HandleLookupAreaCommand, "", NULL },
+ { "creature", SEC_ADMINISTRATOR, true, &HandleLookupCreatureCommand, "", NULL },
+ { "event", SEC_GAMEMASTER, true, &HandleLookupEventCommand, "", NULL },
+ { "faction", SEC_ADMINISTRATOR, true, &HandleLookupFactionCommand, "", NULL },
+ { "item", SEC_ADMINISTRATOR, true, &HandleLookupItemCommand, "", NULL },
+ { "itemset", SEC_ADMINISTRATOR, true, &HandleLookupItemSetCommand, "", NULL },
+ { "object", SEC_ADMINISTRATOR, true, &HandleLookupObjectCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleLookupQuestCommand, "", NULL },
+ { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable },
+ { "skill", SEC_ADMINISTRATOR, true, &HandleLookupSkillCommand, "", NULL },
+ { "spell", SEC_ADMINISTRATOR, true, &HandleLookupSpellCommand, "", NULL },
+ { "taxinode", SEC_ADMINISTRATOR, true, &HandleLookupTaxiNodeCommand, "", NULL },
+ { "tele", SEC_MODERATOR, true, &HandleLookupTeleCommand, "", NULL },
+ { "title", SEC_GAMEMASTER, true, &HandleLookupTitleCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleLookupMapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleLookupAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ // Search in AreaTable.dbc
+ for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
+ {
+ AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
+ if (areaEntry)
+ {
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = areaEntry->area_name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = areaEntry->area_name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send area in "id - [name]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[locale]<< "]|h|r";
+ else
+ ss << areaEntry->ID << " - " << name << ' ' << localeNames[locale];
+
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOAREAFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupCreatureCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
+ {
+ uint32 id = itr->second.Entry;
+ uint8 localeIndex = handler->GetSessionDbLocaleIndex();
+ if (CreatureLocale const* creatureLocale = sObjectMgr->GetCreatureLocale(id))
+ {
+ if (creatureLocale->Name.size() > localeIndex && !creatureLocale->Name[localeIndex].empty())
+ {
+ std::string name = creatureLocale->Name[localeIndex];
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+
+ std::string name = itr->second.Name;
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupEventCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
+ GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
+
+ for (uint32 id = 0; id < events.size(); ++id)
+ {
+ GameEventData const& eventData = events[id];
+
+ std::string descr = eventData.description;
+ if (descr.empty())
+ continue;
+
+ if (Utf8FitTo(descr, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* active = activeEvents.find(id) != activeEvents.end() ? handler->GetTrinityString(LANG_ACTIVE) : "";
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
+ else
+ handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_NOEVENTFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupFactionCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // Can be NULL at console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower (wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
+ {
+ FactionEntry const* factionEntry = sFactionStore.LookupEntry(id);
+ if (factionEntry)
+ {
+ FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
+
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = factionEntry->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = factionEntry->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
+ // or "id - [faction] [no reputation]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[locale] << "]|h|r";
+ else
+ ss << id << " - " << name << ' ' << localeNames[locale];
+
+ if (factionState) // and then target != NULL also
+ {
+ uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry);
+ std::string rankName = handler->GetTrinityString(index);
+
+ ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
+
+ if (factionState->Flags & FACTION_FLAG_VISIBLE)
+ ss << handler->GetTrinityString(LANG_FACTION_VISIBLE);
+ if (factionState->Flags & FACTION_FLAG_AT_WAR)
+ ss << handler->GetTrinityString(LANG_FACTION_ATWAR);
+ if (factionState->Flags & FACTION_FLAG_PEACE_FORCED)
+ ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED);
+ if (factionState->Flags & FACTION_FLAG_HIDDEN)
+ ss << handler->GetTrinityString(LANG_FACTION_HIDDEN);
+ if (factionState->Flags & FACTION_FLAG_INVISIBLE_FORCED)
+ ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED);
+ if (factionState->Flags & FACTION_FLAG_INACTIVE)
+ ss << handler->GetTrinityString(LANG_FACTION_INACTIVE);
+ }
+ else
+ ss << handler->GetTrinityString(LANG_FACTION_NOREPUTATION);
+
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND);
+ return true;
+ }
+
+ static bool HandleLookupItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in `item_template`
+ ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
+ for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
+ {
+ int localeIndex = handler->GetSessionDbLocaleIndex();
+ if (localeIndex >= 0)
+ {
+ uint8 ulocaleIndex = uint8(localeIndex);
+ if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId))
+ {
+ if (il->Name.size() > ulocaleIndex && !il->Name[ulocaleIndex].empty())
+ {
+ std::string name = il->Name[ulocaleIndex];
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+ }
+
+ std::string name = itr->second.Name1;
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupItemSetCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in ItemSet.dbc
+ for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
+ {
+ ItemSetEntry const* set = sItemSetStore.LookupEntry(id);
+ if (set)
+ {
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = set->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = set->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send item set in "id - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[locale]);
+ else
+ handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[locale]);
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOITEMSETFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupObjectCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
+ for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
+ {
+ uint8 localeIndex = handler->GetSessionDbLocaleIndex();
+ if (GameObjectLocale const* objectLocalte = sObjectMgr->GetGameObjectLocale(itr->second.entry))
+ {
+ if (objectLocalte->Name.size() > localeIndex && !objectLocalte->Name[localeIndex].empty())
+ {
+ std::string name = objectLocalte->Name[localeIndex];
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+
+ std::string name = itr->second.name;
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str());
+ else
+ handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL at console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates();
+ for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
+ {
+ Quest* qInfo = iter->second;
+
+ int localeIndex = handler->GetSessionDbLocaleIndex();
+ if (localeIndex >= 0)
+ {
+ uint8 ulocaleIndex = uint8(localeIndex);
+ if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(qInfo->GetQuestId()))
+ {
+ if (questLocale->Title.size() > ulocaleIndex && !questLocale->Title[ulocaleIndex].empty())
+ {
+ std::string title = questLocale->Title[ulocaleIndex];
+
+ if (Utf8FitTo(title, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* statusStr = "";
+
+ if (target)
+ {
+ QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId());
+
+ switch (status)
+ {
+ case QUEST_STATUS_COMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
+ break;
+ case QUEST_STATUS_INCOMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
+ break;
+ case QUEST_STATUS_REWARDED:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, qInfo->GetQuestId(), qInfo->GetQuestId(), qInfo->GetQuestLevel(), title.c_str(), statusStr);
+ else
+ handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qInfo->GetQuestId(), title.c_str(), statusStr);
+
+ if (!found)
+ found = true;
+
+ continue;
+ }
+ }
+ }
+ }
+
+ std::string title = qInfo->GetTitle();
+ if (title.empty())
+ continue;
+
+ if (Utf8FitTo(title, wNamePart))
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* statusStr = "";
+
+ if (target)
+ {
+ QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId());
+
+ switch (status)
+ {
+ case QUEST_STATUS_COMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
+ break;
+ case QUEST_STATUS_INCOMPLETE:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
+ break;
+ case QUEST_STATUS_REWARDED:
+ statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, qInfo->GetQuestId(), qInfo->GetQuestId(), qInfo->GetQuestLevel(), title.c_str(), statusStr);
+ else
+ handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qInfo->GetQuestId(), title.c_str(), statusStr);
+
+ if (!found)
+ found = true;
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOQUESTFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupSkillCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL in console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in SkillLine.dbc
+ for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
+ {
+ SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id);
+ if (skillInfo)
+ {
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = skillInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = skillInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char valStr[50] = "";
+ char const* knownStr = "";
+ if (target && target->HasSkill(id))
+ {
+ knownStr = handler->GetTrinityString(LANG_KNOWN);
+ uint32 curValue = target->GetPureSkillValue(id);
+ uint32 maxValue = target->GetPureMaxSkillValue(id);
+ uint32 permValue = target->GetSkillPermBonusValue(id);
+ uint32 tempValue = target->GetSkillTempBonusValue(id);
+
+ char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES);
+ snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue);
+ }
+
+ // send skill in "id - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[locale], knownStr, valStr);
+ else
+ handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[locale], knownStr, valStr);
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOSKILLFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL at console call
+ Player* target = handler->getSelectedPlayer();
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in Spell.dbc
+ for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
+ if (spellInfo)
+ {
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = spellInfo->SpellName[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = spellInfo->SpellName[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ bool known = target && target->HasSpell(id);
+ bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
+
+ SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
+
+ uint32 talentCost = GetTalentSpellCost(id);
+
+ bool talent = (talentCost > 0);
+ bool passive = spellInfo->IsPassive();
+ bool active = target && target->HasAura(id);
+
+ // unit32 used to prevent interpreting uint8 as char at output
+ // find rank of learned spell for learning spell, or talent rank
+ uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
+
+ // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
+ std::ostringstream ss;
+ if (handler->GetSession())
+ ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
+ else
+ ss << id << " - " << name;
+
+ // include rank in link name
+ if (rank)
+ ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
+
+ if (handler->GetSession())
+ ss << ' ' << localeNames[locale] << "]|h|r";
+ else
+ ss << ' ' << localeNames[locale];
+
+ if (talent)
+ ss << handler->GetTrinityString(LANG_TALENT);
+ if (passive)
+ ss << handler->GetTrinityString(LANG_PASSIVE);
+ if (learn)
+ ss << handler->GetTrinityString(LANG_LEARN);
+ if (known)
+ ss << handler->GetTrinityString(LANG_KNOWN);
+ if (active)
+ ss << handler->GetTrinityString(LANG_ACTIVE);
+
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupTaxiNodeCommand(ChatHandler* handler, const char * args)
+ {
+ if (!*args)
+ return false;
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ bool found = false;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in TaxiNodes.dbc
+ for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
+ {
+ TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id);
+ if (nodeEntry)
+ {
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = nodeEntry->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = nodeEntry->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[locale],
+ nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
+ else
+ handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[locale],
+ nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND);
+
+ return true;
+ }
+
+ // Find tele in game_tele order by name
+ static bool HandleLookupTeleCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TELE_PARAMETER);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char const* str = strtok((char*)args, " ");
+ if (!str)
+ return false;
+
+ std::string namePart = str;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ std::ostringstream reply;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+ bool limitReached = false;
+
+ GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
+ for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
+ {
+ GameTele const* tele = &itr->second;
+
+ if (tele->wnameLow.find(wNamePart) == std::wstring::npos)
+ continue;
+
+ if (maxResults && count++ == maxResults)
+ {
+ limitReached = true;
+ break;
+ }
+
+ if (handler->GetSession())
+ reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
+ else
+ reply << " " << itr->first << ' ' << tele->name << "\n";
+ }
+
+ if (reply.str().empty())
+ handler->SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
+
+ if (limitReached)
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+
+ return true;
+ }
+
+ static bool HandleLookupTitleCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // can be NULL in console call
+ Player* target = handler->getSelectedPlayer();
+
+ // title name have single string arg for player name
+ char const* targetName = target ? target->GetName() : "NAME";
+
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ // converting string that we try to find to lower case
+ wstrToLower(wNamePart);
+
+ uint32 counter = 0; // Counter for figure out that we found smth.
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ // Search in CharTitles.dbc
+ for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
+ {
+ CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
+ if (titleInfo)
+ {
+ int locale = handler->GetSessionDbcLocale();
+ std::string name = titleInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
+ {
+ if (locale == handler->GetSessionDbcLocale())
+ continue;
+
+ name = titleInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ if (maxResults && counter == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
+
+ char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
+ ? handler->GetTrinityString(LANG_ACTIVE)
+ : "";
+
+ char titleNameStr[80];
+ snprintf(titleNameStr, 80, name.c_str(), targetName);
+
+ // send title in "id (idx:idx) - [namedlink locale]" format
+ if (handler->GetSession())
+ handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[locale], knownStr, activeStr);
+ else
+ handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[locale], knownStr, activeStr);
+
+ ++counter;
+ }
+ }
+ }
+ if (counter == 0) // if counter == 0 then we found nth
+ handler->SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
+
+ return true;
+ }
+
+ static bool HandleLookupMapCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+ /*
+ std::string namePart = args;
+ std::wstring wNamePart;
+
+ // converting string that we try to find to lower case
+ if (!Utf8toWStr(namePart, wNamePart))
+ return false;
+
+ wstrToLower(wNamePart);
+
+ bool found = false;
+
+ // search in Map.dbc
+ for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
+ {
+ MapEntry const* MapInfo = sMapStore.LookupEntry(id);
+ if (MapInfo)
+ {
+ uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
+
+ std::string name = MapInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (!Utf8FitTo(name, wNamePart))
+ {
+ locale = LOCALE_enUS;
+ for (; locale < TOTAL_LOCALES; locale++)
+ {
+ if (handler->GetSession() && locale == handler->GetSession()->GetSessionDbcLocale())
+ continue;
+
+ name = MapInfo->name[locale];
+ if (name.empty())
+ continue;
+
+ if (Utf8FitTo(name, wNamePart))
+ break;
+ }
+ }
+
+ if (locale < TOTAL_LOCALES)
+ {
+ // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
+ std::ostringstream ss;
+
+ if (handler->GetSession())
+ ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']';
+ else // console
+ ss << id << " - [" << name << ']';
+
+ if (MapInfo->IsContinent())
+ ss << handler->GetTrinityString(LANG_CONTINENT);
+
+ switch (MapInfo->map_type)
+ {
+ case MAP_INSTANCE: ss << handler->GetTrinityString(LANG_INSTANCE); break;
+ case MAP_BATTLEGROUND: ss << handler->GetTrinityString(LANG_BATTLEGROUND); break;
+ case MAP_ARENA: ss << handler->GetTrinityString(LANG_ARENA); break;
+ }
+
+ if (MapInfo->IsRaid())
+ ss << handler->GetTrinityString(LANG_RAID);
+
+ if (MapInfo->SupportsHeroicMode())
+ ss << handler->GetTrinityString(LANG_HEROIC);
+
+ uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
+
+ std::string ResetTimeRaidStr;
+ if (ResetTimeRaid)
+ ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false);
+
+ uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
+ std::string ResetTimeHeroicStr;
+ if (ResetTimeHeroic)
+ ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false);
+
+ if (MapInfo->IsMountAllowed())
+ ss << handler->GetTrinityString(LANG_MOUNTABLE);
+
+ if (ResetTimeRaid && !ResetTimeHeroic)
+ handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str());
+ else if (!ResetTimeRaid && ResetTimeHeroic)
+ handler->PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str());
+ else if (ResetTimeRaid && ResetTimeHeroic)
+ handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str());
+ else
+ handler->SendSysMessage(ss.str().c_str());
+
+ if (!found)
+ found = true;
+ }
+ }
+ }
+
+ if (!found)
+ handler->SendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ */
+ return true;
+ }
+
+ static bool HandleLookupPlayerIpCommand(ChatHandler* handler, char const* args)
+ {
+ std::string ip;
+ int32 limit;
+ char* limitStr;
+
+ Player* target = handler->getSelectedPlayer();
+ if (!*args)
+ {
+ // NULL only if used from console
+ if (!target || target == handler->GetSession()->GetPlayer())
+ return false;
+
+ ip = target->GetSession()->GetRemoteAddress();
+ limit = -1;
+ }
+ else
+ {
+ ip = strtok((char*)args, " ");
+ limitStr = strtok(NULL, " ");
+ limit = limitStr ? atoi(limitStr) : -1;
+ }
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
+ stmt->setString(0, ip);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ return LookupPlayerSearchCommand(result, limit, handler);
+ }
+
+ static bool HandleLookupPlayerAccountCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string account = strtok((char*)args, " ");
+ char* limitStr = strtok(NULL, " ");
+ int32 limit = limitStr ? atoi(limitStr) : -1;
+
+ if (!AccountMgr::normalizeString
+ (account))
+ return false;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
+ stmt->setString(0, account);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ return LookupPlayerSearchCommand(result, limit, handler);
+ }
+
+ static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string email = strtok((char*)args, " ");
+ char* limitStr = strtok(NULL, " ");
+ int32 limit = limitStr ? atoi(limitStr) : -1;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
+ stmt->setString(0, email);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ return LookupPlayerSearchCommand(result, limit, handler);
+ }
+
+ static bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit, ChatHandler* handler)
+ {
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 counter = 0;
+ uint32 count = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+
+ do
+ {
+ if (maxResults && count++ == maxResults)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
+ }
+
+ Field* fields = result->Fetch();
+ uint32 accountId = fields[0].GetUInt32();
+ std::string accountName = fields[1].GetString();
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
+ stmt->setUInt32(0, accountId);
+ PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
+
+ if (result2)
+ {
+ handler->PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, accountName.c_str(), accountId);
+
+ do
+ {
+ Field* characterFields = result2->Fetch();
+ uint32 guid = characterFields[0].GetUInt32();
+ std::string name = characterFields[1].GetString();
+
+ handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid);
+ ++counter;
+ }
+ while (result2->NextRow() && (limit == -1 || counter < limit));
+ }
+ }
+ while (result->NextRow());
+
+ if (counter == 0) // empty accounts only
+ {
+ handler->PSendSysMessage(LANG_NO_PLAYERS_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+};
+
+void AddSC_lookup_commandscript()
+{
+ new lookup_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp
new file mode 100644
index 00000000000..d61abf34e2f
--- /dev/null
+++ b/src/server/scripts/Commands/cs_message.cpp
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: message_commandscript
+%Complete: 100
+Comment: All message related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "ChannelMgr.h"
+
+class message_commandscript : public CommandScript
+{
+public:
+ message_commandscript() : CommandScript("message_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand channelSetCommandTable[] =
+ {
+ { "ownership", SEC_ADMINISTRATOR, false, &HandleChannelSetOwnership, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand channelCommandTable[] =
+ {
+ { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
+ { "nameannounce", SEC_MODERATOR, true, &HandleNameAnnounceCommand, "", NULL },
+ { "gmnameannounce", SEC_MODERATOR, true, &HandleGMNameAnnounceCommand, "", NULL },
+ { "announce", SEC_MODERATOR, true, &HandleAnnounceCommand, "", NULL },
+ { "gmannounce", SEC_MODERATOR, true, &HandleGMAnnounceCommand, "", NULL },
+ { "notify", SEC_MODERATOR, true, &HandleNotifyCommand, "", NULL },
+ { "gmnotify", SEC_MODERATOR, true, &HandleGMNotifyCommand, "", NULL },
+ { "whispers", SEC_MODERATOR, false, &HandleWhispersCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleChannelSetOwnership(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+ char const* channelStr = strtok((char*)args, " ");
+ char const* argStr = strtok(NULL, "");
+
+ if (!channelStr || !argStr)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Channel* channcel = NULL;
+
+ if (ChannelMgr* cMgr = channelMgr(player->GetTeam()))
+ channcel = cMgr->GetChannel(channelStr, player);
+
+ if (strcmp(argStr, "on") == 0)
+ {
+ if (channcel)
+ channcel->SetOwnership(true);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
+ stmt->setUInt8 (0, 1);
+ stmt->setString(1, channelStr);
+ CharacterDatabase.Execute(stmt);
+ handler->PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channelStr);
+ }
+ else if (strcmp(argStr, "off") == 0)
+ {
+ if (channcel)
+ channcel->SetOwnership(false);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
+ stmt->setUInt8 (0, 0);
+ stmt->setString(1, channelStr);
+ CharacterDatabase.Execute(stmt);
+ handler->PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channelStr);
+ }
+ else
+ return false;
+
+ return true;
+ }
+
+ static bool HandleNameAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name("Console");
+ if (WorldSession* session = handler->GetSession())
+ name = session->GetPlayer()->GetName();
+
+ sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args);
+ return true;
+ }
+
+ static bool HandleGMNameAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name("Console");
+ if (WorldSession* session = handler->GetSession())
+ name = session->GetPlayer()->GetName();
+
+ sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args);
+ return true;
+ }
+ // global announce
+ static bool HandleAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char buff[2048];
+ sprintf(buff, handler->GetTrinityString(LANG_SYSTEMMESSAGE), args);
+ sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
+ return true;
+ }
+ // announce to logged in GMs
+ static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ sWorld->SendGMText(LANG_GM_BROADCAST, args);
+ return true;
+ }
+ // notification player at the screen
+ static bool HandleNotifyCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string str = handler->GetTrinityString(LANG_GLOBAL_NOTIFY);
+ str += args;
+
+ WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
+ data << str;
+ sWorld->SendGlobalMessage(&data);
+
+ return true;
+ }
+ // notification GM at the screen
+ static bool HandleGMNotifyCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string str = handler->GetTrinityString(LANG_GM_NOTIFY);
+ str += args;
+
+ WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
+ data << str;
+ sWorld->SendGlobalGMMessage(&data);
+
+ return true;
+ }
+ // Enable\Dissable accept whispers (for GM)
+ static bool HandleWhispersCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, handler->GetSession()->GetPlayer()->isAcceptWhispers() ? handler->GetTrinityString(LANG_ON) : handler->GetTrinityString(LANG_OFF));
+ return true;
+ }
+
+ std::string argStr = (char*)args;
+ // whisper on
+ if (argStr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetAcceptWhispers(true);
+ handler->SendSysMessage(LANG_COMMAND_WHISPERON);
+ return true;
+ }
+
+ // whisper off
+ if (argStr == "off")
+ {
+ // Remove all players from the Gamemaster's whisper whitelist
+ handler->GetSession()->GetPlayer()->ClearWhisperWhiteList();
+ handler->GetSession()->GetPlayer()->SetAcceptWhispers(false);
+ handler->SendSysMessage(LANG_COMMAND_WHISPEROFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+};
+
+void AddSC_message_commandscript()
+{
+ new message_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 5f0434e5c55..1edaaf5bcbf 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1,72 +1,2879 @@
-/*
- * Copyright (C) 2008-2012 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 "ScriptPCH.h"
-#include "Chat.h"
-
-class misc_commandscript : public CommandScript
-{
-public:
- misc_commandscript() : CommandScript("misc_commandscript") { }
-
- ChatCommand* GetCommands() const
- {
- static ChatCommand commandTable[] =
- {
- { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
-
- static bool HandleDevCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- {
- if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
- handler->GetSession()->SendNotification(LANG_DEV_ON);
- else
- handler->GetSession()->SendNotification(LANG_DEV_OFF);
- return true;
- }
-
- std::string argstr = (char*)args;
-
- if (argstr == "on")
- {
- handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
- handler->GetSession()->SendNotification(LANG_DEV_ON);
- return true;
- }
-
- if (argstr == "off")
- {
- handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
- handler->GetSession()->SendNotification(LANG_DEV_OFF);
- return true;
- }
-
- handler->SendSysMessage(LANG_USE_BOL);
- handler->SetSentErrorMessage(true);
- return false;
- }
-};
-
-void AddSC_misc_commandscript()
-{
- new misc_commandscript();
-}
+/*
+ * Copyright (C) 2008-2012 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 "Chat.h"
+#include "ScriptMgr.h"
+#include "AccountMgr.h"
+#include "ArenaTeamMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "Group.h"
+#include "InstanceSaveMgr.h"
+#include "MovementGenerator.h"
+#include "ObjectAccessor.h"
+#include "SpellAuras.h"
+#include "TargetedMovementGenerator.h"
+#include "WeatherMgr.h"
+#include "ace/INET_Addr.h"
+
+class misc_commandscript : public CommandScript
+{
+public:
+ misc_commandscript() : CommandScript("misc_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand groupCommandTable[] =
+ {
+ { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL },
+ { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand petCommandTable[] =
+ {
+ { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL },
+ { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL },
+ { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand sendCommandTable[] =
+ {
+ { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL },
+ { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL },
+ { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL },
+ { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
+ { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL },
+ { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL },
+ { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL },
+ { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL },
+ { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL },
+ { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL },
+ { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL },
+ { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL },
+ { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL },
+ { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL },
+ { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL },
+ { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL },
+ { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL },
+ { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL },
+ { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL },
+ { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL },
+ { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL },
+ { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL },
+ { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL },
+ { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL },
+ { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL },
+ { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL },
+ { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL },
+ { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL },
+ { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL },
+ { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL },
+ { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL },
+ { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL },
+ { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL },
+ { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL },
+ { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL },
+ { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL },
+ { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL },
+ { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
+ { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
+ { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL },
+ { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL },
+ { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL },
+ { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL },
+ { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL },
+ { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL },
+ { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL },
+ { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL },
+ { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL },
+ { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL },
+ { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL },
+ { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL },
+ { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
+ { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL },
+ { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL },
+ { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL },
+ { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL },
+ { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleDevCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ else
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ std::string argstr = (char*)args;
+
+ if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ return true;
+ }
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ static bool HandleGPSCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* object = NULL;
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ object = handler->getSelectedUnit();
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
+ Cell cell(cellCoord);
+
+ uint32 zoneId, areaId;
+ object->GetZoneAndAreaId(zoneId, areaId);
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
+
+ float zoneX = object->GetPositionX();
+ float zoneY = object->GetPositionY();
+
+ Map2ZoneCoordinates(zoneX, zoneY, zoneId);
+
+ Map const* map = object->GetMap();
+ float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+
+ GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
+
+ // 63? WHY?
+ int gridX = 63 - gridCoord.x_coord;
+ int gridY = 63 - gridCoord.y_coord;
+
+ uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+
+ if (haveVMap)
+ {
+ if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
+ handler->PSendSysMessage("You are outdoors");
+ else
+ handler->PSendSysMessage("You are indoors");
+ }
+ else
+ handler->PSendSysMessage("no VMAP available for area info");
+
+ handler->PSendSysMessage(LANG_MAP_POSITION,
+ object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ object->GetPhaseMask(),
+ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
+ cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
+ zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
+
+ LiquidData liquidStatus;
+ ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
+
+ if (status)
+ handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
+
+ return true;
+ }
+
+ static bool HandleAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
+
+ return true;
+ }
+
+ static bool HandleUnAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argstr = args;
+ if (argstr == "all")
+ {
+ target->RemoveAllAuras();
+ return true;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ target->RemoveAurasDueToSpell(spellId);
+
+ return true;
+ }
+ // Teleport to Player
+ static bool HandleAppearCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->SendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ std::string chrNameLink = handler->playerLink(targetName);
+
+ Map* map = target->GetMap();
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
+ _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!_player->GetMap()->IsBattlegroundOrArena())
+ _player->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ // we have to go to instance, and can go to player only if:
+ // 1) we are in his group (either as leader or as member)
+ // 2) we are not bound to any group and have GM mode on
+ if (_player->GetGroup())
+ {
+ // we are in group, we can go only if we are in the player group
+ if (_player->GetGroup() != target->GetGroup())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ // we are not in group, let's verify our GM mode
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // if the player or the player's group is bound to another instance
+ // the player will not be bound to another one
+ InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid()));
+ if (!bind)
+ {
+ Group* group = _player->GetGroup();
+ // if no bind exists, create a solo bind
+ InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
+ if (!gBind)
+ if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
+ _player->BindToInstance(save, !save->CanReset());
+ }
+
+ if (map->IsRaid())
+ _player->SetRaidDifficulty(target->GetRaidDifficulty());
+ else
+ _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
+ }
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ // to point to see at target with same orientation
+ float x, y, z;
+ target->GetContactPoint(_player, x, y, z);
+
+ _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
+ _player->SetPhaseMask(target->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
+
+ // to point where player stay (if loaded)
+ float x, y, z, o;
+ uint32 map;
+ bool in_flight;
+ if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
+ return false;
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ _player->TeleportTo(map, x, y, z, _player->GetOrientation());
+ }
+
+ return true;
+ }
+ // Summon Player
+ static bool HandleSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* map = handler->GetSession()->GetPlayer()->GetMap();
+
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
+ target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!target->GetMap()->IsBattlegroundOrArena())
+ target->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ Map* map = target->GetMap();
+
+ if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId())
+ target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
+ (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
+ if (handler->needReportToTarget(target))
+ ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ target->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
+ target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
+ target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE));
+
+ // in point where GM stay
+ Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(),
+ handler->GetSession()->GetPlayer()->GetPositionX(),
+ handler->GetSession()->GetPlayer()->GetPositionY(),
+ handler->GetSession()->GetPlayer()->GetPositionZ(),
+ handler->GetSession()->GetPlayer()->GetOrientation(),
+ handler->GetSession()->GetPlayer()->GetZoneId(),
+ targetGuid);
+ }
+
+ return true;
+ }
+ // Summon group of player
+ static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ Group* group = target->GetGroup();
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!group)
+ {
+ handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* gmMap = handler->GetSession()->GetPlayer()->GetMap();
+ bool toInstance = gmMap->Instanceable();
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (toInstance && (
+ !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* player = itr->getSource();
+
+ if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession())
+ continue;
+
+ // check online security
+ if (handler->HasLowerSecurity(player, 0))
+ return false;
+
+ std::string plNameLink = handler->GetNameLink(player);
+
+ if (player->IsBeingTeleported() == true)
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (toInstance)
+ {
+ Map* playerMap = player->GetMap();
+
+ if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
+ {
+ // cannot summon from instance to instance
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
+ if (handler->needReportToTarget(player))
+ ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str());
+
+ // stop flight if need
+ if (player->isInFlight())
+ {
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ player->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
+ player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
+ }
+
+ return true;
+ }
+
+ static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ return true;
+ }
+
+ static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* target = handler->getSelectedUnit();
+
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (target->isAlive())
+ {
+ if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
+ handler->GetSession()->GetPlayer()->Kill(target);
+ else
+ handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ }
+
+ return true;
+ }
+
+ static bool HandleReviveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ if (target)
+ {
+ target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
+ target->SpawnCorpseBones();
+ target->SaveToDB();
+ }
+ else
+ // will resurrected at login without corpse
+ sObjectAccessor->ConvertCorpseForPlayer(targetGuid);
+
+ return true;
+ }
+
+ static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // If player is not mounted, so go out :)
+ if (!player->IsMounted())
+ {
+ handler->SendSysMessage(LANG_CHAR_NON_MOUNTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isInFlight())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->Dismount();
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ return true;
+ }
+
+ static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
+
+ if (guid == 0)
+ {
+ handler->SendSysMessage(LANG_NO_SELECTION);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
+ return true;
+ }
+
+ static bool HandleHelpCommand(ChatHandler* handler, char const* args)
+ {
+ char const* cmd = strtok((char*)args, " ");
+ if (!cmd)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "help");
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ }
+ else
+ {
+ if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
+ handler->SendSysMessage(LANG_NO_HELP_CMD);
+ }
+
+ return true;
+ }
+ // move item to other slot
+ static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* param1 = strtok((char*)args, " ");
+ if (!param1)
+ return false;
+
+ char const* param2 = strtok(NULL, " ");
+ if (!param2)
+ return false;
+
+ uint8 srcSlot = uint8(atoi(param1));
+ uint8 dstSlot = uint8(atoi(param2));
+
+ if (srcSlot == dstSlot)
+ return true;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
+ return false;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
+ return false;
+
+ uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
+ uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
+
+ handler->GetSession()->GetPlayer()->SwapItem(src, dst);
+
+ return true;
+ }
+
+ static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!*args)
+ {
+ target->RemoveAllSpellCooldown();
+ handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
+ }
+ else
+ {
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellIid)
+ return false;
+
+ if (!sSpellMgr->GetSpellInfo(spellIid))
+ {
+ handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->RemoveSpellCooldown(spellIid, true);
+ handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ }
+ return true;
+ }
+
+ static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* obj = NULL;
+
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ obj = handler->getSelectedUnit();
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
+ return true;
+ }
+ // Teleport player to last position
+ static bool HandleRecallCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+
+ target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
+ return true;
+ }
+
+ static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // save GM account without delay and output message
+ if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ {
+ if (Player* target = handler->getSelectedPlayer())
+ target->SaveToDB();
+ else
+ player->SaveToDB();
+ handler->SendSysMessage(LANG_PLAYER_SAVED);
+ return true;
+ }
+
+ // save if the player has last been saved over 20 seconds ago
+ uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
+ if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
+ player->SaveToDB();
+
+ return true;
+ }
+
+ // Save all players in the world
+ static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sObjectAccessor->SaveAllPlayers();
+ handler->SendSysMessage(LANG_PLAYERS_SAVED);
+ return true;
+ }
+
+ // kick player
+ static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+ std::string playerName;
+ if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ return false;
+
+ if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_KICKSELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
+ sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+ else
+ handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+
+ target->GetSession()->KickPlayer();
+
+ return true;
+ }
+
+ static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ if (player->isInFlight())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isInCombat())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_COMBAT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ {
+ // if player is dead and stuck, send ghost to graveyard
+ player->RepopAtGraveyard();
+ return true;
+ }
+
+ // cast spell Stuck
+ player->CastSpell(player, 7355, false);
+ return true;
+ }
+ // Enable on\off all taxi paths
+ static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argStr = (char*)args;
+
+ Player* chr = handler->getSelectedPlayer();
+
+ if (!chr)
+ chr = handler->GetSession()->GetPlayer();
+ else if (handler->HasLowerSecurity(chr, 0)) // check online security
+ return false;
+
+ if (argStr == "on")
+ {
+ chr->SetTaxiCheater(true);
+ handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str());
+ return true;
+ }
+
+ if (argStr == "off")
+ {
+ chr->SetTaxiCheater(false);
+ handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+
+ return false;
+ }
+
+ static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* px = strtok((char*)args, " ");
+ if (!px)
+ return false;
+
+ uint32 graveyardId = uint32(atoi(px));
+
+ uint32 team;
+
+ char* px2 = strtok(NULL, " ");
+
+ if (!px2)
+ team = 0;
+ else if (strncmp(px2, "horde", 6) == 0)
+ team = HORDE;
+ else if (strncmp(px2, "alliance", 9) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
+
+ if (!graveyard)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ uint32 zoneId = player->GetZoneId();
+
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
+ if (!areaEntry || areaEntry->zone !=0)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
+
+ return true;
+ }
+
+ static bool HandleNearGraveCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 team;
+
+ size_t argStr = strlen(args);
+
+ if (!*args)
+ team = 0;
+ else if (strncmp((char*)args, "horde", argStr) == 0)
+ team = HORDE;
+ else if (strncmp((char*)args, "alliance", argStr) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zone_id = player->GetZoneId();
+
+ WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
+
+ if (graveyard)
+ {
+ uint32 graveyardId = graveyard->ID;
+
+ GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
+ if (!data)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ team = data->team;
+
+ std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
+ }
+ else
+ {
+ std::string team_name;
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ if (team == ~uint32(0))
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
+ }
+
+ return true;
+ }
+
+ static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ int32 flag = int32(atoi((char*)args));
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (flag != 0)
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str());
+ if (handler->needReportToTarget(playerTarget))
+ ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
+ }
+ else
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str());
+ if (handler->needReportToTarget(playerTarget))
+ ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
+ }
+
+ for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ {
+ if (flag != 0)
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
+ else
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
+ }
+
+ return true;
+ }
+
+ static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
+
+ handler->SendSysMessage(LANG_EXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleHideAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
+
+ handler->SendSysMessage(LANG_UNEXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 itemId = 0;
+
+ if (args[0] == '[') // [name] manual form
+ {
+ char const* itemNameStr = strtok((char*)args, "]");
+
+ if (itemNameStr && itemNameStr[0])
+ {
+ std::string itemName = itemNameStr+1;
+ WorldDatabase.EscapeString(itemName);
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
+ stmt->setString(0, itemName);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ itemId = result->Fetch()->GetUInt32();
+ }
+ else
+ return false;
+ }
+ else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
+ {
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
+ if (!id)
+ return false;
+ itemId = uint32(atol(id));
+ }
+
+ char const* ccount = strtok(NULL, " ");
+
+ int32 count = 1;
+
+ if (ccount)
+ count = strtol(ccount, NULL, 10);
+
+ if (count == 0)
+ count = 1;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count);
+
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
+ if (!itemTemplate)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Subtract
+ if (count < 0)
+ {
+ playerTarget->DestroyItemCount(itemId, -count, true, false);
+ handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
+ return true;
+ }
+
+ // Adding items
+ uint32 noSpaceForCount = 0;
+
+ // check space and find places
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
+ if (msg != EQUIP_ERR_OK) // convert to possible store amount
+ count -= noSpaceForCount;
+
+ if (count == 0 || dest.empty()) // can't add any
+ {
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
+ if (Item* item1 = player->GetItemByPos(itr->pos))
+ item1->SetBinding(false);
+
+ if (count > 0 && item)
+ {
+ player->SendNewItem(item, count, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, count, true, false);
+ }
+
+ if (noSpaceForCount > 0)
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+
+ return true;
+ }
+
+ static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
+ if (!id)
+ return false;
+
+ uint32 itemSetId = atol(id);
+
+ // prevent generation all items with itemset field value '0'
+ if (itemSetId == 0)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId);
+
+ bool found = false;
+ ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
+ for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
+ {
+ if (itr->second.ItemSet == itemSetId)
+ {
+ found = true;
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
+ if (msg == EQUIP_ERR_OK)
+ {
+ Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ item->SetBinding(false);
+
+ player->SendNewItem(item, 1, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, 1, true, false);
+ }
+ else
+ {
+ player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
+ }
+ }
+ }
+
+ if (!found)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
+ return true;
+ }
+
+ static bool HandleChangeWeather(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // Weather is OFF
+ if (!sWorld->getBoolConfig(CONFIG_WEATHER))
+ {
+ handler->SendSysMessage(LANG_WEATHER_DISABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // *Change the weather of a cell
+ char const* px = strtok((char*)args, " ");
+ char const* py = strtok(NULL, " ");
+
+ if (!px || !py)
+ return false;
+
+ uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
+ float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zoneid = player->GetZoneId();
+
+ Weather* weather = WeatherMgr::FindWeather(zoneid);
+
+ if (!weather)
+ weather = WeatherMgr::AddWeather(zoneid);
+ if (!weather)
+ {
+ handler->SendSysMessage(LANG_NO_WEATHER);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ weather->SetWeather(WeatherType(type), grade);
+
+ return true;
+ }
+
+
+ static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* SelectedPlayer = handler->getSelectedPlayer();
+ if (!SelectedPlayer)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // each skills that have max skill value dependent from level seted to current level max skill value
+ SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
+ return true;
+ }
+
+ static bool HandleSetSkillCommand(ChatHandler* handler, char const* args)
+ {
+ // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
+ char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill");
+ if (!skillStr)
+ return false;
+
+ char const* levelStr = strtok(NULL, " ");
+ if (!levelStr)
+ return false;
+
+ char const* maxPureSkill = strtok(NULL, " ");
+
+ int32 skill = atoi(skillStr);
+ if (skill <= 0)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 level = uint32(atol(levelStr));
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
+ if (!skillLine)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string tNameLink = handler->GetNameLink(target);
+
+ if (!target->GetSkillValue(skill))
+ {
+ handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill);
+
+ if (level <= 0 || level > max || max <= 0)
+ return false;
+
+ target->SetSkill(skill, target->GetSkillStep(skill), level, max);
+ handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max);
+
+ return true;
+ }
+ // show info of player
+ static bool HandlePInfoCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+
+ uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+
+ if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
+ {
+ target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ targetGuid = parseGUID;
+ }
+ else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accId = 0;
+ uint32 money = 0;
+ uint32 totalPlayerTime = 0;
+ uint8 level = 0;
+ uint32 latency = 0;
+ uint8 race;
+ uint8 Class;
+ int64 muteTime = 0;
+ int64 banTime = -1;
+ uint32 mapId;
+ uint32 areaId;
+ uint32 phase = 0;
+
+ // get additional information from Player object
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ accId = target->GetSession()->GetAccountId();
+ money = target->GetMoney();
+ totalPlayerTime = target->GetTotalPlayedTime();
+ level = target->getLevel();
+ latency = target->GetSession()->GetLatency();
+ race = target->getRace();
+ Class = target->getClass();
+ muteTime = target->GetSession()->m_muteTime;
+ mapId = target->GetMapId();
+ areaId = target->GetAreaId();
+ phase = target->GetPhaseMask();
+ }
+ // get additional information from DB
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ return false;
+
+ Field* fields = result->Fetch();
+ totalPlayerTime = fields[0].GetUInt32();
+ level = fields[1].GetUInt8();
+ money = fields[2].GetUInt32();
+ accId = fields[3].GetUInt32();
+ race = fields[4].GetUInt8();
+ Class = fields[5].GetUInt8();
+ mapId = fields[6].GetUInt16();
+ areaId = fields[7].GetUInt16();
+ }
+
+ std::string userName = handler->GetTrinityString(LANG_ERROR);
+ std::string eMail = handler->GetTrinityString(LANG_ERROR);
+ std::string lastIp = handler->GetTrinityString(LANG_ERROR);
+ uint32 security = 0;
+ std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
+ stmt->setInt32(0, int32(realmID));
+ stmt->setUInt32(1, accId);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ if (result)
+ {
+ Field* fields = result->Fetch();
+ userName = fields[0].GetString();
+ security = fields[1].GetUInt8();
+ eMail = fields[2].GetString();
+ muteTime = fields[5].GetUInt64();
+
+ if (eMail.empty())
+ eMail = "-";
+
+ if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
+ {
+ lastIp = fields[3].GetString();
+ lastLogin = fields[4].GetString();
+
+ uint32 ip = inet_addr(lastIp.c_str());
+#if TRINITY_ENDIAN == BIGENDIAN
+ EndianConvertReverse(ip);
+#endif
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
+
+ stmt->setUInt32(0, ip);
+
+ PreparedQueryResult result2 = WorldDatabase.Query(stmt);
+
+ if (result2)
+ {
+ Field* fields2 = result2->Fetch();
+ lastIp.append(" (");
+ lastIp.append(fields2[0].GetString());
+ lastIp.append(")");
+ }
+ }
+ else
+ {
+ lastIp = "-";
+ lastLogin = "-";
+ }
+ }
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency);
+
+ std::string bannedby = "unknown";
+ std::string banreason = "";
+
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
+ stmt->setUInt32(0, accId);
+ PreparedQueryResult result2 = LoginDatabase.Query(stmt);
+ if (!result2)
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ result2 = CharacterDatabase.Query(stmt);
+ }
+
+ if (result2)
+ {
+ Field* fields = result2->Fetch();
+ banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
+ bannedby = fields[2].GetString();
+ banreason = fields[3].GetString();
+ }
+
+ if (muteTime > 0)
+ handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
+
+ if (banTime >= 0)
+ handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
+
+ std::string raceStr, ClassStr;
+ switch (race)
+ {
+ case RACE_HUMAN:
+ raceStr = "Human";
+ break;
+ case RACE_ORC:
+ raceStr = "Orc";
+ break;
+ case RACE_DWARF:
+ raceStr = "Dwarf";
+ break;
+ case RACE_NIGHTELF:
+ raceStr = "Night Elf";
+ break;
+ case RACE_UNDEAD_PLAYER:
+ raceStr = "Undead";
+ break;
+ case RACE_TAUREN:
+ raceStr = "Tauren";
+ break;
+ case RACE_GNOME:
+ raceStr = "Gnome";
+ break;
+ case RACE_TROLL:
+ raceStr = "Troll";
+ break;
+ case RACE_BLOODELF:
+ raceStr = "Blood Elf";
+ break;
+ case RACE_DRAENEI:
+ raceStr = "Draenei";
+ break;
+ }
+
+ switch (Class)
+ {
+ case CLASS_WARRIOR:
+ ClassStr = "Warrior";
+ break;
+ case CLASS_PALADIN:
+ ClassStr = "Paladin";
+ break;
+ case CLASS_HUNTER:
+ ClassStr = "Hunter";
+ break;
+ case CLASS_ROGUE:
+ ClassStr = "Rogue";
+ break;
+ case CLASS_PRIEST:
+ ClassStr = "Priest";
+ break;
+ case CLASS_DEATH_KNIGHT:
+ ClassStr = "Death Knight";
+ break;
+ case CLASS_SHAMAN:
+ ClassStr = "Shaman";
+ break;
+ case CLASS_MAGE:
+ ClassStr = "Mage";
+ break;
+ case CLASS_WARLOCK:
+ ClassStr = "Warlock";
+ break;
+ case CLASS_DRUID:
+ ClassStr = "Druid";
+ break;
+ }
+
+ std::string timeStr = secsToTimeString(totalPlayerTime, true, true);
+ uint32 gold = money /GOLD;
+ uint32 silv = (money % GOLD) / SILVER;
+ uint32 copp = (money % GOLD) % SILVER;
+ handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp);
+
+ // Add map, zone, subzone and phase to output
+ int locale = handler->GetSessionDbcLocale();
+ std::string areaName = "<unknown>";
+ std::string zoneName = "";
+
+ MapEntry const* map = sMapStore.LookupEntry(mapId);
+
+ AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
+ if (area)
+ {
+ areaName = area->area_name[locale];
+
+ AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
+ if (zone)
+ zoneName = zone->area_name[locale];
+ }
+
+ if (target)
+ {
+ if (!zoneName.empty())
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
+ }
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
+
+ return true;
+ }
+
+ static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // accept only explicitly selected target (not implicitly self targeting case)
+ Unit* target = handler->getSelectedUnit();
+ if (player->GetSelection() && target)
+ {
+ if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->isDead())
+ target->ToCreature()->Respawn();
+ return true;
+ }
+
+ CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
+ Cell cell(p);
+ cell.SetNoCreate();
+
+ Trinity::RespawnDo u_do;
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
+
+ TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
+ cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
+
+ return true;
+ }
+ // mute player for some times
+ static bool HandleMuteCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* delayStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
+ if (!delayStr)
+ return false;
+
+ char const* muteReason = strtok(NULL, "\r");
+ std::string muteReasonStr = "No reason";
+ if (muteReason != NULL)
+ muteReasonStr = muteReason;
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ uint32 notSpeakTime = uint32(atoi(delayStr));
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+
+ if (target)
+ {
+ // Target is online, mute will be in effect right away.
+ int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
+ target->GetSession()->m_muteTime = muteTime;
+ stmt->setInt64(0, muteTime);
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str());
+ }
+ else
+ {
+ // Target is offline, mute will be in effect starting from the next login.
+ int32 muteTime = -int32(notSpeakTime * MINUTE);
+ stmt->setInt64(0, muteTime);
+ }
+
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
+
+ return true;
+ }
+
+ // unmute player
+ static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ if (target)
+ {
+ if (target->CanSpeak())
+ {
+ handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->GetSession()->m_muteTime = 0;
+ }
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+ stmt->setInt64(0, 0);
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+
+ if (target)
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
+
+ return true;
+ }
+
+
+ static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
+
+ MotionMaster* motionMaster = unit->GetMotionMaster();
+ float x, y, z;
+ motionMaster->GetDestination(x, y, z);
+
+ for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
+ {
+ MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
+ if (!movementGenerator)
+ {
+ handler->SendSysMessage("Empty");
+ continue;
+ }
+
+ switch (movementGenerator->GetMovementGeneratorType())
+ {
+ case IDLE_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_IDLE);
+ break;
+ case RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_RANDOM);
+ break;
+ case WAYPOINT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT);
+ break;
+ case ANIMAL_RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM);
+ break;
+ case CONFUSED_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_CONFUSED);
+ break;
+ case CHASE_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
+ break;
+ }
+ case FOLLOW_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
+ break;
+ }
+ case HOME_MOTION_TYPE:
+ {
+ if (unit->GetTypeId() == TYPEID_UNIT)
+ handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
+ else
+ handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
+ break;
+ }
+ case FLIGHT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FLIGHT);
+ break;
+ case POINT_MOTION_TYPE:
+ {
+ handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
+ break;
+ }
+ case FLEEING_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FEAR);
+ break;
+ case DISTRACT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_DISTRACT);
+ break;
+ case EFFECT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_EFFECT);
+ break;
+ default:
+ handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
+ break;
+ }
+ }
+ return true;
+ }
+ /*
+ ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
+ Without this function 3rd party scripting library will get linking errors (unresolved external)
+ when attempting to use the PointMovementGenerator
+ */
+ static bool HandleComeToMeCommand(ChatHandler* handler, char const* args)
+ {
+ char const* newFlagStr = strtok((char*)args, " ");
+ if (!newFlagStr)
+ return false;
+
+ Creature* caster = handler->getSelectedCreature();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+
+ return true;
+ }
+
+ static bool HandleDamageCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Unit* target = handler->getSelectedUnit();
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (!target->isAlive())
+ return true;
+
+ char* damageStr = strtok((char*)args, " ");
+ if (!damageStr)
+ return false;
+
+ int32 damage_int = atoi((char*)damageStr);
+ if (damage_int <= 0)
+ return true;
+
+ uint32 damage = damage_int;
+
+ char* schoolStr = strtok((char*)NULL, " ");
+
+ // flat melee damage without resistence/etc reduction
+ if (!schoolStr)
+ {
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ if (target != handler->GetSession()->GetPlayer())
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
+ if (school >= MAX_SPELL_SCHOOL)
+ return false;
+
+ SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
+
+ if (Unit::IsDamageReducedByArmor(schoolmask))
+ damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
+
+ char* spellStr = strtok((char*)NULL, " ");
+
+ // melee damage by specific school
+ if (!spellStr)
+ {
+ uint32 absorb = 0;
+ uint32 resist = 0;
+
+ handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
+
+ if (damage <= absorb + resist)
+ return true;
+
+ damage -= absorb + resist;
+
+ handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ // non-melee damage
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
+ return false;
+
+ handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
+ return true;
+ }
+
+ static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+
+ if (args && strlen(args) > 0)
+ {
+ target = sObjectAccessor->FindPlayerByName(args);
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!target)
+ {
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ target->CombatStop();
+ target->getHostileRefManager().deleteReferences();
+ return true;
+ }
+
+ static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/)
+ {
+ sArenaTeamMgr->DistributeArenaPoints();
+ return true;
+ }
+
+ static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ // Repair items
+ target->DurabilityRepairAll(false, 0, false);
+
+ handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
+ if (handler->needReportToTarget(target))
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->PSendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(player, 0))
+ return false;
+
+ if (strncmp(args, "on", 3) == 0)
+ player->SetMovement(MOVE_WATER_WALK); // ON
+ else if (strncmp(args, "off", 4) == 0)
+ player->SetMovement(MOVE_LAND_WALK); // OFF
+ else
+ {
+ handler->SendSysMessage(LANG_USE_BOL);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str());
+ if (handler->needReportToTarget(player))
+ ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str());
+ return true;
+ }
+
+ // Send mail by command
+ static bool HandleSendMailCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text"
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ //- TODO: Fix poor design
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ MailDraft(subject, text)
+ .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ // Send items by mail
+ static bool HandleSendItemsCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // extract items
+ typedef std::pair<uint32, uint32> ItemPair;
+ typedef std::list< ItemPair > ItemPairs;
+ ItemPairs items;
+
+ // get all tail string
+ char* tail = strtok(NULL, "");
+
+ // get from tail next item str
+ while (char* itemStr = strtok(tail, " "))
+ {
+ // and get new tail
+ tail = strtok(NULL, "");
+
+ // parse item str
+ char const* itemIdStr = strtok(itemStr, ":");
+ char const* itemCountStr = strtok(NULL, " ");
+
+ uint32 itemId = atoi(itemIdStr);
+ if (!itemId)
+ return false;
+
+ ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId);
+ if (!item_proto)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1;
+ if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount)))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ while (itemCount > item_proto->GetMaxStackSize())
+ {
+ items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize()));
+ itemCount -= item_proto->GetMaxStackSize();
+ }
+
+ items.push_back(ItemPair(itemId, itemCount));
+
+ if (items.size() > MAX_MAIL_ITEMS)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ // fill mail
+ MailDraft draft(subject, text);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
+ {
+ if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0))
+ {
+ item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
+ draft.AddItem(item);
+ }
+ }
+
+ draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send money by mail
+ static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args)
+ {
+ /// format: name "subject text" "mail text" money
+
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ char* moneyStr = strtok(NULL, "");
+ int32 money = moneyStr ? atoi(moneyStr) : 0;
+ if (money <= 0)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ MailDraft(subject, text)
+ .AddMoney(money)
+ .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send a message to a player in game
+ static bool HandleSendMessageCommand(ChatHandler* handler, char const* args)
+ {
+ /// - Find the player
+ Player* player;
+ if (!handler->extractPlayerTarget((char*)args, &player))
+ return false;
+
+ char* msgStr = strtok(NULL, "");
+ if (!msgStr)
+ return false;
+
+ ///- Check that he is not logging out.
+ if (player->GetSession()->isLogingOut())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ /// - Send the message
+ // Use SendAreaTriggerMessage for fastest delivery.
+ player->GetSession()->SendAreaTriggerMessage("%s", msgStr);
+ player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
+
+ // Confirmation message
+ std::string nameLink = handler->GetNameLink(player);
+ handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr);
+
+ return true;
+ }
+
+ static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ Creature* creatureTarget = handler->getSelectedCreature();
+
+ if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+ {
+ handler->PSendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
+ // Creatures with family 0 crashes the server
+ if (!creatrueTemplate->family)
+ {
+ handler->PSendSysMessage("This creature cannot be tamed. (family id: 0).");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->GetPetGUID())
+ {
+ handler->PSendSysMessage("You already have a pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Everything looks OK, create new pet
+ Pet* pet = new Pet(player, HUNTER_PET);
+ if (!pet->CreateBaseAtCreature(creatureTarget))
+ {
+ delete pet;
+ handler->PSendSysMessage("Error 1");
+ return false;
+ }
+
+ creatureTarget->setDeathState(JUST_DIED);
+ creatureTarget->RemoveCorpse();
+ creatureTarget->SetHealth(0); // just for nice GM-mode view
+
+ pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+ pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
+
+ if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
+ handler->PSendSysMessage("Error 2");
+ delete pet;
+ return false;
+ }
+
+ // prepare visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
+
+ pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
+ // this enables pet details window (Shift+P)
+ pet->InitPetCreateSpells();
+ pet->SetFullHealth();
+
+ pet->GetMap()->AddToMap(pet->ToCreature());
+
+ // visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
+
+ player->SetMinion(pet, true);
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ player->PetSpellInitialize();
+
+ return true;
+ }
+
+ static bool HandlePetLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ return false;
+
+ // Check if pet already has it
+ if (pet->HasSpell(spellId))
+ {
+ handler->PSendSysMessage("Pet already has spell: %u", spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Check if spell is valid
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ pet->learnSpell(spellId);
+
+ handler->PSendSysMessage("Pet has learned spell %u", spellId);
+ return true;
+ }
+
+ static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (pet->HasSpell(spellId))
+ pet->removeSpell(spellId, false);
+ else
+ handler->PSendSysMessage("Pet doesn't have that spell");
+
+ return true;
+ }
+
+ static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
+ {
+ std::string name;
+ Player* player;
+ char const* TargetName = strtok((char*)args, " "); // get entered name
+ if (!TargetName) // if no name entered use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player) //prevent crash with creature as target
+ {
+ name = player->GetName();
+ normalizePlayerName(name);
+ }
+ }
+ else // if name entered
+ {
+ name = TargetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
+ }
+
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ if (player == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
+ return true;
+ }
+
+ // effect
+ if (player && (player != handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
+
+ // stop combat + make player unattackable + duel stop + stop some spells
+ player->setFaction(35);
+ player->CombatStop();
+ if (player->IsNonMeleeSpellCasted(true))
+ player->InterruptNonMeleeSpells(true);
+ player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // if player class = hunter || warlock remove pet if alive
+ if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
+ {
+ if (Pet* pet = player->GetPet())
+ {
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ // not let dismiss dead pet
+ if (pet && pet->isAlive())
+ player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
+ }
+ }
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
+
+ // save player
+ player->SaveToDB();
+ }
+
+ return true;
+ }
+
+ static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args)
+ {
+ std::string name;
+ Player* player;
+ char* targetName = strtok((char*)args, " "); // Get entered name
+
+ if (targetName)
+ {
+ name = targetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
+ }
+ else // If no name was entered - use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player)
+ name = player->GetName();
+ }
+
+ if (player)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+
+ // Reset player faction + allow combat + allow duels
+ player->setFactionForRace(player->getRace());
+ player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // Remove Freeze spell (allowing movement and spells)
+ player->RemoveAurasDueToSpell(9454);
+
+ // Save player
+ player->SaveToDB();
+ }
+ else
+ {
+ if (targetName)
+ {
+ // Check for offline players
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
+ stmt->setString(0, name);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ // If player found: delete his freeze aura
+ Field* fields = result->Fetch();
+ uint32 lowGuid = fields[0].GetUInt32();
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
+ stmt->setUInt32(0, lowGuid);
+ CharacterDatabase.Execute(stmt);
+
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+ return true;
+ }
+ else
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ // Get names from DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
+ return true;
+ }
+
+ // Header of the names
+ handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
+
+ // Output of the results
+ do
+ {
+ Field* fields = result->Fetch();
+ std::string player = fields[0].GetString();
+ handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
+ }
+ while (result->NextRow());
+
+ return true;
+ }
+
+ static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group && group->GetLeaderGUID() != guid)
+ {
+ group->ChangeLeader(guid);
+ group->SendUpdate();
+ }
+
+ return true;
+ }
+
+ static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group)
+ group->Disband();
+
+ return true;
+ }
+
+ static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true))
+ if (group)
+ group->RemoveMember(guid);
+
+ return true;
+ }
+
+ static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 soundId = atoi((char*)args);
+
+ if (!sSoundEntriesStore.LookupEntry(soundId))
+ {
+ handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ WorldPacket data(SMSG_PLAY_SOUND, 4);
+ data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID();
+ sWorld->SendGlobalMessage(&data);
+
+ handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
+ return true;
+ }
+
+ static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
+ return true;
+ }
+
+ static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ unit = handler->GetSession()->GetPlayer();
+
+ unit->RemoveCharmAuras();
+
+ return true;
+ }
+
+ static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
+ return true;
+ }
+
+ static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ if (player->isPossessing())
+ return false;
+
+ player->StopCastingBindSight();
+ return true;
+ }
+};
+
+void AddSC_misc_commandscript()
+{
+ new misc_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 32ee96dacfe..a88c765c596 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -33,6 +33,16 @@ public:
ChatCommand* GetCommands() const
{
+ static ChatCommand modifyspeedCommandTable[] =
+ {
+ { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL },
+ { "all", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL },
+ { "walk", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL },
+ { "backwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL },
+ { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL },
+ { "", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
static ChatCommand modifyCommandTable[] =
{
{ "hp", SEC_MODERATOR, false, &HandleModifyHPCommand, "", NULL },
@@ -41,29 +51,26 @@ public:
{ "runicpower", SEC_MODERATOR, false, &HandleModifyRunicPowerCommand, "", NULL },
{ "energy", SEC_MODERATOR, false, &HandleModifyEnergyCommand, "", NULL },
{ "money", SEC_MODERATOR, false, &HandleModifyMoneyCommand, "", NULL },
- { "speed", SEC_MODERATOR, false, &HandleModifySpeedCommand, "", NULL },
- { "swim", SEC_MODERATOR, false, &HandleModifySwimCommand, "", NULL },
{ "scale", SEC_MODERATOR, false, &HandleModifyScaleCommand, "", NULL },
{ "bit", SEC_MODERATOR, false, &HandleModifyBitCommand, "", NULL },
- { "bwalk", SEC_MODERATOR, false, &HandleModifyBWalkCommand, "", NULL },
- { "fly", SEC_MODERATOR, false, &HandleModifyFlyCommand, "", NULL },
- { "aspeed", SEC_MODERATOR, false, &HandleModifyASpeedCommand, "", NULL },
{ "faction", SEC_MODERATOR, false, &HandleModifyFactionCommand, "", NULL },
{ "spell", SEC_MODERATOR, false, &HandleModifySpellCommand, "", NULL },
- { "tp", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL },
+ { "talentpoints", SEC_MODERATOR, false, &HandleModifyTalentCommand, "", NULL },
{ "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL },
{ "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL },
- { "rep", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL },
- { "arena", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL },
+ { "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL },
+ { "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL },
{ "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL },
{ "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL },
- { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL },
{ "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL },
{ "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL },
+ { "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
+ { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL },
+ { "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL },
{ "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable },
{ NULL, 0, false, NULL, "", NULL }
};
@@ -191,7 +198,7 @@ public:
target->SetMaxPower(POWER_ENERGY, energym);
target->SetPower(POWER_ENERGY, energy);
- sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
return true;
}
@@ -711,7 +718,7 @@ public:
(ChatHandler(player)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale);
}
- target->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
+ target->SetObjectScale(Scale);
return true;
}
@@ -1003,7 +1010,7 @@ public:
{
int32 newmoney = int32(moneyuser) + addmoney;
- sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
if (newmoney <= 0)
{
handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str());
@@ -1035,7 +1042,7 @@ public:
target->ModifyMoney(addmoney);
}
- sLog->outDetail(handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
return true;
}
@@ -1123,20 +1130,15 @@ public:
static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args)
{
- if (!*args) return false;
+ if (!*args)
+ return false;
- uint32 drunklevel = (uint32)atoi(args);
+ uint8 drunklevel = (uint8)atoi(args);
if (drunklevel > 100)
drunklevel = 100;
- uint16 drunkMod = drunklevel * 0xFFFF / 100;
-
- Player* target = handler->getSelectedPlayer();
- if (!target)
- target = handler->GetSession()->GetPlayer();
-
- if (target)
- target->SetDrunkValue(drunkMod);
+ if (Player* target = handler->getSelectedPlayer())
+ target->SetDrunkValue(drunklevel);
return true;
}
@@ -1234,7 +1236,7 @@ public:
return false;
}
- target->GetReputationMgr().SetReputation(factionEntry, amount);
+ target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false);
handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId,
handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
return true;
@@ -1376,6 +1378,21 @@ public:
return true;
}
+//demorph player or unit
+ static bool HandleDeMorphCommand(ChatHandler* handler, const char* /*args*/)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ target = handler->GetSession()->GetPlayer();
+
+ // check online security
+ else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
+ return false;
+
+ target->DeMorph();
+
+ return true;
+ }
};
void AddSC_modify_commandscript()
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index a9959c60201..77fc2918e0b 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "Transport.h"
#include "CreatureGroups.h"
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
+#include "CreatureAI.h"
class npc_commandscript : public CommandScript
{
@@ -73,6 +74,7 @@ public:
{ "phase", SEC_GAMEMASTER, false, &HandleNpcSetPhaseCommand, "", NULL },
{ "spawndist", SEC_GAMEMASTER, false, &HandleNpcSetSpawnDistCommand, "", NULL },
{ "spawntime", SEC_GAMEMASTER, false, &HandleNpcSetSpawnTimeCommand, "", NULL },
+ { "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "", NULL },
//{ TODO: fix or remove these commands
{ "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL },
{ "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL },
@@ -524,6 +526,39 @@ public:
return true;
}
+ //set data of creature for testing scripting
+ static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args)
+ {
+ if (!*args)
+ return false;
+
+ char* arg1 = strtok((char*)args, " ");
+ char* arg2 = strtok((char*)NULL, "");
+
+ if (!arg1 || !arg2)
+ return false;
+
+ uint32 data_1 = (uint32)atoi(arg1);
+ uint32 data_2 = (uint32)atoi(arg2);
+
+ if (!data_1 || !data_2)
+ return false;
+
+ Creature* creature = handler->getSelectedCreature();
+
+ if (!creature)
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ creature->AI()->SetData(data_1, data_2);
+ std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
+ handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str());
+ return true;
+ }
+
//npc follow handling
static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/)
{
@@ -769,7 +804,7 @@ public:
if (dontdel_str)
{
- //sLog->outError("DEBUG: All 3 params are set");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set");
// All 3 params are set
// GUID
@@ -777,7 +812,7 @@ public:
// doNotDEL
if (stricmp(dontdel_str, "NODEL") == 0)
{
- //sLog->outError("DEBUG: doNotDelete = true;");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;");
doNotDelete = true;
}
}
@@ -786,10 +821,10 @@ public:
// Only 2 params - but maybe NODEL is set
if (type_str)
{
- sLog->outError("DEBUG: Only 2 params ");
+ sLog->outError(LOG_FILTER_GENERAL, "DEBUG: Only 2 params ");
if (stricmp(type_str, "NODEL") == 0)
{
- //sLog->outError("DEBUG: type_str, NODEL ");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL ");
doNotDelete = true;
type_str = NULL;
}
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 2472a29e595..7e489a5781e 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -38,6 +38,7 @@ public:
{ "add", SEC_ADMINISTRATOR, false, &HandleQuestAdd, "", NULL },
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
+ { "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
@@ -77,7 +78,7 @@ public:
// check item starting quest (it can work incorrectly if added without item in inventory)
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
- ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
+ ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
if (result != itc->end())
{
@@ -244,6 +245,38 @@ public:
player->CompleteQuest(entry);
return true;
}
+
+ static bool HandleQuestReward(ChatHandler* handler, char const* args)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // .quest reward #entry
+ // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
+ char* cId = handler->extractKeyFromLink((char*)args, "Hquest");
+ if (!cId)
+ return false;
+
+ uint32 entry = atol(cId);
+
+ Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
+
+ // If player doesn't have the quest
+ if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->RewardQuest(quest, 0, player);
+ return true;
+ }
};
void AddSC_quest_commandscript()
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 1c119fdef4c..3bb29f8abfe 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -222,7 +222,7 @@ public:
static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables...");
LoadLootTables();
handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -245,7 +245,7 @@ public:
HandleReloadQuestPOICommand(handler, "a");
HandleReloadQuestTemplateCommand(handler, "a");
- sLog->outString("Re-Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quests Relations...");
sObjectMgr->LoadQuestRelations();
handler->SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded.");
return true;
@@ -260,7 +260,7 @@ public:
return false;
}
- sLog->outString("Re-Loading Scripts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts...");
HandleReloadGameObjectScriptsCommand(handler, "a");
HandleReloadEventScriptsCommand(handler, "a");
HandleReloadQuestEndScriptsCommand(handler, "a");
@@ -333,7 +333,7 @@ public:
static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading config settings...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading config settings...");
sWorld->LoadConfigSettings(true);
sMapMgr->InitializeVisibilityDistanceInfo();
handler->SendGlobalGMSysMessage("World config settings reloaded.");
@@ -342,7 +342,7 @@ public:
static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Access Requirement definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions...");
sObjectMgr->LoadAccessRequirements();
handler->SendGlobalGMSysMessage("DB table `access_requirement` reloaded.");
return true;
@@ -350,7 +350,7 @@ public:
static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Additional Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded.");
return true;
@@ -358,7 +358,7 @@ public:
static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Achievement Reward Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data...");
sAchievementMgr->LoadRewards();
handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded.");
return true;
@@ -366,7 +366,7 @@ public:
static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded.");
return true;
@@ -374,7 +374,7 @@ public:
static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading AreaTrigger teleport definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded.");
return true;
@@ -382,7 +382,7 @@ public:
static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts...");
sWorld->LoadAutobroadcasts();
handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded.");
return true;
@@ -397,7 +397,7 @@ public:
static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading creature award reputation definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions...");
sObjectMgr->LoadReputationOnKill();
handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded.");
return true;
@@ -431,7 +431,7 @@ public:
continue;
}
- sLog->outString("Reloading creature template entry %u", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry);
Field* fields = result->Fetch();
@@ -527,7 +527,7 @@ public:
static bool HandleReloadCreatureQuestRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`creature_questrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)");
sObjectMgr->LoadCreatureQuestRelations();
handler->SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");
return true;
@@ -535,7 +535,7 @@ public:
static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Linked Respawns... (`creature_linked_respawn`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)");
sObjectMgr->LoadLinkedRespawn();
handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded.");
return true;
@@ -543,7 +543,7 @@ public:
static bool HandleReloadCreatureQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`creature_involvedrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)");
sObjectMgr->LoadCreatureInvolvedRelations();
handler->SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");
return true;
@@ -551,7 +551,7 @@ public:
static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `gossip_menu` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!");
sObjectMgr->LoadGossipMenu();
handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -560,7 +560,7 @@ public:
static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `gossip_menu_option` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!");
sObjectMgr->LoadGossipMenuItems();
handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -569,7 +569,7 @@ public:
static bool HandleReloadGOQuestRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`gameobject_questrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)");
sObjectMgr->LoadGameobjectQuestRelations();
handler->SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");
return true;
@@ -577,7 +577,7 @@ public:
static bool HandleReloadGOQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`gameobject_involvedrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)");
sObjectMgr->LoadGameobjectInvolvedRelations();
handler->SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");
return true;
@@ -585,7 +585,7 @@ public:
static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded.");
return true;
@@ -593,12 +593,12 @@ public:
static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Quest Templates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Templates...");
sObjectMgr->LoadQuests();
handler->SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded.");
/// dependent also from `gameobject` but this table not reloaded anyway
- sLog->outString("Re-Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded.");
return true;
@@ -606,7 +606,7 @@ public:
static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`creature_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)");
LoadLootTemplates_Creature();
LootTemplates_Creature.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded.");
@@ -616,7 +616,7 @@ public:
static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`disenchant_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)");
LoadLootTemplates_Disenchant();
LootTemplates_Disenchant.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded.");
@@ -626,7 +626,7 @@ public:
static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`fishing_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)");
LoadLootTemplates_Fishing();
LootTemplates_Fishing.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded.");
@@ -636,7 +636,7 @@ public:
static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`gameobject_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)");
LoadLootTemplates_Gameobject();
LootTemplates_Gameobject.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded.");
@@ -646,7 +646,7 @@ public:
static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`item_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)");
LoadLootTemplates_Item();
LootTemplates_Item.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded.");
@@ -656,7 +656,7 @@ public:
static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`milling_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)");
LoadLootTemplates_Milling();
LootTemplates_Milling.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded.");
@@ -666,7 +666,7 @@ public:
static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
LoadLootTemplates_Pickpocketing();
LootTemplates_Pickpocketing.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded.");
@@ -676,7 +676,7 @@ public:
static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`prospecting_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)");
LoadLootTemplates_Prospecting();
LootTemplates_Prospecting.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded.");
@@ -686,7 +686,7 @@ public:
static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`mail_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)");
LoadLootTemplates_Mail();
LootTemplates_Mail.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded.");
@@ -696,7 +696,7 @@ public:
static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`reference_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)");
LoadLootTemplates_Reference();
handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -705,7 +705,7 @@ public:
static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`skinning_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)");
LoadLootTemplates_Skinning();
LootTemplates_Skinning.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded.");
@@ -715,7 +715,7 @@ public:
static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`spell_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)");
LoadLootTemplates_Spell();
LootTemplates_Spell.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded.");
@@ -725,7 +725,7 @@ public:
static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading trinity_string Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!");
sObjectMgr->LoadTrinityStrings();
handler->SendGlobalGMSysMessage("DB table `trinity_string` reloaded.");
return true;
@@ -740,7 +740,7 @@ public:
return false;
}
- sLog->outString("Re-Loading warden_action Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!");
sWardenCheckMgr->LoadWardenOverrides();
handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded.");
return true;
@@ -748,7 +748,7 @@ public:
static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_trainer` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!");
sObjectMgr->LoadTrainerSpell();
handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded.");
return true;
@@ -756,7 +756,7 @@ public:
static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_vendor` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!");
sObjectMgr->LoadVendors();
handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded.");
return true;
@@ -764,7 +764,7 @@ public:
static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `points_of_interest` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!");
sObjectMgr->LoadPointsOfInterest();
handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded.");
return true;
@@ -772,7 +772,7 @@ public:
static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading Quest POI ..." );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." );
sObjectMgr->LoadQuestPOI();
handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded.");
return true;
@@ -780,7 +780,7 @@ public:
static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_spellclick_spells` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!");
sObjectMgr->LoadNPCSpellClickSpells();
handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded.");
return true;
@@ -788,7 +788,7 @@ public:
static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading ReservedNames... (`reserved_name`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)");
sObjectMgr->LoadReservedPlayersNames();
handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded.");
return true;
@@ -796,7 +796,7 @@ public:
static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading `reputation_reward_rate` Table!" );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" );
sObjectMgr->LoadReputationRewardRate();
handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded.");
return true;
@@ -804,7 +804,7 @@ public:
static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading `reputation_spillover_template` Table!" );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" );
sObjectMgr->LoadReputationSpilloverTemplate();
handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded.");
return true;
@@ -812,7 +812,7 @@ public:
static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded.");
return true;
@@ -820,7 +820,7 @@ public:
static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
handler->SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded.");
return true;
@@ -828,7 +828,7 @@ public:
static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
handler->SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded.");
return true;
@@ -836,7 +836,7 @@ public:
static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading SpellArea Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading SpellArea Data...");
sSpellMgr->LoadSpellAreas();
handler->SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded.");
return true;
@@ -844,7 +844,7 @@ public:
static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Required Data... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... ");
sSpellMgr->LoadSpellRequired();
handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded.");
return true;
@@ -852,7 +852,7 @@ public:
static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Groups...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Groups...");
sSpellMgr->LoadSpellGroups();
handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded.");
return true;
@@ -860,7 +860,7 @@ public:
static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
handler->SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded.");
return true;
@@ -868,7 +868,7 @@ public:
static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Linked Spells...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells...");
sSpellMgr->LoadSpellLinked();
handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded.");
return true;
@@ -876,7 +876,7 @@ public:
static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
handler->SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded.");
return true;
@@ -884,7 +884,7 @@ public:
static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
handler->SendGlobalGMSysMessage("DB table `spell_proc` (spell proc conditions and data) reloaded.");
return true;
@@ -892,7 +892,7 @@ public:
static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded.");
return true;
@@ -900,7 +900,7 @@ public:
static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
handler->SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded.");
return true;
@@ -908,7 +908,7 @@ public:
static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded.");
return true;
@@ -916,7 +916,7 @@ public:
static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
handler->SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded.");
return true;
@@ -924,7 +924,7 @@ public:
static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell pet auras...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded.");
return true;
@@ -932,7 +932,7 @@ public:
static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Page Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Page Texts...");
sObjectMgr->LoadPageTexts();
handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded.");
return true;
@@ -940,7 +940,7 @@ public:
static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded.");
return true;
@@ -948,8 +948,8 @@ public:
static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Item set names...");
- LoadRandomEnchantmentsTable();
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names...");
+ sObjectMgr->LoadItemSetNames();
handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
return true;
}
@@ -964,7 +964,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `gameobject_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `gameobject_scripts`...");
sObjectMgr->LoadGameObjectScripts();
@@ -984,7 +984,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `event_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`...");
sObjectMgr->LoadEventScripts();
@@ -1004,7 +1004,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `waypoint_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`...");
sObjectMgr->LoadWaypointScripts();
@@ -1017,7 +1017,7 @@ public:
static bool HandleReloadWpCommand(ChatHandler* handler, const char* args)
{
if (*args != 'a')
- sLog->outString("Re-Loading Waypoints data from 'waypoints_data'");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'");
sWaypointMgr->Load();
@@ -1030,7 +1030,7 @@ public:
static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Texts from `creature_ai_texts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`...");
sEventAIMgr->LoadCreatureEventAI_Texts();
handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded.");
return true;
@@ -1038,7 +1038,7 @@ public:
static bool HandleReloadEventAISummonsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Summons from `creature_ai_summons`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Summons from `creature_ai_summons`...");
sEventAIMgr->LoadCreatureEventAI_Summons();
handler->SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded.");
return true;
@@ -1046,7 +1046,7 @@ public:
static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Scripts from `creature_ai_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded.");
return true;
@@ -1062,7 +1062,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `quest_end_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_end_scripts`...");
sObjectMgr->LoadQuestEndScripts();
@@ -1082,7 +1082,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `quest_start_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_start_scripts`...");
sObjectMgr->LoadQuestStartScripts();
@@ -1102,7 +1102,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `spell_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`...");
sObjectMgr->LoadSpellScripts();
@@ -1114,7 +1114,7 @@ public:
static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Script strings from `db_script_string`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`...");
sObjectMgr->LoadDbScriptStrings();
handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded.");
return true;
@@ -1122,7 +1122,7 @@ public:
static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
@@ -1133,7 +1133,7 @@ public:
static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Game Tele coordinates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates...");
sObjectMgr->LoadGameTele();
@@ -1144,9 +1144,9 @@ public:
static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading disables table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading disables table...");
DisableMgr::LoadDisables();
- sLog->outString("Checking quest disables...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Checking quest disables...");
DisableMgr::CheckQuestDisables();
handler->SendGlobalGMSysMessage("DB table `disables` reloaded.");
return true;
@@ -1154,7 +1154,7 @@ public:
static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Achievement Reward Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data...");
sAchievementMgr->LoadRewardLocales();
handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded.");
return true;
@@ -1162,7 +1162,7 @@ public:
static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading lfg dungeon rewards...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards...");
sLFGMgr->LoadRewards();
handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded.");
return true;
@@ -1170,7 +1170,7 @@ public:
static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Creature ...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ...");
sObjectMgr->LoadCreatureLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded.");
return true;
@@ -1178,7 +1178,7 @@ public:
static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Creature Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts...");
sCreatureTextMgr->LoadCreatureTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded.");
return true;
@@ -1186,7 +1186,7 @@ public:
static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Gameobject ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... ");
sObjectMgr->LoadGameObjectLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded.");
return true;
@@ -1194,7 +1194,7 @@ public:
static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading Locales Gossip Menu Option ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... ");
sObjectMgr->LoadGossipMenuItemsLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded.");
return true;
@@ -1202,7 +1202,7 @@ public:
static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Item ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... ");
sObjectMgr->LoadItemLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded.");
return true;
@@ -1210,7 +1210,7 @@ public:
static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Item set name... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... ");
sObjectMgr->LoadItemSetNameLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded.");
return true;
@@ -1218,7 +1218,7 @@ public:
static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales NPC Text ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... ");
sObjectMgr->LoadNpcTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded.");
return true;
@@ -1226,7 +1226,7 @@ public:
static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Page Text ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... ");
sObjectMgr->LoadPageTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded.");
return true;
@@ -1234,7 +1234,7 @@ public:
static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Points Of Interest ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... ");
sObjectMgr->LoadPointOfInterestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded.");
return true;
@@ -1242,7 +1242,7 @@ public:
static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Quest ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... ");
sObjectMgr->LoadQuestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded.");
return true;
@@ -1250,7 +1250,7 @@ public:
static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded.");
return true;
@@ -1259,7 +1259,7 @@ public:
static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/)
{
///- Reload dynamic data tables from the database
- sLog->outString("Re-Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Auctions...");
sAuctionMgr->LoadAuctionItems();
sAuctionMgr->LoadAuctions();
handler->SendGlobalGMSysMessage("Auctions reloaded.");
@@ -1268,7 +1268,7 @@ public:
static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Conditions...");
sConditionMgr->LoadConditions(true);
handler->SendGlobalGMSysMessage("Conditions reloaded.");
return true;
@@ -1276,7 +1276,7 @@ public:
static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
handler->SendGlobalGMSysMessage("Creature Texts reloaded.");
return true;
@@ -1284,7 +1284,7 @@ public:
static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Smart Scripts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
handler->SendGlobalGMSysMessage("Smart Scripts reloaded.");
return true;
@@ -1292,7 +1292,7 @@ public:
static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Reloading vehicle_accessory table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table...");
sObjectMgr->LoadVehicleAccessories();
handler->SendGlobalGMSysMessage("Vehicle accessories reloaded.");
return true;
@@ -1300,7 +1300,7 @@ public:
static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Reloading vehicle_template_accessory table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table...");
sObjectMgr->LoadVehicleTemplateAccessories();
handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded.");
return true;
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
new file mode 100644
index 00000000000..82fb409faa7
--- /dev/null
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: reset_commandscript
+%Complete: 100
+Comment: All reset related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "ObjectAccessor.h"
+
+class reset_commandscript : public CommandScript
+{
+public:
+ reset_commandscript() : CommandScript("reset_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand resetCommandTable[] =
+ {
+ { "achievements", SEC_ADMINISTRATOR, true, &HandleResetAchievementsCommand, "", NULL },
+ { "honor", SEC_ADMINISTRATOR, true, &HandleResetHonorCommand, "", NULL },
+ { "level", SEC_ADMINISTRATOR, true, &HandleResetLevelCommand, "", NULL },
+ { "spells", SEC_ADMINISTRATOR, true, &HandleResetSpellsCommand, "", NULL },
+ { "stats", SEC_ADMINISTRATOR, true, &HandleResetStatsCommand, "", NULL },
+ { "talents", SEC_ADMINISTRATOR, true, &HandleResetTalentsCommand, "", NULL },
+ { "all", SEC_ADMINISTRATOR, true, &HandleResetAllCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleResetAchievementsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ if (target)
+ target->GetAchievementMgr().Reset();
+ else
+ AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid));
+
+ return true;
+ }
+
+ static bool HandleResetHonorCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ target->SetHonorPoints(0);
+ target->SetUInt32Value(PLAYER_FIELD_KILLS, 0);
+ target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0);
+ target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
+ target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);
+ target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
+
+ return true;
+ }
+
+ static bool HandleResetStatsOrLevelHelper(Player* player)
+ {
+ ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass());
+ if (!classEntry)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass());
+ return false;
+ }
+
+ uint8 powerType = classEntry->powerType;
+
+ // reset m_form if no aura
+ if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
+ player->SetShapeshiftForm(FORM_NONE);
+
+ player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
+ player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH);
+
+ player->setFactionForRace(player->getRace());
+
+ player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powerType << 24)));
+
+ // reset only if player not in some form;
+ if (player->GetShapeshiftForm() == FORM_NONE)
+ player->InitDisplayIds();
+
+ player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
+
+ player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
+
+ //-1 is default value
+ player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));
+
+ //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000);
+ return true;
+ }
+
+ static bool HandleResetLevelCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ if (!HandleResetStatsOrLevelHelper(target))
+ return false;
+
+ uint8 oldLevel = target->getLevel();
+
+ // set starting level
+ uint32 startLevel = target->getClass() != CLASS_DEATH_KNIGHT
+ ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
+ : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
+
+ target->_ApplyAllLevelScaleItemMods(false);
+ target->SetLevel(startLevel);
+ target->InitRunes();
+ target->InitStatsForLevel(true);
+ target->InitTaxiNodesForLevel();
+ target->InitGlyphsForLevel();
+ target->InitTalentForLevel();
+ target->SetUInt32Value(PLAYER_XP, 0);
+
+ target->_ApplyAllLevelScaleItemMods(true);
+
+ // reset level for pet
+ if (Pet* pet = target->GetPet())
+ pet->SynchronizeLevelWithOwner();
+
+ sScriptMgr->OnPlayerLevelChanged(target, oldLevel);
+
+ return true;
+ }
+
+ static bool HandleResetSpellsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ if (target)
+ {
+ target->resetSpells(/* bool myClassOnly */);
+
+ ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS);
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target)
+ handler->PSendSysMessage(LANG_RESET_SPELLS_ONLINE, handler->GetNameLink(target).c_str());
+ }
+ else
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
+ stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ CharacterDatabase.Execute(stmt);
+
+ handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str());
+ }
+
+ return true;
+ }
+
+ static bool HandleResetStatsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ if (!HandleResetStatsOrLevelHelper(target))
+ return false;
+
+ target->InitRunes();
+ target->InitStatsForLevel(true);
+ target->InitTaxiNodesForLevel();
+ target->InitGlyphsForLevel();
+ target->InitTalentForLevel();
+
+ return true;
+ }
+
+ static bool HandleResetTalentsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ {
+ // Try reset talents as Hunter Pet
+ Creature* creature = handler->getSelectedCreature();
+ if (!*args && creature && creature->isPet())
+ {
+ Unit* owner = creature->GetOwner();
+ if (owner && owner->GetTypeId() == TYPEID_PLAYER && creature->ToPet()->IsPermanentPetFor(owner->ToPlayer()))
+ {
+ creature->ToPet()->resetTalents();
+ owner->ToPlayer()->SendTalentsInfoData(true);
+
+ ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS);
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != owner->ToPlayer())
+ handler->PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, handler->GetNameLink(owner->ToPlayer()).c_str());
+ }
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ target->resetTalents(true);
+ target->SendTalentsInfoData(false);
+ ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target)
+ handler->PSendSysMessage(LANG_RESET_TALENTS_ONLINE, handler->GetNameLink(target).c_str());
+
+ Pet* pet = target->GetPet();
+ Pet::resetTalentsForAllPetsOf(target, pet);
+ if (pet)
+ target->SendTalentsInfoData(true);
+ return true;
+ }
+ else if (targetGuid)
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
+ stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+ CharacterDatabase.Execute(stmt);
+
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ static bool HandleResetAllCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string caseName = args;
+
+ AtLoginFlags atLogin;
+
+ // Command specially created as single command to prevent using short case names
+ if (caseName == "spells")
+ {
+ atLogin = AT_LOGIN_RESET_SPELLS;
+ sWorld->SendWorldText(LANG_RESETALL_SPELLS);
+ if (!handler->GetSession())
+ handler->SendSysMessage(LANG_RESETALL_SPELLS);
+ }
+ else if (caseName == "talents")
+ {
+ atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS);
+ sWorld->SendWorldText(LANG_RESETALL_TALENTS);
+ if (!handler->GetSession())
+ handler->SendSysMessage(LANG_RESETALL_TALENTS);
+ }
+ else
+ {
+ handler->PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE, args);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS);
+ stmt->setUInt16(0, uint16(atLogin));
+ CharacterDatabase.Execute(stmt);
+
+ TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
+ HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers();
+ for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
+ itr->second->SetAtLoginFlag(atLogin);
+
+ return true;
+ }
+};
+
+void AddSC_reset_commandscript()
+{
+ new reset_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
new file mode 100644
index 00000000000..db1995ebb6e
--- /dev/null
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -0,0 +1,420 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: server_commandscript
+%Complete: 100
+Comment: All server related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "SystemConfig.h"
+#include "Config.h"
+#include "ObjectAccessor.h"
+
+class server_commandscript : public CommandScript
+{
+public:
+ server_commandscript() : CommandScript("server_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand serverIdleRestartCommandTable[] =
+ {
+ { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
+ { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand serverIdleShutdownCommandTable[] =
+ {
+ { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
+ { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand serverRestartCommandTable[] =
+ {
+ { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
+ { "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand serverShutdownCommandTable[] =
+ {
+ { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "", NULL },
+ { "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand serverSetCommandTable[] =
+ {
+ { "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL },
+ { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL },
+ { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL },
+ { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand serverCommandTable[] =
+ {
+ { "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "", NULL },
+ { "exit", SEC_CONSOLE, true, &HandleServerExitCommand, "", NULL },
+ { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable },
+ { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable },
+ { "info", SEC_PLAYER, true, &HandleServerInfoCommand, "", NULL },
+ { "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "", NULL },
+ { "plimit", SEC_ADMINISTRATOR, true, &HandleServerPLimitCommand, "", NULL },
+ { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable },
+ { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable },
+ { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ // Triggering corpses expire check in world
+ static bool HandleServerCorpsesCommand(ChatHandler* /*handler*/, char const* /*args*/)
+ {
+ sObjectAccessor->RemoveOldCorpses();
+ return true;
+ }
+
+ static bool HandleServerInfoCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ uint32 playersNum = sWorld->GetPlayerCount();
+ uint32 maxPlayersNum = sWorld->GetMaxPlayerCount();
+ uint32 activeClientsNum = sWorld->GetActiveSessionCount();
+ uint32 queuedClientsNum = sWorld->GetQueuedSessionCount();
+ uint32 maxActiveClientsNum = sWorld->GetMaxActiveSessionCount();
+ uint32 maxQueuedClientsNum = sWorld->GetMaxQueuedSessionCount();
+ std::string uptime = secsToTimeString(sWorld->GetUptime());
+ uint32 updateTime = sWorld->GetUpdateTime();
+
+ handler->SendSysMessage(_FULLVERSION);
+ handler->PSendSysMessage(LANG_CONNECTED_PLAYERS, playersNum, maxPlayersNum);
+ handler->PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
+ handler->PSendSysMessage(LANG_UPTIME, uptime.c_str());
+ handler->PSendSysMessage(LANG_UPDATE_DIFF, updateTime);
+ // Can't use sWorld->ShutdownMsg here in case of console command
+ if (sWorld->IsShuttingDown())
+ handler->PSendSysMessage(LANG_SHUTDOWN_TIMELEFT, secsToTimeString(sWorld->GetShutDownTimeLeft()).c_str());
+
+ return true;
+ }
+ // Display the 'Message of the day' for the realm
+ static bool HandleServerMotdCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->PSendSysMessage(LANG_MOTD_CURRENT, sWorld->GetMotd());
+ return true;
+ }
+
+ static bool HandleServerPLimitCommand(ChatHandler* handler, char const* args)
+ {
+ if (*args)
+ {
+ char* paramStr = strtok((char*)args, " ");
+ if (!paramStr)
+ return false;
+
+ int32 limit = strlen(paramStr);
+
+ if (strncmp(paramStr, "player", limit) == 0)
+ sWorld->SetPlayerSecurityLimit(SEC_PLAYER);
+ else if (strncmp(paramStr, "moderator", limit) == 0)
+ sWorld->SetPlayerSecurityLimit(SEC_MODERATOR);
+ else if (strncmp(paramStr, "gamemaster", limit) == 0)
+ sWorld->SetPlayerSecurityLimit(SEC_GAMEMASTER);
+ else if (strncmp(paramStr, "administrator", limit) == 0)
+ sWorld->SetPlayerSecurityLimit(SEC_ADMINISTRATOR);
+ else if (strncmp(paramStr, "reset", limit) == 0)
+ {
+ sWorld->SetPlayerAmountLimit(ConfigMgr::GetIntDefault("PlayerLimit", 100));
+ sWorld->LoadDBAllowedSecurityLevel();
+ }
+ else
+ {
+ int32 value = atoi(paramStr);
+ if (value < 0)
+ sWorld->SetPlayerSecurityLimit(AccountTypes(-value));
+ else
+ sWorld->SetPlayerAmountLimit(uint32(value));
+ }
+ }
+
+ uint32 playerAmountLimit = sWorld->GetPlayerAmountLimit();
+ AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
+ char const* secName = "";
+ switch (allowedAccountType)
+ {
+ case SEC_PLAYER:
+ secName = "Player";
+ break;
+ case SEC_MODERATOR:
+ secName = "Moderator";
+ break;
+ case SEC_GAMEMASTER:
+ secName = "Gamemaster";
+ break;
+ case SEC_ADMINISTRATOR:
+ secName = "Administrator";
+ break;
+ default:
+ secName = "<unknown>";
+ break;
+ }
+ handler->PSendSysMessage("Player limits: amount %u, min. security level %s.", playerAmountLimit, secName);
+
+ return true;
+ }
+
+ static bool HandleServerShutDownCancelCommand(ChatHandler* /*handler*/, char const* /*args*/)
+ {
+ sWorld->ShutdownCancel();
+
+ return true;
+ }
+
+ static bool HandleServerShutDownCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* timeStr = strtok((char*) args, " ");
+ char* exitCodeStr = strtok(NULL, "");
+
+ int32 time = atoi(timeStr);
+
+ // Prevent interpret wrong arg value as 0 secs shutdown time
+ if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
+ return false;
+
+ if (exitCodeStr)
+ {
+ int32 exitCode = atoi(exitCodeStr);
+
+ // Handle atoi() errors
+ if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
+ return false;
+
+ // Exit code should be in range of 0-125, 126-255 is used
+ // in many shells for their own return codes and code > 255
+ // is not supported in many others
+ if (exitCode < 0 || exitCode > 125)
+ return false;
+
+ sWorld->ShutdownServ(time, 0, exitCode);
+ }
+ else
+ sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE);
+
+ return true;
+ }
+
+ static bool HandleServerRestartCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* timeStr = strtok((char*) args, " ");
+ char* exitCodeStr = strtok(NULL, "");
+
+ int32 time = atoi(timeStr);
+
+ // Prevent interpret wrong arg value as 0 secs shutdown time
+ if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
+ return false;
+
+ if (exitCodeStr)
+ {
+ int32 exitCode = atoi(exitCodeStr);
+
+ // Handle atoi() errors
+ if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
+ return false;
+
+ // Exit code should be in range of 0-125, 126-255 is used
+ // in many shells for their own return codes and code > 255
+ // is not supported in many others
+ if (exitCode < 0 || exitCode > 125)
+ return false;
+
+ sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitCode);
+ }
+ else
+ sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE);
+
+ return true;
+ }
+
+ static bool HandleServerIdleRestartCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* timeStr = strtok((char*) args, " ");
+ char* exitCodeStr = strtok(NULL, "");
+
+ int32 time = atoi(timeStr);
+
+ // Prevent interpret wrong arg value as 0 secs shutdown time
+ if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
+ return false;
+
+ if (exitCodeStr)
+ {
+ int32 exitCode = atoi(exitCodeStr);
+
+ // Handle atoi() errors
+ if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
+ return false;
+
+ // Exit code should be in range of 0-125, 126-255 is used
+ // in many shells for their own return codes and code > 255
+ // is not supported in many others
+ if (exitCode < 0 || exitCode > 125)
+ return false;
+
+ sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, exitCode);
+ }
+ else
+ sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE);
+ return true;
+ }
+
+ static bool HandleServerIdleShutDownCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* timeStr = strtok((char*) args, " ");
+ char* exitCodeStr = strtok(NULL, "");
+
+ int32 time = atoi(timeStr);
+
+ // Prevent interpret wrong arg value as 0 secs shutdown time
+ if ((time == 0 && (timeStr[0] != '0' || timeStr[1] != '\0')) || time < 0)
+ return false;
+
+ if (exitCodeStr)
+ {
+ int32 exitCode = atoi(exitCodeStr);
+
+ // Handle atoi() errors
+ if (exitCode == 0 && (exitCodeStr[0] != '0' || exitCodeStr[1] != '\0'))
+ return false;
+
+ // Exit code should be in range of 0-125, 126-255 is used
+ // in many shells for their own return codes and code > 255
+ // is not supported in many others
+ if (exitCode < 0 || exitCode > 125)
+ return false;
+
+ sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitCode);
+ }
+ else
+ sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE);
+ return true;
+ }
+
+ // Exit the realm
+ static bool HandleServerExitCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->SendSysMessage(LANG_COMMAND_EXIT);
+ World::StopNow(SHUTDOWN_EXIT_CODE);
+ return true;
+ }
+
+ // Define the 'Message of the day' for the realm
+ static bool HandleServerSetMotdCommand(ChatHandler* handler, char const* args)
+ {
+ sWorld->SetMotd(args);
+ handler->PSendSysMessage(LANG_MOTD_NEW, args);
+ return true;
+ }
+
+ // Set whether we accept new clients
+ static bool HandleServerSetClosedCommand(ChatHandler* handler, char const* args)
+ {
+ if (strncmp(args, "on", 3) == 0)
+ {
+ handler->SendSysMessage(LANG_WORLD_CLOSED);
+ sWorld->SetClosed(true);
+ return true;
+ }
+ else if (strncmp(args, "off", 4) == 0)
+ {
+ handler->SendSysMessage(LANG_WORLD_OPENED);
+ sWorld->SetClosed(false);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Set the level of logging
+ static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* type = strtok((char*)args, " ");
+ char* name = strtok(NULL, " ");
+ char* level = strtok(NULL, " ");
+
+ if (!type || !name || !level || *name == '\0' || *level == '\0' || (*type != 'a' && *type != 'l'))
+ return false;
+
+ sLog->SetLogLevel(name, level, *type == 'l');
+ return true;
+ }
+
+ // set diff time record interval
+ static bool HandleServerSetDiffTimeCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* newTimeStr = strtok((char*)args, " ");
+ if (!newTimeStr)
+ return false;
+
+ int32 newTime = atoi(newTimeStr);
+ if (newTime < 0)
+ return false;
+
+ sWorld->SetRecordDiffInterval(newTime);
+ printf("Record diff every %u ms\n", newTime);
+
+ return true;
+ }
+};
+
+void AddSC_server_commandscript()
+{
+ new server_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index ca7c3af7fde..8f390d17cd4 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -97,15 +97,16 @@ public:
if (!*args)
return false;
- std::string name = args;
-
- if (!sObjectMgr->DeleteGameTele(name))
+ // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
+ GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
+ if (!tele)
{
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
handler->SetSentErrorMessage(true);
return false;
}
-
+ std::string name = tele->name;
+ sObjectMgr->DeleteGameTele(name);
handler->SendSysMessage(LANG_COMMAND_TP_DELETED);
return true;
}
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
new file mode 100644
index 00000000000..baaa5d2bd43
--- /dev/null
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -0,0 +1,509 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/* ScriptData
+Name: ticket_commandscript
+%Complete: 100
+Comment: All ticket related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "AccountMgr.h"
+#include "ObjectMgr.h"
+#include "TicketMgr.h"
+
+class ticket_commandscript : public CommandScript
+{
+public:
+ ticket_commandscript() : CommandScript("ticket_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand ticketResponseCommandTable[] =
+ {
+ { "append", SEC_MODERATOR, true, &HandleGMTicketResponseAppendCommand, "", NULL },
+ { "appendln", SEC_MODERATOR, true, &HandleGMTicketResponseAppendLnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand ticketCommandTable[] =
+ {
+ { "assign", SEC_GAMEMASTER, true, &HandleGMTicketAssignToCommand, "", NULL },
+ { "close", SEC_MODERATOR, true, &HandleGMTicketCloseByIdCommand, "", NULL },
+ { "closedlist", SEC_MODERATOR, true, &HandleGMTicketListClosedCommand, "", NULL },
+ { "comment", SEC_MODERATOR, true, &HandleGMTicketCommentCommand, "", NULL },
+ { "complete", SEC_MODERATOR, true, &HandleGMTicketCompleteCommand, "", NULL },
+ { "delete", SEC_ADMINISTRATOR, true, &HandleGMTicketDeleteByIdCommand, "", NULL },
+ { "escalate", SEC_MODERATOR, true, &HandleGMTicketEscalateCommand, "", NULL },
+ { "escalatedlist", SEC_GAMEMASTER, true, &HandleGMTicketListEscalatedCommand, "", NULL },
+ { "list", SEC_MODERATOR, true, &HandleGMTicketListCommand, "", NULL },
+ { "onlinelist", SEC_MODERATOR, true, &HandleGMTicketListOnlineCommand, "", NULL },
+ { "reset", SEC_ADMINISTRATOR, true, &HandleGMTicketResetCommand, "", NULL },
+ { "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable },
+ { "togglesystem", SEC_ADMINISTRATOR, true, &HandleToggleGMTicketSystem, "", NULL },
+ { "unassign", SEC_GAMEMASTER, true, &HandleGMTicketUnAssignCommand, "", NULL },
+ { "viewid", SEC_MODERATOR, true, &HandleGMTicketGetByIdCommand, "", NULL },
+ { "viewname", SEC_MODERATOR, true, &HandleGMTicketGetByNameCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleGMTicketAssignToCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
+ char* targetStr = strtok(NULL, " ");
+ if (!targetStr)
+ return false;
+
+ std::string target(targetStr);
+ if (!normalizePlayerName(target))
+ return false;
+
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Get target information
+ uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
+ uint64 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+ uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID);
+
+ // Target must exist and have administrative rights
+ if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
+ return true;
+ }
+
+ // If already assigned, leave
+ if (ticket->IsAssignedTo(targetGuid))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
+ return true;
+ }
+
+ // If assigned to different player other than current, leave
+ //! Console can override though
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
+ return true;
+ }
+
+ // Assign ticket
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
+ ticket->SaveToDB(trans);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+ return true;
+ }
+
+ static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Ticket should be assigned to the player who tries to close it.
+ // Console can override though
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
+ return true;
+ }
+
+ sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName() : "Console", NULL, NULL, NULL);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ // Inform player, who submitted this ticket, that it is closed
+ if (Player* submitter = ticket->GetPlayer())
+ {
+ if (submitter->IsInWorld())
+ {
+ WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
+ data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
+ submitter->GetSession()->SendPacket(&data);
+ }
+ }
+ return true;
+ }
+
+ static bool HandleGMTicketCommentCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
+ char* comment = strtok(NULL, "\n");
+ if (!comment)
+ return false;
+
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Cannot comment ticket assigned to someone else
+ //! Console excluded
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetComment(comment);
+ ticket->SaveToDB(trans);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL);
+ msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ return true;
+ }
+
+ static bool HandleGMTicketListClosedCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowClosedList(*handler);
+ return true;
+ }
+
+ static bool HandleGMTicketCompleteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ if (Player* player = ticket->GetPlayer())
+ if (player->IsInWorld())
+ ticket->SendResponse(player->GetSession());
+
+ sTicketMgr->UpdateLastChange();
+ return true;
+ }
+
+ static bool HandleGMTicketDeleteByIdCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ if (!ticket->IsClosed())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
+ return true;
+ }
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console");
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ sTicketMgr->RemoveTicket(ticket->GetId());
+ sTicketMgr->UpdateLastChange();
+
+ if (Player* player = ticket->GetPlayer())
+ {
+ if (player->IsInWorld())
+ {
+ // Force abandon ticket
+ WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
+ data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
+ player->GetSession()->SendPacket(&data);
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleGMTicketEscalateCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE);
+
+ if (Player* player = ticket->GetPlayer())
+ if (player->IsInWorld())
+ sTicketMgr->SendTicket(player->GetSession(), ticket);
+
+ sTicketMgr->UpdateLastChange();
+ return true;
+ }
+
+ static bool HandleGMTicketListEscalatedCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowEscalatedList(*handler);
+ return true;
+ }
+
+ static bool HandleGMTicketListCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowList(*handler, false);
+ return true;
+ }
+
+ static bool HandleGMTicketListOnlineCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowList(*handler, true);
+ return true;
+ }
+
+ static bool HandleGMTicketResetCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ if (sTicketMgr->GetOpenTicketCount())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETPENDING);
+ return true;
+ }
+ else
+ {
+ sTicketMgr->ResetTickets();
+ handler->SendSysMessage(LANG_COMMAND_TICKETRESET);
+ }
+
+ return true;
+ }
+
+ static bool HandleToggleGMTicketSystem(ChatHandler* handler, char const* /*args*/)
+ {
+ bool status = !sTicketMgr->GetStatus();
+ sTicketMgr->SetStatus(status);
+ handler->PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS);
+ return true;
+ }
+
+ static bool HandleGMTicketUnAssignCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+ // Ticket must be assigned
+ if (!ticket->IsAssigned())
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ // Get security level of player, whom this ticket is assigned to
+ uint32 security = SEC_PLAYER;
+ Player* assignedPlayer = ticket->GetAssignedPlayer();
+ if (assignedPlayer && assignedPlayer->IsInWorld())
+ security = assignedPlayer->GetSession()->GetSecurity();
+ else
+ {
+ uint64 guid = ticket->GetAssignedToGUID();
+ uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
+ security = AccountMgr::GetSecurity(accountId, realmID);
+ }
+
+ // Check security
+ //! If no m_session present it means we're issuing this command from the console
+ uint32 mySecurity = handler->GetSession() ? handler->GetSession()->GetSecurity() : SEC_CONSOLE;
+ if (security > mySecurity)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetUnassigned();
+ ticket->SaveToDB(trans);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(),
+ handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console", NULL);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ return true;
+ }
+
+ static bool HandleGMTicketGetByIdCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetViewed();
+ ticket->SaveToDB(trans);
+
+ handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str());
+ return true;
+ }
+
+ static bool HandleGMTicketGetByNameCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name(args);
+ if (!normalizePlayerName(name))
+ return false;
+
+ // Detect target's GUID
+ uint64 guid = 0;
+ if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
+ guid = player->GetGUID();
+ else
+ guid = sObjectMgr->GetPlayerGUIDByName(name);
+
+ // Target must exist
+ if (!guid)
+ {
+ handler->SendSysMessage(LANG_NO_PLAYERS_FOUND);
+ return true;
+ }
+
+ // Ticket must exist
+ GmTicket* ticket = sTicketMgr->GetTicketByPlayer(guid);
+ if (!ticket)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetViewed();
+ ticket->SaveToDB(trans);
+
+ handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str());
+ return true;
+ }
+
+ static bool _HandleGMTicketResponseAppendCommand(char const* args, bool newLine, ChatHandler* handler)
+ {
+ if (!*args)
+ return false;
+
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
+ char* response = strtok(NULL, "\n");
+ if (!response)
+ return false;
+
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Cannot add response to ticket, assigned to someone else
+ //! Console excluded
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->AppendResponse(response);
+ if (newLine)
+ ticket->AppendResponse("\n");
+ ticket->SaveToDB(trans);
+
+ return true;
+ }
+
+ static bool HandleGMTicketResponseAppendCommand(ChatHandler* handler, char const* args)
+ {
+ return _HandleGMTicketResponseAppendCommand(args, false, handler);
+ }
+
+ static bool HandleGMTicketResponseAppendLnCommand(ChatHandler* handler, char const* args)
+ {
+ return _HandleGMTicketResponseAppendCommand(args, true, handler);
+ }
+};
+
+void AddSC_ticket_commandscript()
+{
+ new ticket_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index f29dd8a5069..99ec263b8f9 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -949,7 +949,7 @@ public:
if (target)
{
wpCreature->SetDisplayId(target->GetDisplayId());
- wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
+ wpCreature->SetObjectScale(0.5f);
wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point);
}
}
@@ -1003,7 +1003,7 @@ public:
if (target)
{
creature->SetDisplayId(target->GetDisplayId());
- creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
+ creature->SetObjectScale(0.5f);
}
return true;
@@ -1052,7 +1052,7 @@ public:
if (target)
{
creature->SetDisplayId(target->GetDisplayId());
- creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
+ creature->SetObjectScale(0.5f);
}
return true;
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
index 75dd99eef97..b2b4083f9c6 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 93de16fc80b..e776194652d 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
index 8b2a95be977..47091c162d9 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
index da53cffc99d..0c1eb6e6d30 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
index 3960351d395..fdb6a5da320 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Yells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
index 9375cc33f27..7286466d335 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "blackrock_depths.h"
//go_shadowforge_brazier
@@ -207,7 +209,7 @@ public:
{
instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me);
instance->SetData(TYPE_RING_OF_LAW, DONE);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_grimstone: event reached end and set complete.");
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_grimstone: event reached end and set complete.");
}
break;
}
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
index ff0f1a4cedd..b2031ef0658 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
index 2585796e28e..a07e9059b70 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
index 073c4fde82a..204fa3177e7 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blackrock_depths.h"
enum Yells
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
index 703f684cc9f..15882b30ed2 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
index b2c93d949c2..055f1eebbac 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
index 63d945ade90..40f8b2507e3 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
index f4f245be4be..b6be72d71e0 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
index 3d2cc627145..c1e00796433 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
index e6f65ab4252..6f665e9efc7 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
index 211930e4f1a..347aff2ce0b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "blackrock_depths.h"
enum Spells
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp
index 03cb077936b..0d02e4495a5 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp
@@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "blackrock_depths.h"
#define TIMER_TOMBOFTHESEVEN 15000
@@ -210,7 +212,7 @@ public:
void SetData64(uint32 type, uint64 data)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
switch (type)
{
@@ -226,7 +228,7 @@ public:
void SetData(uint32 type, uint32 data)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
switch (type)
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h
index e51c6b9130d..0af2af948d3 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h
@@ -33,7 +33,8 @@ enum Data
DATA_WARCHIEF_REND_BLACKHAND,
DATA_GYTH,
DATA_THE_BEAST,
- DATA_GENERAL_DRAKKISATH
+ DATA_GENERAL_DRAKKISATH,
+ DATA_DRAGONSPIRE_ROOM,
};
enum Npc
{
@@ -51,17 +52,51 @@ enum Npc
NPC_GYTH = 10339,
NPC_THE_BEAST = 10430,
NPC_GENERAL_DRAKKISATH = 10363,
+ NPC_BLACKHAND_DREADWEAVER = 9817,
+ NPC_BLACKHAND_SUMMONER = 9818,
+ NPC_BLACKHAND_VETERAN = 9819,
};
enum AdditionalData
{
SPELL_SUMMON_ROOKERY_WHELP = 15745,
MAX_ENCOUNTER = 14,
+ MAX_DRAGONSPIRE_HALL_RUNES = 7,
+ EVENT_PYROGUARD_EMBERSEER = 4884,
+ AREATRIGGER_ENTER_UBRS = 2046,
+ AREATRIGGER_STADIUM = 2026,
};
enum GameObjects
{
- GO_WHELP_SPAWNER = 175622, //trap spawned by go id 175124
+ GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124
+
+ // Doors
+ GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer
+ GO_DOORS = 175705, // Second door to Pyroguard Emberseer
+ GO_EMBERSEER_OUT = 175153, // Door after Pyroguard Emberseer event
+ GO_GYTH_ENTRY_DOOR = 164726,
+ GO_GYTH_COMBAT_DOOR = 175185,
+ GO_GYTH_EXIT_DOOR = 175186,
+ GO_DRAKKISATH_DOOR_1 = 175946,
+ GO_DRAKKISATH_DOOR_2 = 175947,
+
+ // Runes
+ GO_ROOM_1_RUNE = 175197,
+ GO_ROOM_2_RUNE = 175199,
+ GO_ROOM_3_RUNE = 175195,
+ GO_ROOM_4_RUNE = 175200,
+ GO_ROOM_5_RUNE = 175198,
+ GO_ROOM_6_RUNE = 175196,
+ GO_ROOM_7_RUNE = 175194,
+
+ GO_EMBERSEER_RUNE_1 = 175266,
+ GO_EMBERSEER_RUNE_2 = 175267,
+ GO_EMBERSEER_RUNE_3 = 175268,
+ GO_EMBERSEER_RUNE_4 = 175269,
+ GO_EMBERSEER_RUNE_5 = 175270,
+ GO_EMBERSEER_RUNE_6 = 175271,
+ GO_EMBERSEER_RUNE_7 = 175272,
};
#endif
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp
index 411b800cd03..015c13d1098 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp
@@ -20,11 +20,24 @@
#include "ScriptedCreature.h"
#include "blackrock_spire.h"
+enum Text
+{
+ EMOTE_ONE_STACK = 0,
+ EMOTE_TEN_STACK = 1,
+ EMOTE_FREE_OF_BONDS = 2,
+ YELL_FREE_OF_BONDS = 3,
+};
+
enum Spells
{
- SPELL_FIRENOVA = 23462,
- SPELL_FLAMEBUFFET = 23341,
- SPELL_PYROBLAST = 17274,
+ SPELL_ENCAGED_EMBERSEER = 15282, // Self on spawn
+ SPELL_FIRE_SHIELD_TRIGGER = 13377, // Self on spawn missing from 335 dbc
+ SPELL_FREEZE_ANIM = 16245, // Self on event start
+ SPELL_EMBERSEER_GROWING = 16048, // Self on event start
+ SPELL_EMBERSEER_FULL_STRENGTH = 16047, // Emberseer Full Strength
+ SPELL_FIRENOVA = 23462, // Combat
+ SPELL_FLAMEBUFFET = 23341, // Combat
+ SPELL_PYROBLAST = 17274, // Combat
};
enum Events
@@ -51,6 +64,12 @@ public:
void Reset()
{
+ if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS)
+ OpenDoors(false);
+ instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED);
+ // respawn any dead Blackhand Incarcerators
+ DoCast(me, SPELL_ENCAGED_EMBERSEER);
+ //DoCast(me, SPELL_FIRE_SHIELD_TRIGGER);
_Reset();
}
@@ -64,12 +83,26 @@ public:
void JustDied(Unit* /*killer*/)
{
+ instance->SetBossState(DATA_PYROGAURD_EMBERSEER,DONE);
+ OpenDoors(true);
_JustDied();
}
+ void OpenDoors(bool Boss_Killed)
+ {
+ if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_IN)))
+ door1->SetGoState(GO_STATE_ACTIVE);
+ if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_DOORS)))
+ door2->SetGoState(GO_STATE_ACTIVE);
+ if (Boss_Killed)
+ if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetData64(GO_EMBERSEER_OUT)))
+ door3->SetGoState(GO_STATE_ACTIVE);
+ }
+
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
+
return;
events.Update(diff);
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp
index ff97984fa09..fdb73fe1196 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp
@@ -49,6 +49,12 @@ public:
uint64 Gyth;
uint64 TheBeast;
uint64 GeneralDrakkisath;
+ uint64 go_emberseerin;
+ uint64 go_doors;
+ uint64 go_emberseerout;
+ uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES];
+ uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES];
+ uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES];
void Initialize()
{
@@ -67,6 +73,9 @@ public:
Gyth = 0;
TheBeast = 0;
GeneralDrakkisath = 0;
+ go_emberseerin = 0;
+ go_doors = 0;
+ go_emberseerout = 0;
}
bool IsEncounterInProgress() const
@@ -125,7 +134,11 @@ public:
case NPC_GENERAL_DRAKKISATH:
GeneralDrakkisath = creature->GetGUID();
break;
- }
+ case NPC_BLACKHAND_DREADWEAVER:
+ case NPC_BLACKHAND_SUMMONER:
+ case NPC_BLACKHAND_VETERAN:
+ break;
+ }
}
void OnGameObjectCreate(GameObject* go)
@@ -135,6 +148,36 @@ public:
case GO_WHELP_SPAWNER:
go->CastSpell(NULL, SPELL_SUMMON_ROOKERY_WHELP);
break;
+ case GO_EMBERSEER_IN:
+ go_emberseerin = go->GetGUID();
+ break;
+ case GO_DOORS:
+ go_doors = go->GetGUID();
+ break;
+ case GO_EMBERSEER_OUT:
+ go_emberseerout = go->GetGUID();
+ break;
+ case GO_ROOM_1_RUNE:
+ go_roomrunes[0] = go->GetGUID();
+ break;
+ case GO_ROOM_2_RUNE:
+ go_roomrunes[1] = go->GetGUID();
+ break;
+ case GO_ROOM_3_RUNE:
+ go_roomrunes[2] = go->GetGUID();
+ break;
+ case GO_ROOM_4_RUNE:
+ go_roomrunes[3] = go->GetGUID();
+ break;
+ case GO_ROOM_5_RUNE:
+ go_roomrunes[4] = go->GetGUID();
+ break;
+ case GO_ROOM_6_RUNE:
+ go_roomrunes[5] = go->GetGUID();
+ break;
+ case GO_ROOM_7_RUNE:
+ go_roomrunes[6] = go->GetGUID();
+ break;
}
}
@@ -167,6 +210,18 @@ public:
return true;
}
+ void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId)
+ {
+ switch (eventId)
+ {
+ case EVENT_PYROGUARD_EMBERSEER:
+ SetBossState(DATA_PYROGAURD_EMBERSEER,IN_PROGRESS);
+ break;
+ default:
+ break;
+ }
+ }
+
uint64 GetData64(uint32 type)
{
switch (type)
@@ -199,6 +254,26 @@ public:
return TheBeast;
case DATA_GENERAL_DRAKKISATH:
return GeneralDrakkisath;
+ case GO_EMBERSEER_IN:
+ return go_emberseerin;
+ case GO_DOORS:
+ return go_doors;
+ case GO_EMBERSEER_OUT:
+ return go_emberseerout;
+ case GO_ROOM_1_RUNE:
+ return go_roomrunes[0];
+ case GO_ROOM_2_RUNE:
+ return go_roomrunes[1];
+ case GO_ROOM_3_RUNE:
+ return go_roomrunes[2];
+ case GO_ROOM_4_RUNE:
+ return go_roomrunes[3];
+ case GO_ROOM_5_RUNE:
+ return go_roomrunes[4];
+ case GO_ROOM_6_RUNE:
+ return go_roomrunes[5];
+ case GO_ROOM_7_RUNE:
+ return go_roomrunes[6];
}
return 0;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
index af0dfd38ae8..ceca6330152 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+
enum Say
{
SAY_AGGRO = -1469000,
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
index a3eb0cea5ad..204fbe5223b 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
@@ -23,7 +23,8 @@ SDComment: Chromatic Mutation disabled due to lack of core support
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Emotes
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
index c91e0fb3303..962e65fb8b0 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
@@ -23,7 +23,8 @@ SDComment: Shadow of Ebonroc needs core support
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWFLAME 22539
#define SPELL_WINGBUFFET 18500
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
index c2a2350c0e8..4d5f9b214db 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWFLAME 22539
#define SPELL_WINGBUFFET 23339
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
index 41bcb6c5427..e84ccd0e160 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Emotes
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
index 5d4cc442a49..787fbe5312b 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
@@ -23,7 +23,8 @@ SDComment: Some issues with class calls effecting more than one class
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Say
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
index 24fc74cc7cb..04eca3586cc 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
@@ -23,7 +23,8 @@ SDComment: Needs additional review. Phase 1 NYI (Grethok the Controller)
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//Razorgore Phase 2 Script
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
index eaa8c118f19..8cc42baff8e 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
@@ -23,7 +23,9 @@ SDComment: Burning Adrenaline not correctly implemented in core
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Says
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
index 668b84d38dd..30638e9edeb 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
@@ -23,7 +23,9 @@ SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong plac
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
enum Says
{
@@ -362,7 +364,7 @@ public:
Nefarian->setFaction(103);
NefarianGUID = Nefarian->GetGUID();
}
- else sLog->outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly.");
+ else sLog->outError(LOG_FILTER_TSCR, "Blackwing Lair: Unable to spawn nefarian properly.");
}
AddSpawnTimer = 4000;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp
index 8a9b930aa09..ae518b7c703 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp
@@ -23,4 +23,5 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
index 4885d8620b0..f107fd7c5ec 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -21,7 +21,8 @@ SD%Complete:
SDComment: Timers and say taken from acid script
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "deadmines.h"
enum eSpels
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
index 6c6b0647c5f..888171c5415 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
@@ -23,7 +23,8 @@ SDComment: Placeholder
SDCategory: Deadmines
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "deadmines.h"
#include "Spell.h"
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
index a75eda93d1d..8e0fb9ff411 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Deadmines
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "deadmines.h"
enum Sounds
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index b5a7984d945..f1aa3d68bce 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -22,7 +22,9 @@ SD%Complete: 90%
SDComment: Some visual effects are not implemented.
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "gnomeregan.h"
#include "ScriptedEscortAI.h"
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
index 0bbe787827b..931c0bb90fc 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "gnomeregan.h"
#define MAX_ENCOUNTER 1
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
index 96bda019f6a..bf27cad44ef 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_AGGRO -1532057
#define SAY_SUMMON1 -1532058
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
index e19efc7c4e5..8921867be21 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_AGGRO -1532018
#define SAY_SLAY1 -1532019
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index bbf87ac3e73..08aad90f588 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_MIDNIGHT_KILL -1532000
#define SAY_APPEAR1 -1532001
@@ -79,6 +80,12 @@ public:
void Reset()
{
+ ResetTimer = 0;
+ }
+
+ void EnterEvadeMode()
+ {
+ ScriptedAI::EnterEvadeMode();
ResetTimer = 2000;
}
@@ -185,7 +192,7 @@ public:
pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim());
pAttumen->SetTarget(pAttumen->getVictim()->GetGUID());
}
- pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
+ pAttumen->SetObjectScale(1);
}
} else Mount_Timer -= diff;
}
@@ -244,8 +251,8 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
Midnight = 0;
me->SetVisible(false);
me->Kill(me);
- }
- } else ResetTimer -= diff;
+ } else ResetTimer -= diff;
+ }
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index f69cecdb4c3..06c1243645c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
#define SAY_AGGRO -1532011
@@ -74,8 +75,8 @@ public:
{
boss_moroesAI(Creature* creature) : ScriptedAI(creature)
{
- for (uint8 i = 0; i < 4; ++i)
- AddId[i] = 0;
+ memset(AddId, 0, sizeof(AddId));
+ memset(AddGUID, 0, sizeof(AddGUID));
instance = creature->GetInstanceScript();
}
@@ -104,10 +105,8 @@ public:
Enrage = false;
InVanish = false;
- if (me->GetHealth() > 0)
- {
+ if (me->GetHealth())
SpawnAdds();
- }
if (instance)
instance->SetData(TYPE_MOROES, NOT_STARTED);
@@ -192,10 +191,9 @@ public:
bool isAddlistEmpty()
{
for (uint8 i = 0; i < 4; ++i)
- {
if (AddId[i] == 0)
return true;
- }
+
return false;
}
@@ -340,17 +338,10 @@ struct boss_moroes_guestAI : public ScriptedAI
if (!instance)
return;
- uint64 MoroesGUID = instance->GetData64(DATA_MOROES);
- Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID));
- if (Moroes)
- {
+ if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES)))
for (uint8 i = 0; i < 4; ++i)
- {
- uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i];
- if (GUID)
+ if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
GuestGUID[i] = GUID;
- }
- }
}
Unit* SelectGuestTarget()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index f89abca76cf..60e1a5ebc4c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -23,7 +23,8 @@ SDComment: Not sure about timing and portals placing
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
#define EMOTE_PHASE_PORTAL -1532089
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index ded5e6903a5..e2420749a4c 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -23,7 +23,8 @@ SDComment: SDComment: Timers may incorrect
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
//phase 1
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 4700ad71fab..d5add0f0bb7 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
#define SAY_AGGRO -1532091
@@ -186,6 +187,7 @@ public:
boss_malchezaarAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ memset(axes, 0, sizeof(axes));
}
InstanceScript* instance;
@@ -217,7 +219,10 @@ public:
positions.clear();
for (uint8 i = 0; i < 5; ++i)
+ {
enfeeble_targets[i] = 0;
+ enfeeble_health[i] = 0;
+ }
for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
positions.push_back(&InfernalPoints[i]);
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 d95b4aa3ae1..7dd4e731a18 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -23,7 +23,8 @@ SDComment: Flame wreath missing cast animation, mods won't triggere.
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
#include "GameObject.h"
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index 2f19d2c7fc1..44cd7e0faea 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -23,8 +23,10 @@ SDComment: Complete! Needs adjustments to use spell though.
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "PassiveAI.h"
#define SAY_SLAY1 -1532065
#define SAY_SLAY2 -1532066
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 6f8121ef5b6..30d33dc65cf 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -23,7 +23,9 @@ SDComment: Oz, Hood, and RAJ event implemented. RAJ event requires more testing.
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "karazhan.h"
/***********************************/
@@ -1221,7 +1223,7 @@ public:
}
}
- sLog->outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen.");
+ sLog->outError(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen.");
}
void EnterCombat(Unit* /*who*/)
@@ -1467,7 +1469,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
if (Phase == PHASE_ROMULO)
{
- sLog->outError("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?");
+ sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?");
damage = 0;
return;
}
@@ -1501,7 +1503,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
return;
}
}
- sLog->outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen.");
+ sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: DamageTaken reach end of code, that should not happen.");
}
void AddSC_bosses_opera()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
index 8e86024f4d8..05d6ecf1478 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
@@ -23,7 +23,8 @@ SDComment: Instance Script for Karazhan to help in various encounters. TODO: Gam
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "karazhan.h"
#define MAX_ENCOUNTER 12
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index b37f6913b8d..b84fc15d664 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -29,7 +29,9 @@ npc_berthold
npc_image_of_medivh
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "karazhan.h"
#include "ScriptedEscortAI.h"
@@ -227,7 +229,7 @@ public:
void PrepareEncounter()
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
+ sLog->outDebug(LOG_FILTER_TSCR, "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
uint8 index = 0;
uint8 count = 0;
@@ -342,17 +344,17 @@ public:
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_OZ;
- sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
+ sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_HOOD;
- sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
+ sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_RAJ;
- sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
+ sLog->outInfo(LOG_FILTER_TSCR, "TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
break;
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
index 08b9a729596..e1817034189 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
@@ -62,6 +62,6 @@ enum OperaEvents
EVENT_RAJ = 3
};
-#define ERROR_INST_DATA(a) sLog->outError("TSCR: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
+#define ERROR_INST_DATA(a) sLog->outError(LOG_FILTER_TSCR, "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
#endif
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 4a75370f0e8..bd79cbba628 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -23,7 +23,8 @@ SDComment: Normal and Heroic Support. Issues: Arcane Spheres do not initially fo
SDCategory: Magisters' Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
#include "WorldPacket.h"
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 883932fdb9b..7ce9b08845f 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -23,7 +23,8 @@ SDComment: No Heroic support yet. Needs further testing. Several scripts for pet
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
struct Speech
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index af7deda4545..82ad3ee2630 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -23,7 +23,8 @@ SDComment: Heroic and Normal Support. Needs further testing.
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
#define SAY_AGGRO -1585000
@@ -75,7 +76,7 @@ public:
for (uint8 i = 0; i < size; ++i)
{
uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Selin: Adding Fel Crystal " UI64FMTD " to list", guid);
+ sLog->outDebug(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid);
Crystals.push_back(guid);
}
}
@@ -120,7 +121,7 @@ public:
// Small door opened after event are expected to be closed by default
// Set Inst data for encounter
instance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
DrainLifeTimer = urand(3000, 7000);
DrainManaTimer = DrainLifeTimer + 5000;
@@ -222,7 +223,7 @@ public:
else
{
// Make an error message in case something weird happened here
- sLog->outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned");
+ sLog->outError(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned");
DrainingCrystal = false;
}
}
@@ -361,7 +362,7 @@ public:
}
}
}
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
}
};
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
index 327c611b2d6..b5cf443c5a5 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
@@ -23,7 +23,8 @@ SDComment: Heroic and Normal support. Needs further testing.
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
enum eEnums
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
index aa43cb3702f..cd2874f7253 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
@@ -23,7 +23,8 @@ SDComment: Designed only for Selin Fireheart
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "magisters_terrace.h"
#define MAX_ENCOUNTER 4
@@ -218,32 +219,32 @@ public:
{
switch (identifier)
{
- case DATA_SELIN:
+ case DATA_SELIN:
return SelinGUID;
- case DATA_DELRISSA:
+ case DATA_DELRISSA:
return DelrissaGUID;
- case DATA_VEXALLUS_DOOR:
+ case DATA_VEXALLUS_DOOR:
return VexallusDoorGUID;
- case DATA_SELIN_DOOR:
+ case DATA_SELIN_DOOR:
return SelinDoorGUID;
- case DATA_SELIN_ENCOUNTER_DOOR:
+ case DATA_SELIN_ENCOUNTER_DOOR:
return SelinEncounterDoorGUID;
- case DATA_DELRISSA_DOOR:
+ case DATA_DELRISSA_DOOR:
return DelrissaDoorGUID;
- case DATA_KAEL_DOOR:
+ case DATA_KAEL_DOOR:
return KaelDoorGUID;
- case DATA_KAEL_STATUE_LEFT:
+ case DATA_KAEL_STATUE_LEFT:
return KaelStatue[0];
- case DATA_KAEL_STATUE_RIGHT:
+ case DATA_KAEL_STATUE_RIGHT:
return KaelStatue[1];
- case DATA_ESCAPE_ORB:
+ case DATA_ESCAPE_ORB:
return EscapeOrbGUID;
case DATA_FEL_CRYSTAL:
{
if (FelCrystals.empty())
{
- sLog->outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data");
+ sLog->outError(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data");
return 0;
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
index ccaaa0ec68d..69e0e5bff40 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_kalecgos
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_kalecgos
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
index 0160f35f143..9d48d04cf07 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
@@ -23,7 +23,8 @@ SDComment: some spells doesnt work correctly
SDCategory: Molten Core
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "molten_core.h"
enum Texts
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 37808e2b924..c17a059d007 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -15,10 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "Vehicle.h"
#include "ObjectMgr.h"
#include "ScriptedEscortAI.h"
+#include "CombatAI.h"
+#include "PassiveAI.h"
/*######
##Quest 12848
@@ -185,7 +189,7 @@ public:
anchorGUID = anchor->GetGUID();
}
else
- sLog->outError("npc_unworthy_initiateAI: unable to find anchor!");
+ sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!");
float dist = 99.0f;
GameObject* prison = NULL;
@@ -205,7 +209,7 @@ public:
if (prison)
prison->ResetDoorOrButton();
else
- sLog->outError("npc_unworthy_initiateAI: unable to find prison!");
+ sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!");
}
break;
case PHASE_TO_EQUIP:
@@ -664,7 +668,7 @@ public:
{
CAST_PLR(charmer)->GroupEventHappens(12687, me);
charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE);
- CAST_CRE(who)->ForcedDespawn();
+ CAST_CRE(who)->DespawnOrUnsummon();
//CAST_CRE(who)->Respawn(true);
}
@@ -767,7 +771,7 @@ public:
//Todo: Creatures must not be removed, but, must instead
// stand next to Gothik and be commanded into the pit
// and dig into the ground.
- CAST_CRE(who)->ForcedDespawn();
+ CAST_CRE(who)->DespawnOrUnsummon();
if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
owner->RemoveAllMinionsByEntry(GHOULS);
@@ -1074,9 +1078,9 @@ public:
{
car->AI()->SetGUID(miner->GetGUID());
CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player);
- } else sLog->outError("TSCR: OnGossipHello vehicle entry is not correct.");
- } else sLog->outError("TSCR: OnGossipHello player is not on the vehicle.");
- } else sLog->outError("TSCR: OnGossipHello Scarlet Miner cant be found by script.");
+ } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct.");
+ } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle.");
+ } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script.");
}
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 1c17e6afa9b..b4c6268a43e 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
//How to win friends and influence enemies
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 8cee23fab1c..4d1552b932e 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
index 0ef2dddda8d..81211f36df3 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
/*####
## npc_valkyr_battle_maiden
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
index e5886cc39d4..c39a647d5e1 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
index 30105cc7315..a2cc0172969 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
index 466f940621d..ff1a0867de0 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 813c43288d0..028cf640d21 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "SpellMgr.h"
#include "scarlet_monastery.h"
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
index 58c21d86a2f..59244585ecf 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -23,7 +23,8 @@ SDComment: Should in addition spawn Myrmidons in the hallway outside
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
enum Says
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
index 1989c318c84..847a14f54d8 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: if this guy not involved in some special event, remove (and let
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSpells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
index f311da401d4..9a66c9ba728 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index fd978136339..07b5ec5d584 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
enum Says
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 8d813bfe502..46fb62eae7f 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
enum Says
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
index 8035adfc33f..6eb27327438 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
index ba0b854754e..3d3d9ae52ae 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
enum Entry
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 2bc0320b81d..c2ccde645ca 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -23,7 +23,8 @@ SDComment: Doors missing in instance script.
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_ARCANEMISSILES 22272
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
index 967f771fe7a..b4c4332aa45 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
class boss_death_knight_darkreaver : public CreatureScript
{
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
index 82f4dc85060..197ee9a5bfe 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
enum eEnums
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
index e438ae56a2b..b6b5cc0acbd 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_CURSEOFAGONY 18671
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
index 498e6596b06..406b1a6b10d 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_CALLOFGRAVES 17831
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
index 064faa5643d..3eb78662578 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_CURSEOFBLOOD 24673
//#define SPELL_ILLUSION 17773
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
index 5fd5a96d605..10736464ef3 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWBOLTVOLLEY 20741
#define SPELL_BONESHIELD 27688
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
index 327c1df921d..438c3c88bb4 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
@@ -23,7 +23,8 @@ SDComment: aura applied/defined in database
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_IMMOLATE 20294 // Old ID was 15570
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
index 1919a1ba099..64bbbbe9514 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_VOLATILEINFECTION 24928
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
index fd10c6374a6..808dc97dc86 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_FROSTBOLT 21369
#define SPELL_ICEARMOR 18100 //This is actually a buff he gives himself
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
index a28cecf3772..381a039d609 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_TRAMPLE 15550
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
index f5f453c30bd..3c7771612e2 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
index 86023d21eca..c3b3724ec3d 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "scholomance.h"
#define GO_GATE_KIRTONOS 175570
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index 57b902ac6d4..d4c037d45c3 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Shadowfang Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "shadowfang_keep.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index 63e753a18ba..676cd7be4f0 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -27,7 +27,11 @@ EndScriptData */
npc_shadowfang_prisoner
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "ScriptedEscortAI.h"
#include "shadowfang_keep.h"
@@ -193,8 +197,48 @@ public:
};
+class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader
+{
+ public:
+ spell_shadowfang_keep_haunting_spirits() : SpellScriptLoader("spell_shadowfang_keep_haunting_spirits") { }
+
+ class spell_shadowfang_keep_haunting_spirits_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_shadowfang_keep_haunting_spirits_AuraScript);
+
+ void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
+ {
+ isPeriodic = true;
+ amplitude = (irand(0, 60) + 30) * IN_MILLISECONDS;
+ }
+
+ void HandleDummyTick(AuraEffect const* aurEff)
+ {
+ GetTarget()->CastSpell((Unit*)NULL, aurEff->GetAmount(), true);
+ }
+
+ void HandleUpdatePeriodic(AuraEffect* aurEff)
+ {
+ aurEff->CalculatePeriodic(GetCaster());
+ }
+
+ void Register()
+ {
+ DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_shadowfang_keep_haunting_spirits_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_shadowfang_keep_haunting_spirits_AuraScript();
+ }
+};
+
void AddSC_shadowfang_keep()
{
new npc_shadowfang_prisoner();
new npc_arugal_voidwalker();
+ new spell_shadowfang_keep_haunting_spirits();
}
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
index 85faa14900b..cd3fbd09223 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
@@ -23,7 +23,8 @@ SDComment: aura applied/defined in database
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SAY_0 "Intruders! More pawns of the Argent Dawn, no doubt. I already count one of their number among my prisoners. Withdraw from my domain before she is executed!"
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
index 106719d654f..7dafcc2b647 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
@@ -23,7 +23,8 @@ SDComment: MC disabled
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_BANSHEEWAIL 16565
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
index 01299ae06b6..4c2aa395e3c 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//front, left
#define ADD_1X 3553.851807f
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
index 21e3e19d890..04380da3051 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
@@ -23,7 +23,8 @@ SDComment: Possibly need to fix/improve summons after death
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
index 37e0bd5757f..5e67f35af8b 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_DRAININGBLOW 16793
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
index f8a10f06155..522e43c0824 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_FROSTBOLT 17503
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
index c9a43edb66d..d6742e63167 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_ENCASINGWEBS 4962
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
index ebeda248331..47c6b66f4bb 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
@@ -23,7 +23,8 @@ SDComment: Basic script to have support for Horde paladin epic mount (quest 9737
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
/*#####
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
index cf8b10a2ee5..f650029a439 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//Spell ID to summon this guy is 24627 "Summon Postmaster Malown"
//He should be spawned along with three other elites once the third postbox has been opened
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
index 3bb1ce7959d..4f82367924d 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_TRAMPLE 5568
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
index a281c1b59c6..356023bce77 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_SPAWN "TIMMY!"
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
index 387b6d7b13c..98df9638bae 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -23,7 +23,9 @@ SDComment: In progress. Undead side 75% implemented. Save/load not implemented.
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "stratholme.h"
#define GO_SERVICE_ENTRANCE 175368
@@ -122,7 +124,7 @@ class instance_stratholme : public InstanceMapScript
return true;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Cannot open slaugther square yet.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Cannot open slaugther square yet.");
return false;
}
@@ -240,7 +242,7 @@ class instance_stratholme : public InstanceMapScript
break;
EncounterState[0] = data;
events.ScheduleEvent(EVENT_BARON_RUN, 2700000);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Baron run in progress.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run in progress.");
break;
case FAIL:
DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM);
@@ -298,10 +300,10 @@ class instance_stratholme : public InstanceMapScript
//UpdateGoState(ziggurat4GUID, 0, true);
if (Creature* pBaron = instance->GetCreature(baronGUID))
pBaron->SummonCreature(C_RAMSTEIN, 4032.84f, -3390.24f, 119.73f, 4.71f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Ramstein spawned.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Ramstein spawned.");
}
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: %u Abomnation left to kill.", count);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: %u Abomnation left to kill.", count);
}
if (data == NOT_STARTED)
@@ -310,7 +312,7 @@ class instance_stratholme : public InstanceMapScript
if (data == DONE)
{
events.ScheduleEvent(EVENT_SLAUGHTER_SQUARE, 60000);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Slaugther event will continue in 1 minute.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Slaugther event will continue in 1 minute.");
}
EncounterState[4] = data;
break;
@@ -446,7 +448,7 @@ class instance_stratholme : public InstanceMapScript
case EVENT_BARON_RUN:
if (GetData(TYPE_BARON_RUN) != DONE)
SetData(TYPE_BARON_RUN, FAIL);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN));
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN));
break;
case EVENT_SLAUGHTER_SQUARE:
if (Creature* baron = instance->GetCreature(baronGUID))
@@ -456,7 +458,7 @@ class instance_stratholme : public InstanceMapScript
HandleGameObject(ziggurat4GUID, true);
HandleGameObject(ziggurat5GUID, true);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Black guard sentries spawned. Opening gates to baron.");
}
break;
default:
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 7e167093e07..9b4591bc633 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -30,7 +30,8 @@ mob_restless_soul
mobs_spectral_ghostly_citizen
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#include "Group.h"
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
index e804fff44f5..e0987961f7e 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
@@ -23,7 +23,8 @@ SDComment:Place Holder
SDCategory: Sunken Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "sunken_temple.h"
#define GO_ATALAI_STATUE1 148830
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
index 35d6766872f..83ff86f5b88 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
@@ -27,7 +27,8 @@ EndScriptData */
at_malfurion_Stormrage_trigger
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunken_temple.h"
/*#####
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index 43c94f8a57d..e40a48d0251 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -22,7 +22,8 @@ SD%Complete: 80
SDComment: Find a way to start the intro, best code for the intro
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
enum Quotes
@@ -170,7 +171,7 @@ public:
else
{
//Madrigosa not found, end intro
- sLog->outError("Madrigosa was not found");
+ sLog->outError(LOG_FILTER_TSCR, "Madrigosa was not found");
EndIntro();
}
}
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index 03486a644a2..e7b0e86285e 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -21,7 +21,8 @@ SD%Complete: 100
SDComment:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
enum Quotes
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 72ad1100752..7267c4e1bdb 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -21,7 +21,12 @@ SD%Complete: 0
SDComment:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "sunwell_plateau.h"
enum Yells
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index f783fcc1eb5..57e69238816 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Sunwell_Plateau
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
enum Yells
@@ -269,7 +270,7 @@ public:
}
else
{
- sLog->outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted.");
+ sLog->outError(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted.");
EnterEvadeMode();
return;
}
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 8a64d45abcb..167f040bbc4 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -24,7 +24,8 @@ EndScriptData */
//TODO rewrite Armageddon
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
#include <math.h>
@@ -754,7 +755,7 @@ public:
if (pRandomPlayer)
DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false);
else
- sLog->outError("try to cast SPELL_LEGION_LIGHTNING on invalid target");
+ sLog->outError(LOG_FILTER_TSCR, "try to cast SPELL_LEGION_LIGHTNING on invalid target");
Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE
Timer[TIMER_SOUL_FLAY] = 2500;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index 66030a1c78c..c00ab84b567 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -21,7 +21,8 @@ SD%Complete: 80
SDComment: all sounds, black hole effect triggers to often (46228)
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
// Muru & Entropius's spells
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
index 645026c343d..6324c5adf16 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -23,7 +23,8 @@ SDComment: VERIFY SCRIPT
SDCategory: Sunwell_Plateau
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "sunwell_plateau.h"
#define MAX_ENCOUNTER 6
@@ -134,7 +135,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -275,14 +276,9 @@ public:
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' '
<< m_auiEncounter[4] << ' ' << m_auiEncounter[5];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
index e6349e3497e..25bc85f47b6 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
@@ -26,7 +26,8 @@ npc_prophet_velen
npc_captain_selana
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 7a946e9d5bf..3ffb873e4d2 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -26,7 +26,8 @@ At 33%, he will awaken the Vault Walkers
On his death the vault door opens.
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "uldaman.h"
#define SAY_AGGRO "Who dares awaken Archaedas? Who dares the wrath of the makers!"
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
index 8a845dbb7f6..c05a36f93a7 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Uldaman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_AGGRO -1070000
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index fea64c55377..ade07039a23 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -23,7 +23,8 @@ SDComment: Need some cosmetics updates when archeadas door are closing (Guardian
SDCategory: Uldaman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "uldaman.h"
enum eSpells
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
index 1c6cad7278a..2b8d4e37b65 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
@@ -30,7 +30,8 @@ go_keystone_chamber
at_map_chamber
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "uldaman.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index 9a9f37d165f..068d00f550f 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -25,7 +25,12 @@ SQLUpdate:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "zulaman.h"
#include "Weather.h"
@@ -75,7 +80,9 @@ class boss_akilzon : public CreatureScript
boss_akilzonAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ memset(BirdGUIDs, 0, sizeof(BirdGUIDs));
}
+
InstanceScript* instance;
uint64 BirdGUIDs[8];
@@ -111,8 +118,7 @@ class boss_akilzon : public CreatureScript
CloudGUID = 0;
CycloneGUID = 0;
DespawnSummons();
- for (uint8 i = 0; i < 8; ++i)
- BirdGUIDs[i] = 0;
+ memset(BirdGUIDs, 0, sizeof(BirdGUIDs));
StormCount = 0;
StormSequenceTimer = 0;
@@ -332,7 +338,7 @@ class boss_akilzon : public CreatureScript
CloudGUID = Cloud->GetGUID();
Cloud->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY);
Cloud->StopMoving();
- Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ Cloud->SetObjectScale(1.0f);
Cloud->setFaction(35);
Cloud->SetMaxHealth(9999999);
Cloud->SetHealth(9999999);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index 3baa6ebdf62..a8afd19cd96 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
//#include "spell.h"
@@ -108,6 +109,7 @@ class boss_halazzi : public CreatureScript
if (instance)
instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED);
+ LynxGUID = 0;
TransformCount = 0;
BerserkTimer = 600000;
CheckTimer = 1000;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index b5698d851f8..4fcfa8a046e 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -23,7 +23,10 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "zulaman.h"
#define YELL_AGGRO "Da shadow gonna fall on you... "
@@ -47,54 +50,58 @@ EndScriptData */
//Defines for various powers he uses after using soul drain
-//Druid
-#define SPELL_DR_LIFEBLOOM 43421
-#define SPELL_DR_THORNS 43420
-#define SPELL_DR_MOONFIRE 43545
-
-//Hunter
-#define SPELL_HU_EXPLOSIVE_TRAP 43444
-#define SPELL_HU_FREEZING_TRAP 43447
-#define SPELL_HU_SNAKE_TRAP 43449
-
-//Mage
-#define SPELL_MG_FIREBALL 41383
-#define SPELL_MG_FROSTBOLT 43428
-#define SPELL_MG_FROST_NOVA 43426
-#define SPELL_MG_ICE_LANCE 43427
-
-//Paladin
-#define SPELL_PA_CONSECRATION 43429
-#define SPELL_PA_HOLY_LIGHT 43451
-#define SPELL_PA_AVENGING_WRATH 43430
-
-//Priest
-#define SPELL_PR_HEAL 41372
-#define SPELL_PR_MIND_CONTROL 43550
-#define SPELL_PR_MIND_BLAST 41374
-#define SPELL_PR_SW_DEATH 41375
-#define SPELL_PR_PSYCHIC_SCREAM 43432
-#define SPELL_PR_PAIN_SUPP 44416
-
-//Rogue
-#define SPELL_RO_BLIND 43433
-#define SPELL_RO_SLICE_DICE 43457
-#define SPELL_RO_WOUND_POISON 39665
-
-//Shaman
-#define SPELL_SH_FIRE_NOVA 43436
-#define SPELL_SH_HEALING_WAVE 43548
-#define SPELL_SH_CHAIN_LIGHT 43435
-
-//Warlock
-#define SPELL_WL_CURSE_OF_DOOM 43439
-#define SPELL_WL_RAIN_OF_FIRE 43440
-#define SPELL_WL_UNSTABLE_AFFL 35183
-
-//Warrior
-#define SPELL_WR_SPELL_REFLECT 43443
-#define SPELL_WR_WHIRLWIND 43442
-#define SPELL_WR_MORTAL_STRIKE 43441
+enum Spells
+{
+ // Druid
+ SPELL_DR_THORNS = 43420,
+ SPELL_DR_LIFEBLOOM = 43421,
+ SPELL_DR_MOONFIRE = 43545,
+
+ // Hunter
+ SPELL_HU_EXPLOSIVE_TRAP = 43444,
+ SPELL_HU_FREEZING_TRAP = 43447,
+ SPELL_HU_SNAKE_TRAP = 43449,
+
+ // Mage
+ SPELL_MG_FIREBALL = 41383,
+ SPELL_MG_FROST_NOVA = 43426,
+ SPELL_MG_ICE_LANCE = 43427,
+ SPELL_MG_FROSTBOLT = 43428,
+
+ // Paladin
+ SPELL_PA_CONSECRATION = 43429,
+ SPELL_PA_AVENGING_WRATH = 43430,
+ SPELL_PA_HOLY_LIGHT = 43451,
+
+ // Priest
+ SPELL_PR_HEAL = 41372,
+ SPELL_PR_MIND_BLAST = 41374,
+ SPELL_PR_SW_DEATH = 41375,
+ SPELL_PR_PSYCHIC_SCREAM = 43432,
+ SPELL_PR_MIND_CONTROL = 43550,
+ SPELL_PR_PAIN_SUPP = 44416,
+
+ // Rogue
+ SPELL_RO_BLIND = 43433,
+ SPELL_RO_SLICE_DICE = 43457,
+ SPELL_RO_WOUND_POISON = 43461,
+
+ // Shaman
+ SPELL_SH_CHAIN_LIGHT = 43435,
+ SPELL_SH_FIRE_NOVA = 43436,
+ SPELL_SH_HEALING_WAVE = 43548,
+
+ // Warlock
+ SPELL_WL_CURSE_OF_DOOM = 43439,
+ SPELL_WL_RAIN_OF_FIRE = 43440,
+ SPELL_WL_UNSTABLE_AFFL = 43522,
+ SPELL_WL_UNSTABLE_AFFL_DISPEL = 43523,
+
+ // Warrior
+ SPELL_WR_MORTAL_STRIKE = 43441,
+ SPELL_WR_WHIRLWIND = 43442,
+ SPELL_WR_SPELL_REFLECT = 43443
+};
#define ORIENT 1.5696f
#define POS_Y 921.2795f
@@ -936,6 +943,40 @@ class boss_koragg : public CreatureScript
}
};
+class spell_hexlord_unstable_affliction : public SpellScriptLoader
+{
+ public:
+ spell_hexlord_unstable_affliction() : SpellScriptLoader("spell_hexlord_unstable_affliction") { }
+
+ class spell_hexlord_unstable_affliction_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hexlord_unstable_affliction_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_WL_UNSTABLE_AFFL_DISPEL))
+ return false;
+ return true;
+ }
+
+ void HandleDispel(DispelInfo* dispelInfo)
+ {
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, NULL, GetEffect(EFFECT_0));
+ }
+
+ void Register()
+ {
+ AfterDispel += AuraDispelFn(spell_hexlord_unstable_affliction_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hexlord_unstable_affliction_AuraScript();
+ }
+};
+
void AddSC_boss_hex_lord_malacrass()
{
new boss_hexlord_malacrass();
@@ -947,5 +988,6 @@ void AddSC_boss_hex_lord_malacrass()
new boss_fenstalker();
new boss_koragg();
new boss_alyson_antille();
+ new spell_hexlord_unstable_affliction();
}
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index a2125c45689..8a102757036 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -23,9 +23,11 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
#include "GridNotifiers.h"
+#include "CellImpl.h"
enum eEnums
{
@@ -246,7 +248,7 @@ class boss_janalai : public CreatureScript
cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange());
}
- //sLog->outError("Eggs %d at middle", templist.size());
+ //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at middle", templist.size());
if (templist.empty())
return false;
@@ -532,7 +534,7 @@ class mob_janalai_hatcher : public CreatureScript
cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange());
}
- //sLog->outError("Eggs %d at %d", templist.size(), side);
+ //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at %d", templist.size(), side);
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i)
if ((*i)->GetDisplayId() != 11686)
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
index 48a406f22a4..eb3057a74d3 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
@@ -23,9 +23,12 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
//Trash Waves
float NalorakkWay[8][3] =
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 2df202af088..1009d3e0a0a 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -22,7 +22,8 @@ SD%Complete: 85%
SDComment:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
//Speech
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
index 884fe109785..235bec7cc8a 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "zulaman.h"
#define MAX_ENCOUNTER 6
@@ -179,12 +180,13 @@ class instance_zulaman : public InstanceMapScript
std::string GetSaveData()
{
+ OUT_SAVE_INST_DATA;
+
std::ostringstream ss;
ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute;
- char* data = new char[ss.str().length()+1];
- strcpy(data, ss.str().c_str());
- //sLog->outError("TSCR: Zul'aman saved, %s.", data);
- return data;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return ss.str();
}
void Load(const char* load)
@@ -193,17 +195,17 @@ class instance_zulaman : public InstanceMapScript
return;
std::istringstream ss(load);
- //sLog->outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str());
+ //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %s.", ss.str().c_str());
char dataHead; // S
uint16 data1, data2, data3;
ss >> dataHead >> data1 >> data2 >> data3;
- //sLog->outError("TSCR: Zul'aman loaded, %d %d %d.", data1, data2, data3);
+ //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %d %d %d.", data1, data2, data3);
if (dataHead == 'S')
{
BossKilled = data1;
ChestLooted = data2;
QuestMinute = data3;
- } else sLog->outError("TSCR: Zul'aman: corrupted save data.");
+ } else sLog->outError(LOG_FILTER_TSCR, "Zul'aman: corrupted save data.");
}
void SetData(uint32 type, uint32 data)
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index bfb22483b09..f0bea065eb6 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_forest_frog
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "zulaman.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
index 4ba0c187973..17c3f5e8ff4 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
@@ -23,7 +23,8 @@ SDComment: Wrong cleave and red aura is missing.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
enum eYells
@@ -170,7 +171,7 @@ class boss_arlokk : public CreatureScript
MarkedTargetGUID = pMarkedTarget->GetGUID();
}
else
- sLog->outError("TSCR: boss_arlokk could not accuire pMarkedTarget.");
+ sLog->outError(LOG_FILTER_TSCR, "boss_arlokk could not accuire pMarkedTarget.");
m_uiMark_Timer = 15000;
}
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
index ce2fd0848f9..5e553c7396f 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
@@ -23,7 +23,8 @@ SDComment: Massive Geyser with knockback not working. Spell buggy.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_FROSTBREATH 16099
#define SPELL_MASSIVEGEYSER 22421 //Not working. Cause its a summon...
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
index cdd45a3fa0d..8c71ea6d48d 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_AVARTAR 24646 //The Enrage Spell
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
index 9edd82c39b0..6cb657f4cff 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
@@ -23,7 +23,8 @@ SDComment: Blood siphon spell buggy cause of Core Issue.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SAY_AGGRO -1309020
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
index 27c46b8e0f2..bb3e0b14e0e 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_MANABURN 26046
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
index 7d2215f8311..156ccab5eae 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
@@ -23,7 +23,8 @@ SDComment: Problem in finding the right flying batriders for spawning and making
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SAY_AGGRO -1309002
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
index f4a17da56fb..f8d23947e9c 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
@@ -23,7 +23,8 @@ SDComment: Mind Control not working because of core bug. Shades visible for all.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SAY_AGGRO -1309014
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index cbe1178e6c4..83cd0b46fb8 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -23,7 +23,8 @@ SDComment: Ohgan function needs improvements.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SAY_AGGRO -1309015
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
index 44ab5d851f5..8e0deda1d0b 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
@@ -23,7 +23,8 @@ SDComment: Charging healers and casters not working. Perhaps wrong Spell Timers.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SAY_AGGRO -1309005
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
index 81260c28d73..32a8f209917 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_AMBUSH 24337
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
index ce6b3b37ef8..29495f77f2a 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
@@ -23,7 +23,8 @@ SDComment: Almost finished.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SAY_AGGRO -1309009
@@ -197,7 +198,7 @@ class boss_thekal : public CreatureScript
if (Resurrect_Timer <= diff)
{
DoCast(me, SPELL_TIGER_FORM);
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
+ me->SetObjectScale(2.00f);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFullHealth();
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
index b22630f51bb..6cdb00236df 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_LIGHTNINGCLOUD 25033
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
index e3dd5d5933b..104d479383b 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
@@ -23,7 +23,8 @@ SDComment: Missing reset function after killing a boss for Ohgan, Thekal.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "zulgurub.h"
class instance_zulgurub : public InstanceMapScript
diff --git a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp
index e4b24dc00ee..b56727b18e1 100644
--- a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp
@@ -26,7 +26,8 @@ EndScriptData */
/* ContentData
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*void AddSC_alterac_mountains()
{
diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
index d4d35b107b2..b0d59fe8b5a 100644
--- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
+++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
@@ -27,7 +27,8 @@ EndScriptData */
npc_professor_phizzlethorpe
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp
index 2042e5313c3..3d8e68dfbf8 100644
--- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp
+++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_deathly_usher
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_deathly_usher
diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp
index 8749c943a6f..6a1ba633660 100644
--- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp
+++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp
@@ -23,7 +23,8 @@ SDComment: Highlord Kruul are presumably no longer in-game on regular bases, how
SDCategory: Bosses
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWVOLLEY 21341
#define SPELL_CLEAVE 20677
diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp
index b526246f670..eec747d6d73 100644
--- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp
+++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_ragged_john
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_ragged_john
diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp
index 10cb5987ce5..e5af5344dc1 100644
--- a/src/server/scripts/EasternKingdoms/duskwood.cpp
+++ b/src/server/scripts/EasternKingdoms/duskwood.cpp
@@ -23,7 +23,8 @@ SDComment: Quest Support:8735
SDCategory: Duskwood
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Yells
{
diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
index 0519ce94b32..7ca76e38fce 100644
--- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
@@ -30,7 +30,9 @@ npc_darrowshire_spirit
npc_tirion_fordring
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
class mobs_ghoul_flayer : public CreatureScript
{
diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp
index 8ae72e142c8..d69ae3454b4 100644
--- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp
+++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp
@@ -31,7 +31,9 @@ npc_kelerun_bloodmourn
go_harbinger_second_trial
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp
index e40a2f785e6..9793c6fd31c 100644
--- a/src/server/scripts/EasternKingdoms/ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp
@@ -30,7 +30,9 @@ npc_rathis_tomber
npc_ranger_lilatha
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp
index 8de895cb51f..a6d01f0ca93 100644
--- a/src/server/scripts/EasternKingdoms/hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp
@@ -28,7 +28,8 @@ npc_00x09hl
npc_rinji
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp
index 93a8d7423c9..2915ee1f3cb 100644
--- a/src/server/scripts/EasternKingdoms/ironforge.cpp
+++ b/src/server/scripts/EasternKingdoms/ironforge.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_royal_historian_archesonus
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_royal_historian_archesonus
diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
index 27d8ea3e51c..e448ccda14c 100644
--- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
+++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
@@ -28,7 +28,8 @@ npc_converted_sentry
npc_greengill_slave
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*######
## npc_converted_sentry
diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp
index 7ea8a62a5bd..4e3aaae71a1 100644
--- a/src/server/scripts/EasternKingdoms/loch_modan.cpp
+++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_mountaineer_pebblebitty
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_mountaineer_pebblebitty
diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp
index 3ade1da4a19..2473fec899a 100644
--- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp
@@ -21,7 +21,8 @@ SD%Complete: 100%
SDComment: Support for quest 219.
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
enum eCorporalKeeshan
diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
index e6595a83b66..954f21f73f5 100644
--- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
+++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
@@ -27,7 +27,8 @@ EndScriptData */
npc_blood_knight_stillblade
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*#######
# npc_blood_knight_stillblade
diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
index bc3110878de..870cb29c28d 100644
--- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
@@ -28,7 +28,8 @@ npc_deathstalker_erland
pyrewood_ambush
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
@@ -258,7 +259,7 @@ public:
void UpdateAI(const uint32 diff)
{
- //sLog->outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
+ //sLog->outInfo(LOG_FILTER_TSCR, "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
if (!QuestInProgress)
return;
diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp
index 96ad1da725d..560214d4085 100644
--- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp
@@ -33,7 +33,9 @@ npc_marzon_silent_blade
npc_lord_gregor_lescovar
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
index 03f92ce6d61..40f046a5075 100644
--- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
@@ -27,7 +27,8 @@ EndScriptData */
mob_yenniku
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*######
## mob_yenniku
diff --git a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp
index 6507ec911c0..4c81380fb60 100644
--- a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp
+++ b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp
index 4687fa3630f..70f9f93c7a7 100644
--- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp
+++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp
@@ -29,7 +29,8 @@ go_mausoleum_door
go_mausoleum_trigger
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*######
## npc_calvin_montague
diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp
index d5896812007..0d44db01592 100644
--- a/src/server/scripts/EasternKingdoms/undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/undercity.cpp
@@ -29,7 +29,9 @@ npc_highborne_lamenter
npc_parqual_fintallas
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_lady_sylvanas_windrunner
@@ -173,39 +175,39 @@ public:
if (me->GetDistance(victim) > 10.0f)
DoCast(victim, SPELL_MULTI_SHOT);
} else FadeTimer -= diff;
-
+
if (SummonSkeletonTimer <= diff)
{
DoCast(me, SPELL_SUMMON_SKELETON);
SummonSkeletonTimer = 20000 + rand()%10000;
} else SummonSkeletonTimer -= diff;
-
+
if (BlackArrowTimer <= diff)
{
if (Unit* victim = me->getVictim())
{
- DoCast(me->getVictim(), SPELL_BLACK_ARROW);
+ DoCast(victim, SPELL_BLACK_ARROW);
BlackArrowTimer = 15000 + rand()%5000;
}
} else BlackArrowTimer -= diff;
-
+
if (ShotTimer <= diff)
{
if (Unit* victim = me->getVictim())
{
- DoCast(me->getVictim(), SPELL_SHOT);
+ DoCast(victim, SPELL_SHOT);
ShotTimer = 8000 + rand()%2000;
}
} else ShotTimer -= diff;
-
+
if (MultiShotTimer <= diff)
{
if (Unit* victim = me->getVictim())
{
- DoCast(me->getVictim(), SPELL_MULTI_SHOT);
+ DoCast(victim, SPELL_MULTI_SHOT);
MultiShotTimer = 10000 + rand()%3000;
}
- } else MultiShotTimer -= diff;
+ } else MultiShotTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
index 0057c01b882..31dea10453a 100644
--- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
@@ -30,7 +30,9 @@ npc_the_scourge_cauldron
npc_andorhal_tower
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp
index 46f1526c5bf..478c5f6c0d6 100644
--- a/src/server/scripts/EasternKingdoms/westfall.cpp
+++ b/src/server/scripts/EasternKingdoms/westfall.cpp
@@ -28,7 +28,8 @@ npc_daphne_stilwell
npc_defias_traitor
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp
index bf28d9838a4..fac8fb51c2d 100644
--- a/src/server/scripts/EasternKingdoms/wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/wetlands.cpp
@@ -28,7 +28,8 @@ npc_mikhail
npc_tapoke_slim_jahn
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/Examples/example_commandscript.cpp b/src/server/scripts/Examples/example_commandscript.cpp
index 6b7a3d8def7..28ef021d599 100644
--- a/src/server/scripts/Examples/example_commandscript.cpp
+++ b/src/server/scripts/Examples/example_commandscript.cpp
@@ -23,7 +23,7 @@ Comment: Short custom scripting example
Category: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
#include "Chat.h"
// **** This script is designed as an example for others to build on ****
diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp
index 7f75a0fb481..17b9aae732b 100644
--- a/src/server/scripts/Examples/example_creature.cpp
+++ b/src/server/scripts/Examples/example_creature.cpp
@@ -23,7 +23,9 @@ SDComment: Short custom scripting example
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
// **** This script is designed as an example for others to build on ****
// **** Please modify whatever you'd like to as this script is only for developement ****
diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp
index 851a32538e9..20e4c5614e9 100644
--- a/src/server/scripts/Examples/example_escort.cpp
+++ b/src/server/scripts/Examples/example_escort.cpp
@@ -23,7 +23,9 @@ SDComment: Script used for testing escortAI
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
enum eEnums
diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp
index 6d57f1ac798..a5627c68ff6 100644
--- a/src/server/scripts/Examples/example_gossip_codebox.cpp
+++ b/src/server/scripts/Examples/example_gossip_codebox.cpp
@@ -23,7 +23,9 @@ SDComment: Show a codebox in gossip option
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include <cstring>
enum eEnums
diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp
index d83a00ed82f..3aa4bac3f1e 100644
--- a/src/server/scripts/Examples/example_misc.cpp
+++ b/src/server/scripts/Examples/example_misc.cpp
@@ -23,7 +23,6 @@ SDComment: Item, Areatrigger and other small code examples
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
#include "ScriptMgr.h"
enum eSay
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 8c721c141af..cc27392919f 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -22,9 +22,10 @@
* and `ScriptName` is the name of a script assigned on registration
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Spells
{
@@ -80,19 +81,19 @@ class spell_ex_5581 : public SpellScriptLoader
{
// this hook is executed before anything about casting the spell is done
// after this hook is executed all the machinery starts
- sLog->outString("Caster just finished preparing the spell (cast bar has expired)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Caster just finished preparing the spell (cast bar has expired)");
}
void HandleOnCast()
{
// cast is validated and spell targets are selected at this moment
// this is a last place when the spell can be safely interrupted
- sLog->outString("Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects");
}
void HandleAfterCast()
{
- sLog->outString("All immediate Actions for the spell are finished now");
+ sLog->outInfo(LOG_FILTER_GENERAL, "All immediate Actions for the spell are finished now");
// this is a safe for triggering additional effects for a spell without interfering
// with visuals or with other effects of the spell
//GetCaster()->CastSpell(target, SPELL_TRIGGERED, true);
@@ -102,7 +103,7 @@ class spell_ex_5581 : public SpellScriptLoader
{
// in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed)
// in this case we're disallowing to select non-player as a target of the spell
- //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer())
+ //if (!GetExplTargetUnit() || GetExplTargetUnit()->ToPlayer())
//return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
@@ -110,7 +111,7 @@ class spell_ex_5581 : public SpellScriptLoader
void HandleDummyLaunch(SpellEffIndex /*effIndex*/)
{
- sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id);
}
void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/)
@@ -119,17 +120,17 @@ class spell_ex_5581 : public SpellScriptLoader
if (Unit* unitTarget = GetHitUnit())
targetGUID = unitTarget->GetGUID();
// we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
- sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID);
}
void HandleDummyHit(SpellEffIndex /*effIndex*/)
{
- sLog->outString("Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id);
}
void HandleDummyHitTarget(SpellEffIndex /*effIndex*/)
{
- sLog->outString("SPELL_EFFECT_DUMMY is hits it's target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "SPELL_EFFECT_DUMMY is hits it's target!");
// make caster cast a spell on a unit target of effect
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_TRIGGERED, true);
@@ -137,23 +138,23 @@ class spell_ex_5581 : public SpellScriptLoader
void HandleBeforeHit()
{
- sLog->outString("Spell is about to hit target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to hit target!");
}
void HandleOnHit()
{
- sLog->outString("Spell just hit target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell just hit target!");
}
void HandleAfterHit()
{
- sLog->outString("Spell just finished hitting target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell just finished hitting target!");
}
void FilterTargets(std::list<Unit*>& /*targetList*/)
{
// usually you want this call for Area Target spells
- sLog->outString("Spell is about to add targets from targetList to final targets!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to add targets from targetList to final targets!");
}
// register functions used in spell script - names of these functions do not matter
@@ -228,20 +229,20 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect is about to be applied on target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be applied on target!");
// this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler
//PreventDefaultAction();
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect is about to be removed from target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be removed from target!");
// this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler
//PreventDefaultAction();
}
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect has just been applied on target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!");
Unit* target = GetTarget();
// cast spell on target on aura apply
target->CastSpell(target, SPELL_TRIGGERED, true);
@@ -249,7 +250,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect has just been just removed from target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been just removed from target!");
Unit* target = GetTarget();
Unit* caster = GetCaster();
// caster may be not avalible (logged out for example)
@@ -261,7 +262,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
- sLog->outString("Perioidic Aura Effect is does a tick on target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is does a tick on target!");
Unit* target = GetTarget();
// aura targets damage self on tick
target->DealDamage(target, 100);
@@ -269,14 +270,14 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectPeriodicUpdate(AuraEffect* aurEff)
{
- sLog->outString("Perioidic Aura Effect is now updated!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is now updated!");
// we're doubling aura amount every tick
aurEff->ChangeAmount(aurEff->GetAmount() * 2);
}
void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
{
- sLog->outString("Amount of Aura Effect is being calculated now!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Amount of Aura Effect is being calculated now!");
// we're setting amount to 100
amount = 100;
// amount will be never recalculated due to applying passive aura
@@ -285,7 +286,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
- sLog->outString("Periodic data of Aura Effect is being calculated now!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Periodic data of Aura Effect is being calculated now!");
// we're setting aura to be periodic and tick every 10 seconds
isPeriodic = true;
amplitude = 2 * IN_MILLISECONDS;
@@ -293,7 +294,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectCalcSpellMod(AuraEffect const* /*aurEff*/, SpellModifier*& spellMod)
{
- sLog->outString("SpellMod data of Aura Effect is being calculated now!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "SpellMod data of Aura Effect is being calculated now!");
// we don't want spellmod for example
if (spellMod)
{
@@ -366,14 +367,14 @@ class spell_ex_absorb_aura : public SpellScriptLoader
void HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- sLog->outString("Our aura is now absorbing damage done to us!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Our aura is now absorbing damage done to us!");
// absorb whole damage done to us
absorbAmount = dmgInfo.GetDamage();
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
{
- sLog->outString("Our aura has absorbed %u damage!", absorbAmount);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Our aura has absorbed %u damage!", absorbAmount);
}
// function registering
@@ -402,7 +403,7 @@ class spell_ex_463 : public SpellScriptLoader
bool CheckAreaTarget(Unit* target)
{
- sLog->outString("Area aura checks if unit is a valid target for it!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Area aura checks if unit is a valid target for it!");
// in our script we allow only players to be affected
return target->GetTypeId() == TYPEID_PLAYER;
}
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index a86b2b8b17a..a70d05fa0ef 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -15,11 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "blackfathom_deeps.h"
#include "ScriptedEscortAI.h"
-enum eSpells
+enum Spells
{
SPELL_BLESSING_OF_BLACKFATHOM = 8733,
SPELL_RAVAGE = 8391,
@@ -94,11 +96,11 @@ public:
uint32 frostNovaTimer;
uint32 frostBoltVolleyTimer;
- bool bFlee;
+ bool Flee;
void Reset()
{
- bFlee = false;
+ Flee = false;
ravageTimer = urand(5000, 8000);
frostNovaTimer = urand(9000, 12000);
@@ -140,7 +142,7 @@ public:
{
if (ravageTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_RAVAGE);
+ DoCastVictim(SPELL_RAVAGE);
ravageTimer = urand(9000, 14000);
} else ravageTimer -= diff;
break;
@@ -148,9 +150,9 @@ public:
case NPC_MURKSHALLOW_SOFTSHELL:
case NPC_BARBED_CRUSTACEAN:
{
- if (!bFlee && HealthBelowPct(15))
+ if (!Flee && HealthBelowPct(15))
{
- bFlee = true;
+ Flee = true;
me->DoFleeToGetAssistance();
}
break;
@@ -160,10 +162,7 @@ public:
if (frostBoltVolleyTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- {
- if (target)
- DoCast(target, SPELL_FROST_BOLT_VOLLEY);
- }
+ DoCast(target, SPELL_FROST_BOLT_VOLLEY);
frostBoltVolleyTimer = urand(5000, 8000);
}
else frostBoltVolleyTimer -= diff;
@@ -190,7 +189,7 @@ public:
};
};
-enum eMorridune
+enum Morridune
{
SAY_MORRIDUNE_1 = -1048003,
SAY_MORRIDUNE_2 = -1048004
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
index 32a6bcbde77..7071395812e 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blackfathom_deeps.h"
enum Spells
@@ -42,14 +43,14 @@ public:
}
uint32 poisonCloudTimer;
- bool bIsEnraged;
+ bool IsEnraged;
InstanceScript* instance;
void Reset()
{
poisonCloudTimer = urand(5000, 9000);
- bIsEnraged = false;
+ IsEnraged = false;
if (instance)
instance->SetData(TYPE_AKU_MAI, NOT_STARTED);
}
@@ -77,10 +78,10 @@ public:
poisonCloudTimer = urand(25000, 50000);
} else poisonCloudTimer -= diff;
- if (!bIsEnraged && HealthBelowPct(30))
+ if (!IsEnraged && HealthBelowPct(30))
{
DoCast(me, SPELL_FRENZIED_RAGE);
- bIsEnraged = true;
+ IsEnraged = true;
}
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
index 5a60a849b75..1488772dc8a 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blackfathom_deeps.h"
enum Spells
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
index 7ee17172102..1c754b78672 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blackfathom_deeps.h"
enum Spells
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
index ea33499a960..236c7b1ba69 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Blackfathom Deeps
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "blackfathom_deeps.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index 85f82c62079..222626240ea 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -15,42 +15,30 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
-#define SPELL_CARRION_SWARM 31306
-#define SPELL_SLEEP 31298
-#define SPELL_VAMPIRIC_AURA 38196
-#define SPELL_INFERNO 31299
-
-#define SAY_ONDEATH "The clock... is still... ticking."
-#define SOUND_ONDEATH 10982
-
-#define SAY_ONSLAY1 "Your hopes are lost!"
-#define SAY_ONSLAY2 "Scream for me!"
-#define SAY_ONSLAY3 "Pity, no time for a slow death!"
-#define SOUND_ONSLAY1 10981
-#define SOUND_ONSLAY2 11038
-#define SOUND_ONSLAY3 11039
-
-#define SAY_SWARM1 "The swarm is eager to feed!"
-#define SAY_SWARM2 "Pestilence upon you!"
-#define SOUND_SWARM1 10979
-#define SOUND_SWARM2 11037
-
-#define SAY_SLEEP1 "You look tired..."
-#define SAY_SLEEP2 "Sweet dreams..."
-#define SOUND_SLEEP1 10978
-#define SOUND_SLEEP2 11545
-
-#define SAY_INFERNO1 "Let fire rain from above!"
-#define SAY_INFERNO2 "Earth and sky shall burn!"
-#define SOUND_INFERNO1 10980
-#define SOUND_INFERNO2 11036
+enum Spells
+{
+ SPELL_CARRION_SWARM = 31306,
+ SPELL_SLEEP = 31298,
+ SPELL_VAMPIRIC_AURA = 38196,
+ SPELL_INFERNO = 31299,
+ SPELL_IMMOLATION = 31303,
+ SPELL_INFERNO_EFFECT = 31302,
+};
-#define SAY_ONAGGRO "You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!"
-#define SOUND_ONAGGRO 10977
+enum Texts
+{
+ SAY_ONDEATH = 0,
+ SAY_ONSLAY = 1,
+ SAY_SWARM = 2,
+ SAY_SLEEP = 3,
+ SAY_INFERNO = 4,
+ SAY_ONAGGRO = 5,
+};
class boss_anetheron : public CreatureScript
{
@@ -92,27 +80,12 @@ public:
{
if (instance && IsEvent)
instance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS);
- DoPlaySoundToSet(me, SOUND_ONAGGRO);
- me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0);
+ Talk(SAY_ONAGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- switch (urand(0, 2))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_ONSLAY1);
- me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_ONSLAY2);
- me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0);
- break;
- case 2:
- DoPlaySoundToSet(me, SOUND_ONSLAY3);
- me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_ONSLAY);
}
void WaypointReached(uint32 waypointId)
@@ -130,8 +103,7 @@ public:
hyjal_trashAI::JustDied(killer);
if (instance && IsEvent)
instance->SetData(DATA_ANETHERONEVENT, DONE);
- DoPlaySoundToSet(me, SOUND_ONDEATH);
- me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0);
+ Talk(SAY_ONDEATH);
}
void UpdateAI(const uint32 diff)
@@ -169,17 +141,7 @@ public:
DoCast(target, SPELL_CARRION_SWARM);
SwarmTimer = urand(45000, 60000);
- switch (urand(0, 1))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_SWARM1);
- me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_SWARM2);
- me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_SWARM);
} else SwarmTimer -= diff;
if (SleepTimer <= diff)
@@ -190,17 +152,7 @@ public:
target->CastSpell(target, SPELL_SLEEP, true);
}
SleepTimer = 60000;
- switch (urand(0, 1))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_SLEEP1);
- me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_SLEEP2);
- me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_SLEEP);
} else SleepTimer -= diff;
if (AuraTimer <= diff)
{
@@ -211,17 +163,7 @@ public:
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO);
InfernoTimer = 45000;
- switch (urand(0, 1))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_INFERNO1);
- me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_INFERNO2);
- me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_INFERNO);
} else InfernoTimer -= diff;
DoMeleeAttackIfReady();
@@ -230,9 +172,6 @@ public:
};
-#define SPELL_IMMOLATION 31303
-#define SPELL_INFERNO_EFFECT 31302
-
class mob_towering_infernal : public CreatureScript
{
public:
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index f07aaaa1f2a..ee988accbac 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -23,56 +23,57 @@ SDComment: Doomfires not completely offlike due to core limitations for random m
SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "hyjal.h"
#include "SpellAuras.h"
#include "hyjal_trash.h"
-//text id -1534018 are the text used when previous events complete. Not part of this script.
-#define SAY_AGGRO -1534019
-#define SAY_DOOMFIRE1 -1534020
-#define SAY_DOOMFIRE2 -1534021
-#define SAY_AIR_BURST1 -1534022
-#define SAY_AIR_BURST2 -1534023
-#define SAY_SLAY1 -1534024
-#define SAY_SLAY2 -1534025
-#define SAY_SLAY3 -1534026
-#define SAY_ENRAGE -1534027
-#define SAY_DEATH -1534028
-#define SAY_SOUL_CHARGE1 -1534029
-#define SAY_SOUL_CHARGE2 -1534030
-
-#define SPELL_DENOUEMENT_WISP 32124
-#define SPELL_ANCIENT_SPARK 39349
-#define SPELL_PROTECTION_OF_ELUNE 38528
-
-#define SPELL_DRAIN_WORLD_TREE 39140
-#define SPELL_DRAIN_WORLD_TREE_2 39141
-
-#define SPELL_FINGER_OF_DEATH 31984
-#define SPELL_HAND_OF_DEATH 35354
-#define SPELL_AIR_BURST 32014
-#define SPELL_GRIP_OF_THE_LEGION 31972
-#define SPELL_DOOMFIRE_STRIKE 31903 //summons two creatures
-#define SPELL_DOOMFIRE_SPAWN 32074
-#define SPELL_DOOMFIRE 31945
-#define SPELL_SOUL_CHARGE_YELLOW 32045
-#define SPELL_SOUL_CHARGE_GREEN 32051
-#define SPELL_SOUL_CHARGE_RED 32052
-#define SPELL_UNLEASH_SOUL_YELLOW 32054
-#define SPELL_UNLEASH_SOUL_GREEN 32057
-#define SPELL_UNLEASH_SOUL_RED 32053
-#define SPELL_FEAR 31970
-
-#define CREATURE_ARCHIMONDE 17968
-#define CREATURE_DOOMFIRE 18095
-#define CREATURE_DOOMFIRE_SPIRIT 18104
-#define CREATURE_ANCIENT_WISP 17946
-#define CREATURE_CHANNEL_TARGET 22418
-
-#define NORDRASSIL_X 5503.713f
-#define NORDRASSIL_Y -3523.436f
-#define NORDRASSIL_Z 1608.781f
+enum Texts
+{
+ SAY_AGGRO = 1,
+ SAY_DOOMFIRE = 2,
+ SAY_AIR_BURST = 3,
+ SAY_SLAY = 4,
+ SAY_ENRAGE = 5,
+ SAY_DEATH = 6,
+ SAY_SOUL_CHARGE = 7,
+};
+
+enum Spells
+{
+ SPELL_DENOUEMENT_WISP = 32124,
+ SPELL_ANCIENT_SPARK = 39349,
+ SPELL_PROTECTION_OF_ELUNE = 38528,
+
+ SPELL_DRAIN_WORLD_TREE = 39140,
+ SPELL_DRAIN_WORLD_TREE_2 = 39141,
+
+ SPELL_FINGER_OF_DEATH = 31984,
+ SPELL_HAND_OF_DEATH = 35354,
+ SPELL_AIR_BURST = 32014,
+ SPELL_GRIP_OF_THE_LEGION = 31972,
+ SPELL_DOOMFIRE_STRIKE = 31903, //summons two creatures
+ SPELL_DOOMFIRE_SPAWN = 32074,
+ SPELL_DOOMFIRE = 31945,
+ SPELL_SOUL_CHARGE_YELLOW = 32045,
+ SPELL_SOUL_CHARGE_GREEN = 32051,
+ SPELL_SOUL_CHARGE_RED = 32052,
+ SPELL_UNLEASH_SOUL_YELLOW = 32054,
+ SPELL_UNLEASH_SOUL_GREEN = 32057,
+ SPELL_UNLEASH_SOUL_RED = 32053,
+ SPELL_FEAR = 31970,
+};
+
+enum Summons
+{
+ CREATURE_DOOMFIRE = 18095,
+ CREATURE_DOOMFIRE_SPIRIT = 18104,
+ CREATURE_ANCIENT_WISP = 17946,
+ CREATURE_CHANNEL_TARGET = 22418,
+};
+
+Position const NordrassilLoc = {5503.713f, -3523.436f, 1608.781f, 0.0f};
class mob_ancient_wisp : public CreatureScript
{
@@ -258,11 +259,11 @@ public:
uint32 GripOfTheLegionTimer;
uint32 DoomfireTimer;
uint32 SoulChargeTimer;
- uint32 SoulChargeCount;
+ uint8 SoulChargeCount;
uint32 MeleeRangeCheckTimer;
uint32 HandOfDeathTimer;
uint32 SummonWispTimer;
- uint32 WispCount;
+ uint8 WispCount;
uint32 EnrageTimer;
uint32 CheckDistanceTimer;
@@ -303,7 +304,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoZoneInCombat();
if (instance)
@@ -312,7 +313,7 @@ public:
void KilledUnit(Unit* victim)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
if (victim && (victim->GetTypeId() == TYPEID_PLAYER))
GainSoulCharge(CAST_PLR(victim));
@@ -346,7 +347,7 @@ public:
void JustDied(Unit* killer)
{
hyjal_trashAI::JustDied(killer);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_ARCHIMONDEEVENT, DONE);
@@ -488,7 +489,7 @@ public:
{
if (!IsChanneling)
{
- Creature* temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000);
+ Creature* temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NordrassilLoc, TEMPSUMMON_TIMED_DESPAWN, 1200000);
if (temp)
WorldTreeGUID = temp->GetGUID();
@@ -525,14 +526,14 @@ public:
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveIdle();
Enraged = true;
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
}
} else EnrageTimer -= diff;
if (CheckDistanceTimer <= diff)
{
// To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature
- Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000);
+ Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NordrassilLoc, TEMPSUMMON_TIMED_DESPAWN, 2000);
if (Check)
{
Check->SetVisible(false);
@@ -542,7 +543,7 @@ public:
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveIdle();
Enraged = true;
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
}
}
CheckDistanceTimer = 5000;
@@ -598,11 +599,7 @@ public:
if (AirBurstTimer <= diff)
{
- if (urand(0, 1))
- DoScriptText(SAY_AIR_BURST1, me);
- else
- DoScriptText(SAY_AIR_BURST2, me);
-
+ Talk(SAY_AIR_BURST);
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank
AirBurstTimer = urand(25000, 40000);
} else AirBurstTimer -= diff;
@@ -615,11 +612,7 @@ public:
if (DoomfireTimer <= diff)
{
- if (urand(0, 1))
- DoScriptText(SAY_DOOMFIRE1, me);
- else
- DoScriptText(SAY_DOOMFIRE2, me);
-
+ Talk(SAY_DOOMFIRE);
Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (!temp)
temp = me->getVictim();
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index a9e0c866ab9..bfdaed35dd4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -15,33 +15,31 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
-#define SPELL_RAIN_OF_FIRE 31340
-#define SPELL_DOOM 31347
-#define SPELL_HOWL_OF_AZGALOR 31344
-#define SPELL_CLEAVE 31345
-#define SPELL_BERSERK 26662
-
-#define SAY_ONDEATH "Your time is almost... up"
-#define SOUND_ONDEATH 11002
-
-#define SAY_ONSLAY1 "Reesh, hokta!"
-#define SAY_ONSLAY2 "Don't fight it"
-#define SAY_ONSLAY3 "No one is going to save you"
-#define SOUND_ONSLAY1 11001
-#define SOUND_ONSLAY2 11048
-#define SOUND_ONSLAY3 11047
-
-#define SAY_DOOM1 "Just a taste... of what awaits you"
-#define SAY_DOOM2 "Suffer you despicable insect!"
-#define SOUND_DOOM1 11046
-#define SOUND_DOOM2 11000
+enum Spells
+{
+ SPELL_RAIN_OF_FIRE = 31340,
+ SPELL_DOOM = 31347,
+ SPELL_HOWL_OF_AZGALOR = 31344,
+ SPELL_CLEAVE = 31345,
+ SPELL_BERSERK = 26662,
+
+ SPELL_THRASH = 12787,
+ SPELL_CRIPPLE = 31406,
+ SPELL_WARSTOMP = 31408,
+};
-#define SAY_ONAGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!"
-#define SOUND_ONAGGRO 10999
+enum Texts
+{
+ SAY_ONDEATH = 0,
+ SAY_ONSLAY = 1,
+ SAY_DOOM = 2, // Not used?
+ SAY_ONAGGRO = 3,
+};
class boss_azgalor : public CreatureScript
{
@@ -88,27 +86,12 @@ public:
{
if (instance && IsEvent)
instance->SetData(DATA_AZGALOREVENT, IN_PROGRESS);
- DoPlaySoundToSet(me, SOUND_ONAGGRO);
- me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0);
+ Talk(SAY_ONAGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- switch (urand(0, 2))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_ONSLAY1);
- me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_ONSLAY2);
- me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0);
- break;
- case 2:
- DoPlaySoundToSet(me, SOUND_ONSLAY3);
- me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_ONSLAY);
}
void WaypointReached(uint32 waypointId)
@@ -126,7 +109,7 @@ public:
hyjal_trashAI::JustDied(killer);
if (instance && IsEvent)
instance->SetData(DATA_AZGALOREVENT, DONE);
- DoPlaySoundToSet(me, SOUND_ONDEATH);
+ Talk(SAY_ONDEATH);
}
void UpdateAI(const uint32 diff)
@@ -196,10 +179,6 @@ public:
};
-#define SPELL_THRASH 12787
-#define SPELL_CRIPPLE 31406
-#define SPELL_WARSTOMP 31408
-
class mob_lesser_doomguard : public CreatureScript
{
public:
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index 407faa19eaa..29eff68dfbd 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -15,30 +15,32 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
#include "hyjal.h"
#include "hyjal_trash.h"
-#define SPELL_CLEAVE 31436
-#define SPELL_WARSTOMP 31480
-#define SPELL_MARK 31447
-
-#define SOUND_ONDEATH 11018
-
-#define SAY_ONSLAY1 "Shaza-Kiel!"
-#define SAY_ONSLAY2 "You... are nothing!"
-#define SAY_ONSLAY3 "Miserable nuisance!"
-#define SOUND_ONSLAY1 11017
-#define SOUND_ONSLAY2 11053
-#define SOUND_ONSLAY3 11054
+enum Spells
+{
+ SPELL_CLEAVE = 31436,
+ SPELL_WARSTOMP = 31480,
+ SPELL_MARK = 31447,
+ SPELL_MARK_DAMAGE = 31463
+};
-#define SAY_MARK1 "Your death will be a painful one."
-#define SAY_MARK2 "You... are marked."
-#define SOUND_MARK1 11016
-#define SOUND_MARK2 11052
+enum Texts
+{
+ SAY_ONSLAY = 0,
+ SAY_MARK = 1,
+ SAY_ONAGGRO = 2,
+};
-#define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit."
-#define SOUND_ONAGGRO 11015
+enum Sounds
+{
+ SOUND_ONDEATH = 11018,
+};
class boss_kazrogal : public CreatureScript
{
@@ -80,27 +82,12 @@ public:
{
if (instance && IsEvent)
instance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS);
- DoPlaySoundToSet(me, SOUND_ONAGGRO);
- me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0);
+ Talk(SAY_ONAGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- switch (urand(0, 2))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_ONSLAY1);
- me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_ONSLAY2);
- me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0);
- break;
- case 2:
- DoPlaySoundToSet(me, SOUND_ONSLAY3);
- me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_ONSLAY);
}
void WaypointReached(uint32 waypointId)
@@ -162,37 +149,15 @@ public:
WarStompTimer = 60000;
} else WarStompTimer -= diff;
- if (me->HasAura(SPELL_MARK))
- me->RemoveAurasDueToSpell(SPELL_MARK);
if (MarkTimer <= diff)
{
- //cast dummy, useful for bos addons
- me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID());
+ DoCastAOE(SPELL_MARK);
- 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());
- if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA)
- {
- target->CastSpell(target, SPELL_MARK, true);//only cast on mana users
- }
- }
MarkTimerBase -= 5000;
if (MarkTimerBase < 5500)
MarkTimerBase = 5500;
MarkTimer = MarkTimerBase;
- switch (urand(0, 2))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_MARK1);
- me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_MARK2);
- me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_MARK);
} else MarkTimer -= diff;
DoMeleeAttackIfReady();
@@ -201,7 +166,79 @@ public:
};
+class MarkTargetFilter
+{
+ public:
+ bool operator()(WorldObject* target) const
+ {
+ if (Unit* unit = target->ToUnit())
+ return unit->getPowerType() != POWER_MANA;
+ return false;
+ }
+};
+
+class spell_mark_of_kazrogal : public SpellScriptLoader
+{
+ public:
+ spell_mark_of_kazrogal() : SpellScriptLoader("spell_mark_of_kazrogal") { }
+
+ class spell_mark_of_kazrogal_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mark_of_kazrogal_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(MarkTargetFilter());
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ class spell_mark_of_kazrogal_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_mark_of_kazrogal_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MARK_DAMAGE))
+ return false;
+ return true;
+ }
+
+ void OnPeriodic(AuraEffect const* aurEff)
+ {
+ Unit* target = GetTarget();
+
+ if (target->GetPower(POWER_MANA) == 0)
+ {
+ target->CastSpell(target, SPELL_MARK_DAMAGE, true, NULL, aurEff);
+ // Remove aura
+ SetDuration(0);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazrogal_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_mark_of_kazrogal_SpellScript();
+ }
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_mark_of_kazrogal_AuraScript();
+ }
+};
+
void AddSC_boss_kazrogal()
{
new boss_kazrogal();
+ new spell_mark_of_kazrogal();
}
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 5d7ee1fe194..09c8c1605b3 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -15,36 +15,27 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
-#define SPELL_FROST_ARMOR 31256
-#define SPELL_DEATH_AND_DECAY 31258
-
-#define SPELL_FROST_NOVA 31250
-#define SPELL_ICEBOLT 31249
-
-#define SAY_ONDEATH "You have won this battle, but not... the... war"
-#define SOUND_ONDEATH 11026
-
-#define SAY_ONSLAY1 "All life must perish!"
-#define SAY_ONSLAY2 "Victory to the Legion!"
-#define SOUND_ONSLAY1 11025
-#define SOUND_ONSLAY2 11057
-
-#define SAY_DECAY1 "Crumble and rot!"
-#define SAY_DECAY2 "Ashes to ashes, dust to dust"
-#define SOUND_DECAY1 11023
-#define SOUND_DECAY2 11055
-
-#define SAY_NOVA1 "Succumb to the icy chill... of death!"
-#define SAY_NOVA2 "It will be much colder in your grave"
-#define SOUND_NOVA1 11024
-#define SOUND_NOVA2 11058
+enum Spells
+{
+ SPELL_FROST_ARMOR = 31256,
+ SPELL_DEATH_AND_DECAY = 31258,
+ SPELL_FROST_NOVA = 31250,
+ SPELL_ICEBOLT = 31249,
+};
-#define SAY_ONAGGRO "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!"
-#define SOUND_ONAGGRO 11022
+enum Texts
+{
+ SAY_ONDEATH = 0,
+ SAY_ONSLAY = 1,
+ SAY_DECAY = 2,
+ SAY_NOVA = 3,
+ SAY_ONAGGRO = 4,
+};
class boss_rage_winterchill : public CreatureScript
{
@@ -86,23 +77,12 @@ public:
{
if (instance && IsEvent)
instance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS);
- DoPlaySoundToSet(me, SOUND_ONAGGRO);
- me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0);
+ Talk(SAY_ONAGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- switch (urand(0, 1))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_ONSLAY1);
- me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_ONSLAY2);
- me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_ONSLAY);
}
void WaypointReached(uint32 waypointId)
@@ -120,8 +100,7 @@ public:
hyjal_trashAI::JustDied(killer);
if (instance && IsEvent)
instance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE);
- DoPlaySoundToSet(me, SOUND_ONDEATH);
- me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0);
+ Talk(SAY_ONDEATH);
}
void UpdateAI(const uint32 diff)
@@ -162,33 +141,13 @@ public:
{
DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY);
DecayTimer = 60000+rand()%20000;
- switch (urand(0, 1))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_DECAY1);
- me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_DECAY2);
- me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_DECAY);
} else DecayTimer -= diff;
if (NovaTimer <= diff)
{
DoCast(me->getVictim(), SPELL_FROST_NOVA);
NovaTimer = 30000+rand()%15000;
- switch (urand(0, 1))
- {
- case 0:
- DoPlaySoundToSet(me, SOUND_NOVA1);
- me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, 0);
- break;
- case 1:
- DoPlaySoundToSet(me, SOUND_NOVA2);
- me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, 0);
- break;
- }
+ Talk(SAY_NOVA);
} else NovaTimer -= diff;
if (IceboltTimer <= diff)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index 28457b3b461..5b6dc784113 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -29,7 +29,9 @@ npc_thrall
npc_tyrande_whisperwind
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "hyjalAI.h"
#define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore."
@@ -69,7 +71,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF:
ai->Debug = !ai->Debug;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI - Debug mode has been toggled");
+ sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled");
break;
}
return true;
@@ -146,7 +148,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF:
ai->Debug = !ai->Debug;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI - Debug mode has been toggled");
+ sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled");
break;
}
return true;
@@ -226,7 +228,6 @@ public:
player->SendNewItem(item, 1, true, false, true);
}
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
- CAST_AI(hyjalAI, creature->AI());
}
return true;
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
index e045d3cbf05..6d62072608d 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
@@ -21,7 +21,7 @@
#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy."
-enum eTypes
+enum Types
{
WORLD_STATE_WAVES = 2842,
WORLD_STATE_ENEMY = 2453,
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index 2f6bbb7edb5..aa41fa992dc 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -23,17 +23,22 @@ SDComment:
SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedEscortAI.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "hyjalAI.h"
#include "hyjal_trash.h"
-#include "MapManager.h"
-#include "Language.h"
-#include "Chat.h"
-#include "Object.h"
-#define SPAWN_GARG_GATE 0
-#define SPAWN_WYRM_GATE 1
-#define SPAWN_NEAR_TOWER 2
+enum Spawns
+{
+ SPAWN_GARG_GATE = 0,
+ SPAWN_WYRM_GATE = 1,
+ SPAWN_NEAR_TOWER = 2,
+};
#define YELL_HURRY "Hurry, we don't have much time"
@@ -402,7 +407,7 @@ void hyjalAI::Reset()
instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
instance->SetData(DATA_RESET_TRASH_COUNT, 0);
}
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
//Visibility
DoHide = true;
@@ -535,7 +540,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3]
if (!instance)
{
- sLog->outError(ERROR_INST_DATA);
+ sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
return;
}
InfernalCount = 0;//reset infernal count every new wave
@@ -565,7 +570,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3]
else
{
NextWaveTimer = 15000;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
+ sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
}
}
else
@@ -609,7 +614,7 @@ uint32 hyjalAI::GetInstanceData(uint32 Event)
{
if (instance)
return instance->GetData(Event);
- else sLog->outError(ERROR_INST_DATA);
+ else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
return 0;
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
index b32288ca43a..68efa94d98b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
@@ -24,43 +24,49 @@
#define HYJAL_AI_MAX_SPELLS 3
-// Trash Mobs summoned in waves
-#define NECROMANCER 17899//done
-#define ABOMINATION 17898//done
-#define GHOUL 17895//done
-#define BANSHEE 17905//done
-#define CRYPT_FIEND 17897//done
-#define GARGOYLE 17906//done
-#define FROST_WYRM 17907//done
-#define GIANT_INFERNAL 17908//done
-#define FEL_STALKER 17916//done
-
-#define JAINA 17772
-#define THRALL 17852
-#define TYRANDE 17948
-
-#define ANCIENT_VEIN 185557
-#define FLAMEOBJECT 182592
-
-// Bosses summoned after every 8 waves
-#define RAGE_WINTERCHILL 17767
-#define ANETHERON 17808
-#define KAZROGAL 17888
-#define AZGALOR 17842
-#define ARCHIMONDE 17968
-
-#define SPELL_TELEPORT_VISUAL 41232
-#define SPELL_MASS_TELEPORT 16807
-
-//Spells for Jaina
-#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon(it should, but is removed in evade..)
-#define SPELL_BLIZZARD 31266
-#define SPELL_PYROBLAST 31263
-#define SPELL_SUMMON_ELEMENTALS 31264
-
-//Thrall spells
-#define SPELL_CHAIN_LIGHTNING 31330
-#define SPELL_SUMMON_DIRE_WOLF 31331
+enum CreaturesIds
+{
+ // Trash Mobs summoned in waves
+ NECROMANCER = 17899,
+ ABOMINATION = 17898,
+ GHOUL = 17895,
+ BANSHEE = 17905,
+ CRYPT_FIEND = 17897,
+ GARGOYLE = 17906,
+ FROST_WYRM = 17907,
+ GIANT_INFERNAL = 17908,
+ FEL_STALKER = 17916,
+
+ JAINA = 17772,
+ THRALL = 17852,
+ TYRANDE = 17948,
+
+ ANCIENT_VEIN = 185557,
+ FLAMEOBJECT = 182592,
+
+ // Bosses summoned after every 8 waves
+ RAGE_WINTERCHILL = 17767,
+ ANETHERON = 17808,
+ KAZROGAL = 17888,
+ AZGALOR = 17842,
+ ARCHIMONDE = 17968,
+};
+
+enum SpellIds
+{
+ SPELL_TELEPORT_VISUAL = 41232,
+ SPELL_MASS_TELEPORT = 16807,
+
+ //Spells for Jaina
+ SPELL_BRILLIANCE_AURA = 31260, // The database must handle this spell via creature_addon(it should, but is removed in evade..)
+ SPELL_BLIZZARD = 31266,
+ SPELL_PYROBLAST = 31263,
+ SPELL_SUMMON_ELEMENTALS = 31264,
+
+ //Thrall spells
+ SPELL_CHAIN_LIGHTNING = 31330,
+ SPELL_SUMMON_DIRE_WOLF = 31331,
+};
struct Wave
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 840aa5de081..01c1617aba4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -15,16 +15,35 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "hyjal.h"
#include "hyjal_trash.h"
#include "hyjalAI.h"
-#define SPELL_METEOR 33814 //infernal visual
-#define SPELL_IMMOLATION 37059
-#define SPELL_FLAME_BUFFET 31724
-#define NPC_TRIGGER 21987 //World Trigger (Tiny)
-#define MODEL_INVIS 11686 //invisible model
+enum Spells
+{
+ SPELL_METEOR = 33814, //infernal visual
+ SPELL_IMMOLATION = 37059,
+ SPELL_FLAME_BUFFET = 31724,
+ NPC_TRIGGER = 21987, //World Trigger (Tiny)
+ MODEL_INVIS = 11686, //invisible model
+ SPELL_DISEASE_CLOUD = 31607,
+ SPELL_KNOCKDOWN = 31610,
+ SPELL_FRENZY = 31540,
+ SPELL_RAISE_DEAD_1 = 31617,
+ SPELL_RAISE_DEAD_2 = 31624,
+ SPELL_RAISE_DEAD_3 = 31625,
+ SPELL_SHADOW_BOLT = 31627,
+ SPELL_BANSHEE_CURSE = 31651,
+ SPELL_BANSHEE_WAIL = 38183,
+ SPELL_ANTI_MAGIC_SHELL = 31662,
+ SPELL_WEB = 28991,
+ SPELL_MANA_BURN = 31729,
+ SPELL_FROST_BREATH = 31688,
+ SPELL_GARGOYLE_STRIKE = 31664,
+ SPELL_EXPLODING_SHOT = 7896,
+};
float HordeWPs[8][3]=//basic waypoints from spawn to leader
{
@@ -522,9 +541,6 @@ public:
}
};
-#define SPELL_DISEASE_CLOUD 31607
-#define SPELL_KNOCKDOWN 31610
-
class mob_abomination : public CreatureScript
{
public:
@@ -623,8 +639,6 @@ public:
};
-#define SPELL_FRENZY 31540
-
class mob_ghoul : public CreatureScript
{
public:
@@ -727,11 +741,6 @@ public:
};
-#define SPELL_RAISE_DEAD_1 31617
-#define SPELL_RAISE_DEAD_2 31624
-#define SPELL_RAISE_DEAD_3 31625
-#define SPELL_SHADOW_BOLT 31627
-
class mob_necromancer : public CreatureScript
{
public:
@@ -859,10 +868,6 @@ public:
};
-#define SPELL_BANSHEE_CURSE 31651
-#define SPELL_BANSHEE_WAIL 38183
-#define SPELL_ANTI_MAGIC_SHELL 31662
-
class mob_banshee : public CreatureScript
{
public:
@@ -966,8 +971,6 @@ public:
};
-#define SPELL_WEB 28991
-
class mob_crypt_fiend : public CreatureScript
{
public:
@@ -1058,8 +1061,6 @@ public:
};
-#define SPELL_MANA_BURN 31729
-
class mob_fel_stalker : public CreatureScript
{
public:
@@ -1150,8 +1151,6 @@ public:
};
-#define SPELL_FROST_BREATH 31688
-
class mob_frost_wyrm : public CreatureScript
{
public:
@@ -1264,8 +1263,6 @@ public:
};
-#define SPELL_GARGOYLE_STRIKE 31664
-
class mob_gargoyle : public CreatureScript
{
public:
@@ -1402,8 +1399,6 @@ public:
};
-#define SPELL_EXPLODING_SHOT 7896
-
class alliance_rifleman : public CreatureScript
{
public:
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
index ad8ebdb370a..caff71c7320 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -23,15 +23,16 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
-#include "ScriptPCH.h"
-#include "hyjal.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "ScriptedCreature.h"
#include "hyjal_trash.h"
-enum eEnums
+enum Misc
{
MAX_ENCOUNTER = 5,
- GO_ANCIENT_GEM = 185557
+ GO_ANCIENT_GEM = 185557,
};
/* Battle of Mount Hyjal encounters:
0 - Rage Winterchill event
@@ -272,7 +273,7 @@ public:
break;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data);
if (data == DONE)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
index b2853f25a33..7b468cb7fe5 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: Intro, consecutive attacks to a random target durin time wrap,
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
index ccf60f9bd0b..56d07a49dc4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
index a038a06f815..88b2a766671 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: Intro & outro
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
@@ -35,6 +36,7 @@ enum Spells
SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target.
H_SPELL_SLEEP = 58849,
SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack.
+ SPELL_MAL_GANIS_KILL_CREDIT = 58124, // Quest credit
SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc
};
@@ -237,9 +239,9 @@ public:
if (instance)
{
instance->SetData(DATA_MAL_GANIS_EVENT, DONE);
-
+ DoCastAOE(SPELL_MAL_GANIS_KILL_CREDIT);
// give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc
- DoCast(me, SPELL_KILL_CREDIT);
+ DoCastAOE(SPELL_KILL_CREDIT);
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
index d5dd597960f..8e80af66379 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
@@ -23,7 +23,8 @@ SDComment: It may need timer adjustment
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
index 7828d172e1e..d23957ddf81 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: Intro
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
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 6454083e424..e74ba833908 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -15,9 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "culling_of_stratholme.h"
#include "ScriptedEscortAI.h"
+#include "PassiveAI.h"
enum Says
{
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 b232cae4657..ea02e8f50b5 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
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "CreatureTextMgr.h"
#include "culling_of_stratholme.h"
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
index 5b47c2ee07d..161ea4ba8b7 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
@@ -23,7 +23,8 @@ SDComment: Some spells not implemented
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "dark_portal.h"
enum eEnums
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp
index a4e805b3b75..8fc7f31e766 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp
@@ -23,7 +23,8 @@ SDComment: All abilities not implemented
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "dark_portal.h"
enum eEnums
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
index f59c9f0ef4c..0256a099580 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
@@ -23,7 +23,8 @@ SDComment: More abilities need to be implemented
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "dark_portal.h"
enum eEnums
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
index c2a41cb29d1..ee8c4d1bae1 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
@@ -29,7 +29,9 @@ npc_time_rift
npc_saat
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "dark_portal.h"
#define SAY_ENTER -1269020 //where does this belong?
@@ -324,7 +326,7 @@ public:
uint32 entry = 0;
entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount];
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry);
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry);
++mRiftWaveCount;
@@ -349,7 +351,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
return;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: not casting anylonger, i need to die.");
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: not casting anylonger, i need to die.");
me->setDeathState(JUST_DIED);
if (instance->GetData(TYPE_RIFT) == IN_PROGRESS)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
index dabf3db13cb..da34eff7b77 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
@@ -23,7 +23,8 @@ SDComment: Quest support: 9836, 10297. Currently in progress.
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "dark_portal.h"
#define MAX_ENCOUNTER 2
@@ -116,9 +117,9 @@ public:
DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0);
}
- bool IsEncounterInProgress()
+ bool IsEncounterInProgress() const
{
- if (GetData(TYPE_MEDIVH) == IN_PROGRESS)
+ if (const_cast<instance_dark_portal_InstanceMapScript*>(this)->GetData(TYPE_MEDIVH) == IN_PROGRESS)
return true;
return false;
@@ -192,7 +193,7 @@ public:
{
if (data == IN_PROGRESS)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Starting event.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Starting event.");
InitWorldState();
m_auiEncounter[1] = IN_PROGRESS;
NextPortal_Timer = 15000;
@@ -201,7 +202,7 @@ public:
if (data == DONE)
{
//this may be completed further out in the post-event
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Event completed.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Event completed.");
Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
@@ -266,7 +267,7 @@ public:
if (entry == RIFT_BOSS)
entry = RandRiftBoss();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Summoning rift boss entry %u.", entry);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Summoning rift boss entry %u.", entry);
Position pos;
me->GetRandomNearPosition(pos, 10.0f);
@@ -277,7 +278,7 @@ public:
if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000))
return summon;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun...");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: What just happened there? No boss, no loot, no fun...");
return NULL;
}
@@ -290,7 +291,7 @@ public:
if (tmp >= CurrentRiftId)
++tmp;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId);
CurrentRiftId = tmp;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
index c27507cdcec..96cfba0007b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
@@ -23,7 +23,8 @@ SDComment: Missing adds, missing waypoints to move up to Thrall once spawned + s
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
#define SAY_ENTER -1560000
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
index 82bd0a9e9be..ab0f10bdfe0 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
@@ -23,7 +23,8 @@ SDComment: Missing spawns pre-event, missing speech to be coordinated with rest
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
#define SAY_ENTER1 -1560013
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
index 45825a81eb2..534c831814e 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
@@ -23,7 +23,8 @@ SDComment: Missing proper code for patrolling area after being spawned. Script f
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
#include "ScriptedEscortAI.h"
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
index b179a15e878..7f7cbeaf566 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
@@ -23,7 +23,9 @@ SDComment: If thrall escort fail, all parts will reset. In future, save sub-part
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "old_hillsbrad.h"
#define MAX_ENCOUNTER 6
@@ -83,7 +85,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -123,7 +125,7 @@ public:
if (!player)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data);
return;
}
@@ -139,7 +141,7 @@ public:
++mBarrelCount;
DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount);
m_auiEncounter[0] = IN_PROGRESS;
@@ -160,7 +162,7 @@ public:
{
++mThrallEventCount;
m_auiEncounter[1] = NOT_STARTED;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
m_auiEncounter[2] = NOT_STARTED;
m_auiEncounter[3] = NOT_STARTED;
m_auiEncounter[4] = NOT_STARTED;
@@ -173,29 +175,29 @@ public:
m_auiEncounter[3] = data;
m_auiEncounter[4] = data;
m_auiEncounter[5] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
}
}
else
m_auiEncounter[1] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data);
break;
}
case TYPE_THRALL_PART1:
m_auiEncounter[2] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data);
break;
case TYPE_THRALL_PART2:
m_auiEncounter[3] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data);
break;
case TYPE_THRALL_PART3:
m_auiEncounter[4] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data);
break;
case TYPE_THRALL_PART4:
m_auiEncounter[5] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data);
break;
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 7d9da6771dc..3690e87354d 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -29,7 +29,9 @@ npc_thrall_old_hillsbrad
npc_taretha
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "old_hillsbrad.h"
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
index d7043965271..b23d15cd1b5 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Maraudon
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -46,15 +47,15 @@ public:
{
celebras_the_cursedAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 Wrath_Timer;
- uint32 EntanglingRoots_Timer;
- uint32 CorruptForces_Timer;
+ uint32 WrathTimer;
+ uint32 EntanglingRootsTimer;
+ uint32 CorruptForcesTimer;
void Reset()
{
- Wrath_Timer = 8000;
- EntanglingRoots_Timer = 2000;
- CorruptForces_Timer = 30000;
+ WrathTimer = 8000;
+ EntanglingRootsTimer = 2000;
+ CorruptForcesTimer = 30000;
}
void EnterCombat(Unit* /*who*/) { }
@@ -70,32 +71,30 @@ public:
return;
//Wrath
- if (Wrath_Timer <= diff)
+ if (WrathTimer <= diff)
{
- Unit* target = NULL;
- target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_WRATH);
- Wrath_Timer = 8000;
+ WrathTimer = 8000;
}
- else Wrath_Timer -= diff;
+ else WrathTimer -= diff;
//EntanglingRoots
- if (EntanglingRoots_Timer <= diff)
+ if (EntanglingRootsTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS);
- EntanglingRoots_Timer = 20000;
+ DoCastVictim(SPELL_ENTANGLINGROOTS);
+ EntanglingRootsTimer = 20000;
}
- else EntanglingRoots_Timer -= diff;
+ else EntanglingRootsTimer -= diff;
//CorruptForces
- if (CorruptForces_Timer <= diff)
+ if (CorruptForcesTimer <= diff)
{
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_CORRUPT_FORCES);
- CorruptForces_Timer = 20000;
+ CorruptForcesTimer = 20000;
}
- else CorruptForces_Timer -= diff;
+ else CorruptForcesTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
index ea419793ae8..b4128ea80ee 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Maraudon
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -46,15 +47,15 @@ public:
{
boss_landslideAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 KnockAway_Timer;
- uint32 Trample_Timer;
- uint32 Landslide_Timer;
+ uint32 KnockAwayTimer;
+ uint32 TrampleTimer;
+ uint32 LandslideTimer;
void Reset()
{
- KnockAway_Timer = 8000;
- Trample_Timer = 2000;
- Landslide_Timer = 0;
+ KnockAwayTimer = 8000;
+ TrampleTimer = 2000;
+ LandslideTimer = 0;
}
void EnterCombat(Unit* /*who*/)
@@ -66,32 +67,32 @@ public:
if (!UpdateVictim())
return;
- //KnockAway_Timer
- if (KnockAway_Timer <= diff)
+ //KnockAwayTimer
+ if (KnockAwayTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_KNOCKAWAY);
- KnockAway_Timer = 15000;
+ DoCastVictim(SPELL_KNOCKAWAY);
+ KnockAwayTimer = 15000;
}
- else KnockAway_Timer -= diff;
+ else KnockAwayTimer -= diff;
- //Trample_Timer
- if (Trample_Timer <= diff)
+ //TrampleTimer
+ if (TrampleTimer <= diff)
{
DoCast(me, SPELL_TRAMPLE);
- Trample_Timer = 8000;
+ TrampleTimer = 8000;
}
- else Trample_Timer -= diff;
+ else TrampleTimer -= diff;
//Landslide
if (HealthBelowPct(50))
{
- if (Landslide_Timer <= diff)
+ if (LandslideTimer <= diff)
{
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_LANDSLIDE);
- Landslide_Timer = 60000;
+ LandslideTimer = 60000;
}
- else Landslide_Timer -= diff;
+ else LandslideTimer -= diff;
}
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
index 18ce7be0f0a..ece3ff83776 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory: Maraudon
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+
enum Spells
{
SPELL_TOXICVOLLEY = 21687,
@@ -44,24 +46,22 @@ public:
{
boss_noxxionAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 ToxicVolley_Timer;
- uint32 Uppercut_Timer;
- uint32 Adds_Timer;
- uint32 Invisible_Timer;
+ uint32 ToxicVolleyTimer;
+ uint32 UppercutTimer;
+ uint32 AddsTimer;
+ uint32 InvisibleTimer;
bool Invisible;
void Reset()
{
- ToxicVolley_Timer = 7000;
- Uppercut_Timer = 16000;
- Adds_Timer = 19000;
- Invisible_Timer = 15000; //Too much too low?
+ ToxicVolleyTimer = 7000;
+ UppercutTimer = 16000;
+ AddsTimer = 19000;
+ InvisibleTimer = 15000; //Too much too low?
Invisible = false;
}
- void EnterCombat(Unit* /*who*/)
- {
- }
+ void EnterCombat(Unit* /*who*/) {}
void SummonAdds(Unit* victim)
{
@@ -71,7 +71,7 @@ public:
void UpdateAI(const uint32 diff)
{
- if (Invisible && Invisible_Timer <= diff)
+ if (Invisible && InvisibleTimer <= diff)
{
//Become visible again
me->setFaction(14);
@@ -83,7 +83,7 @@ public:
}
else if (Invisible)
{
- Invisible_Timer -= diff;
+ InvisibleTimer -= diff;
//Do nothing while invisible
return;
}
@@ -92,24 +92,24 @@ public:
if (!UpdateVictim())
return;
- //ToxicVolley_Timer
- if (ToxicVolley_Timer <= diff)
+ //ToxicVolleyTimer
+ if (ToxicVolleyTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_TOXICVOLLEY);
- ToxicVolley_Timer = 9000;
+ DoCastVictim(SPELL_TOXICVOLLEY);
+ ToxicVolleyTimer = 9000;
}
- else ToxicVolley_Timer -= diff;
+ else ToxicVolleyTimer -= diff;
- //Uppercut_Timer
- if (Uppercut_Timer <= diff)
+ //UppercutTimer
+ if (UppercutTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_UPPERCUT);
- Uppercut_Timer = 12000;
+ DoCastVictim(SPELL_UPPERCUT);
+ UppercutTimer = 12000;
}
- else Uppercut_Timer -= diff;
+ else UppercutTimer -= diff;
- //Adds_Timer
- if (!Invisible && Adds_Timer <= diff)
+ //AddsTimer
+ if (!Invisible && AddsTimer <= diff)
{
//Interrupt any spell casting
//me->m_canMove = true;
@@ -124,11 +124,11 @@ public:
SummonAdds(me->getVictim());
SummonAdds(me->getVictim());
Invisible = true;
- Invisible_Timer = 15000;
+ InvisibleTimer = 15000;
- Adds_Timer = 40000;
+ AddsTimer = 40000;
}
- else Adds_Timer -= diff;
+ else AddsTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
index 039d30071d2..26e1f77bf48 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory: Maraudon
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -47,17 +49,17 @@ public:
{
boss_ptheradrasAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 Dustfield_Timer;
- uint32 Boulder_Timer;
- uint32 Thrash_Timer;
- uint32 RepulsiveGaze_Timer;
+ uint32 DustfieldTimer;
+ uint32 BoulderTimer;
+ uint32 ThrashTimer;
+ uint32 RepulsiveGazeTimer;
void Reset()
{
- Dustfield_Timer = 8000;
- Boulder_Timer = 2000;
- Thrash_Timer = 5000;
- RepulsiveGaze_Timer = 23000;
+ DustfieldTimer = 8000;
+ BoulderTimer = 2000;
+ ThrashTimer = 5000;
+ RepulsiveGazeTimer = 23000;
}
void EnterCombat(Unit* /*who*/) {}
@@ -72,40 +74,38 @@ public:
if (!UpdateVictim())
return;
- //Dustfield_Timer
- if (Dustfield_Timer <= diff)
+ //DustfieldTimer
+ if (DustfieldTimer <= diff)
{
DoCast(me, SPELL_DUSTFIELD);
- Dustfield_Timer = 14000;
+ DustfieldTimer = 14000;
}
- else Dustfield_Timer -= diff;
+ else DustfieldTimer -= diff;
- //Boulder_Timer
- if (Boulder_Timer <= diff)
+ //BoulderTimer
+ if (BoulderTimer <= diff)
{
- Unit* target = NULL;
- target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_BOULDER);
- Boulder_Timer = 10000;
+ BoulderTimer = 10000;
}
- else Boulder_Timer -= diff;
+ else BoulderTimer -= diff;
- //RepulsiveGaze_Timer
- if (RepulsiveGaze_Timer <= diff)
+ //RepulsiveGazeTimer
+ if (RepulsiveGazeTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_REPULSIVEGAZE);
- RepulsiveGaze_Timer = 20000;
+ DoCastVictim(SPELL_REPULSIVEGAZE);
+ RepulsiveGazeTimer = 20000;
}
- else RepulsiveGaze_Timer -= diff;
+ else RepulsiveGazeTimer -= diff;
- //Thrash_Timer
- if (Thrash_Timer <= diff)
+ //ThrashTimer
+ if (ThrashTimer <= diff)
{
DoCast(me, SPELL_THRASH);
- Thrash_Timer = 18000;
+ ThrashTimer = 18000;
}
- else Thrash_Timer -= diff;
+ else ThrashTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 6e6e089ba02..c243682cc61 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -25,19 +25,27 @@ SDComment: <Known bugs>
SDCategory: Onyxia's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
#include "onyxias_lair.h"
-enum eYells
+enum Yells
{
- SAY_AGGRO = -1249000,
- SAY_KILL = -1249001,
- SAY_PHASE_2_TRANS = -1249002,
- SAY_PHASE_3_TRANS = -1249003,
- EMOTE_BREATH = -1249004,
+ // Say
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_PHASE_2_TRANS = 2,
+ SAY_PHASE_3_TRANS = 3,
+
+ // Emote
+ EMOTE_BREATH = 4,
};
-enum eSpells
+enum Spells
{
// Phase 1 spells
SPELL_WING_BUFFET = 18500,
@@ -67,15 +75,15 @@ enum eSpells
SPELL_BELLOWING_ROAR = 18431,
};
-struct sOnyxMove
+struct OnyxMove
{
- uint32 uiLocId;
- uint32 uiLocIdEnd;
- uint32 uiSpellId;
+ uint8 LocId;
+ uint8 LocIdEnd;
+ uint32 SpellId;
float fX, fY, fZ;
};
-static sOnyxMove aMoveData[]=
+static OnyxMove MoveData[8]=
{
{0, 1, SPELL_BREATH_WEST_TO_EAST, -33.5561f, -182.682f, -56.9457f}, //west
{1, 0, SPELL_BREATH_EAST_TO_WEST, -31.4963f, -250.123f, -55.1278f}, //east
@@ -87,11 +95,11 @@ static sOnyxMove aMoveData[]=
{7, 6, SPELL_BREATH_NORTH_TO_SOUTH, 22.8763f, -217.152f, -55.0548f}, //north
};
-const Position MiddleRoomLocation = {-23.6155f, -215.357f, -55.7344f, 0.0f};
+Position const MiddleRoomLocation = {-23.6155f, -215.357f, -55.7344f, 0.0f};
-const Position Phase2Location = {-80.924f, -214.299f, -82.942f, 0.0f};
+Position const Phase2Location = {-80.924f, -214.299f, -82.942f, 0.0f};
-static Position aSpawnLocations[3]=
+Position const SpawnLocations[3]=
{
//Whelps
{-30.127f, -254.463f, -89.440f, 0.0f},
@@ -121,65 +129,65 @@ public:
InstanceScript* instance;
SummonList Summons;
- uint32 m_uiPhase;
+ uint32 Phase;
- uint32 m_uiFlameBreathTimer;
- uint32 m_uiCleaveTimer;
- uint32 m_uiTailSweepTimer;
- uint32 m_uiWingBuffetTimer;
+ uint32 FlameBreathTimer;
+ uint32 CleaveTimer;
+ uint32 TailSweepTimer;
+ uint32 WingBuffetTimer;
- uint32 m_uiMovePoint;
- uint32 m_uiMovementTimer;
- sOnyxMove* m_pPointData;
+ uint8 MovePoint;
+ uint32 MovementTimer;
+ OnyxMove* PointData;
- uint32 m_uiFireballTimer;
- uint32 m_uiWhelpTimer;
- uint32 m_uiLairGuardTimer;
- uint32 m_uiDeepBreathTimer;
+ uint32 FireballTimer;
+ uint32 WhelpTimer;
+ uint32 LairGuardTimer;
+ uint32 DeepBreathTimer;
- uint32 m_uiBellowingRoarTimer;
+ uint32 BellowingRoarTimer;
- uint8 m_uiSummonWhelpCount;
- bool m_bIsMoving;
+ uint8 SummonWhelpCount;
+ bool IsMoving;
void Reset()
{
if (!IsCombatMovementAllowed())
SetCombatMovement(true);
- m_uiPhase = PHASE_START;
+ Phase = PHASE_START;
- m_uiFlameBreathTimer = urand(10000, 20000);
- m_uiTailSweepTimer = urand(15000, 20000);
- m_uiCleaveTimer = urand(2000, 5000);
- m_uiWingBuffetTimer = urand(10000, 20000);
+ FlameBreathTimer = urand(10000, 20000);
+ TailSweepTimer = urand(15000, 20000);
+ CleaveTimer = urand(2000, 5000);
+ WingBuffetTimer = urand(10000, 20000);
- m_uiMovePoint = urand(0, 5);
- m_uiMovementTimer = 14000;
- m_pPointData = GetMoveData();
+ MovePoint = urand(0, 5);
+ MovementTimer = 14000;
+ PointData = GetMoveData();
- m_uiFireballTimer = 15000;
- m_uiWhelpTimer = 60000;
- m_uiLairGuardTimer = 60000;
- m_uiDeepBreathTimer = 85000;
+ FireballTimer = 15000;
+ WhelpTimer = 60000;
+ LairGuardTimer = 60000;
+ DeepBreathTimer = 85000;
- m_uiBellowingRoarTimer = 30000;
+ BellowingRoarTimer = 30000;
Summons.DespawnAll();
- m_uiSummonWhelpCount = 0;
- m_bIsMoving = false;
+ SummonWhelpCount = 0;
+ IsMoving = false;
if (instance)
{
instance->SetData(DATA_ONYXIA, NOT_STARTED);
- instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase);
+ instance->SetData(DATA_ONYXIA_PHASE, Phase);
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->SetInCombatWithZone();
if (instance)
@@ -206,7 +214,7 @@ public:
switch (summoned->GetEntry())
{
case NPC_WHELP:
- ++m_uiSummonWhelpCount;
+ ++SummonWhelpCount;
break;
case NPC_LAIRGUARD:
summoned->setActive(true);
@@ -222,20 +230,20 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
- void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell)
{
- if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST ||
- pSpell->Id == SPELL_BREATH_WEST_TO_EAST ||
- pSpell->Id == SPELL_BREATH_SE_TO_NW ||
- pSpell->Id == SPELL_BREATH_NW_TO_SE ||
- pSpell->Id == SPELL_BREATH_SW_TO_NE ||
- pSpell->Id == SPELL_BREATH_NE_TO_SW)
+ if (Spell->Id == SPELL_BREATH_EAST_TO_WEST ||
+ Spell->Id == SPELL_BREATH_WEST_TO_EAST ||
+ Spell->Id == SPELL_BREATH_SE_TO_NW ||
+ Spell->Id == SPELL_BREATH_NW_TO_SE ||
+ Spell->Id == SPELL_BREATH_SW_TO_NE ||
+ Spell->Id == SPELL_BREATH_NE_TO_SW)
{
- m_pPointData = GetMoveData();
- m_uiMovePoint = m_pPointData->uiLocIdEnd;
+ PointData = GetMoveData();
+ MovePoint = PointData->LocIdEnd;
me->SetSpeed(MOVE_FLIGHT, 1.5f);
me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation);
@@ -249,56 +257,56 @@ public:
switch (id)
{
case 8:
- m_pPointData = GetMoveData();
- if (m_pPointData)
+ PointData = GetMoveData();
+ if (PointData)
{
me->SetSpeed(MOVE_FLIGHT, 1.0f);
- me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ);
+ me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ);
}
break;
case 9:
me->GetMotionMaster()->MoveChase(me->getVictim());
- m_uiBellowingRoarTimer = 1000;
+ BellowingRoarTimer = 1000;
break;
case 10:
me->SetCanFly(true);
me->GetMotionMaster()->MovePoint(11, Phase2Location.GetPositionX(), Phase2Location.GetPositionY(), Phase2Location.GetPositionZ()+25);
me->SetSpeed(MOVE_FLIGHT, 1.0f);
- DoScriptText(SAY_PHASE_2_TRANS, me);
+ Talk(SAY_PHASE_2_TRANS);
if (instance)
- instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase);
- m_uiWhelpTimer = 5000;
- m_uiLairGuardTimer = 15000;
+ instance->SetData(DATA_ONYXIA_PHASE, Phase);
+ WhelpTimer = 5000;
+ LairGuardTimer = 15000;
break;
case 11:
- if (m_pPointData)
- me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ);
+ if (PointData)
+ me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ);
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveIdle();
break;
default:
- m_bIsMoving = false;
+ IsMoving = false;
break;
}
}
}
- void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
+ void SpellHitTarget(Unit* target, const SpellInfo* Spell)
{
//Workaround - Couldn't find a way to group this spells (All Eruption)
- if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) ||
- (pSpell->Id == 17097) ||
- (pSpell->Id >= 18351 && pSpell->Id <= 18361) ||
- (pSpell->Id >= 18564 && pSpell->Id <= 18576) ||
- (pSpell->Id >= 18578 && pSpell->Id <= 18607) ||
- (pSpell->Id == 18609) ||
- (pSpell->Id >= 18611 && pSpell->Id <= 18628) ||
- (pSpell->Id >= 21132 && pSpell->Id <= 21133) ||
- (pSpell->Id >= 21135 && pSpell->Id <= 21139) ||
- (pSpell->Id >= 22191 && pSpell->Id <= 22202) ||
- (pSpell->Id >= 22267 && pSpell->Id <= 22268)) &&
+ if (((Spell->Id >= 17086 && Spell->Id <= 17095) ||
+ (Spell->Id == 17097) ||
+ (Spell->Id >= 18351 && Spell->Id <= 18361) ||
+ (Spell->Id >= 18564 && Spell->Id <= 18576) ||
+ (Spell->Id >= 18578 && Spell->Id <= 18607) ||
+ (Spell->Id == 18609) ||
+ (Spell->Id >= 18611 && Spell->Id <= 18628) ||
+ (Spell->Id >= 21132 && Spell->Id <= 21133) ||
+ (Spell->Id >= 21135 && Spell->Id <= 21139) ||
+ (Spell->Id >= 22191 && Spell->Id <= 22202) ||
+ (Spell->Id >= 22267 && Spell->Id <= 22268)) &&
(target->GetTypeId() == TYPEID_PLAYER))
{
if (instance)
@@ -308,14 +316,14 @@ public:
}
}
- sOnyxMove* GetMoveData()
+ OnyxMove* GetMoveData()
{
- uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove);
+ uint8 MaxCount = sizeof(MoveData)/sizeof(OnyxMove);
- for (uint32 i = 0; i < uiMaxCount; ++i)
+ for (uint8 i = 0; i < MaxCount; ++i)
{
- if (aMoveData[i].uiLocId == m_uiMovePoint)
- return &aMoveData[i];
+ if (MoveData[i].LocId == MovePoint)
+ return &MoveData[i];
}
return NULL;
@@ -323,84 +331,84 @@ public:
void SetNextRandomPoint()
{
- uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove);
+ uint8 MaxCount = sizeof(MoveData)/sizeof(OnyxMove);
- uint32 iTemp = rand()%(uiMaxCount-1);
+ uint8 iTemp = urand(0, MaxCount-1);
- if (iTemp >= m_uiMovePoint)
+ if (iTemp >= MovePoint)
++iTemp;
- m_uiMovePoint = iTemp;
+ MovePoint = iTemp;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 Diff)
{
if (!UpdateVictim())
return;
//Common to PHASE_START && PHASE_END
- if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END)
+ if (Phase == PHASE_START || Phase == PHASE_END)
{
//Specific to PHASE_START || PHASE_END
- if (m_uiPhase == PHASE_START)
+ if (Phase == PHASE_START)
{
if (HealthBelowPct(60))
{
SetCombatMovement(false);
- m_uiPhase = PHASE_BREATH;
+ Phase = PHASE_BREATH;
me->GetMotionMaster()->MovePoint(10, Phase2Location);
return;
}
}
else
{
- if (m_uiBellowingRoarTimer <= uiDiff)
+ if (BellowingRoarTimer <= Diff)
{
DoCastVictim(SPELL_BELLOWING_ROAR);
// Eruption
- GameObject* pFloor = NULL;
+ GameObject* Floor = NULL;
Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15);
- Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check);
+ Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check);
me->VisitNearbyGridObject(30, searcher);
- if (instance && pFloor)
- instance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID());
- m_uiBellowingRoarTimer = 30000;
+ if (instance && Floor)
+ instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID());
+ BellowingRoarTimer = 30000;
}
else
- m_uiBellowingRoarTimer -= uiDiff;
+ BellowingRoarTimer -= Diff;
}
- if (m_uiFlameBreathTimer <= uiDiff)
+ if (FlameBreathTimer <= Diff)
{
DoCastVictim(SPELL_FLAME_BREATH);
- m_uiFlameBreathTimer = urand(10000, 20000);
+ FlameBreathTimer = urand(10000, 20000);
}
else
- m_uiFlameBreathTimer -= uiDiff;
+ FlameBreathTimer -= Diff;
- if (m_uiTailSweepTimer <= uiDiff)
+ if (TailSweepTimer <= Diff)
{
DoCastAOE(SPELL_TAIL_SWEEP);
- m_uiTailSweepTimer = urand(15000, 20000);
+ TailSweepTimer = urand(15000, 20000);
}
else
- m_uiTailSweepTimer -= uiDiff;
+ TailSweepTimer -= Diff;
- if (m_uiCleaveTimer <= uiDiff)
+ if (CleaveTimer <= Diff)
{
DoCastVictim(SPELL_CLEAVE);
- m_uiCleaveTimer = urand(2000, 5000);
+ CleaveTimer = urand(2000, 5000);
}
else
- m_uiCleaveTimer -= uiDiff;
+ CleaveTimer -= Diff;
- if (m_uiWingBuffetTimer <= uiDiff)
+ if (WingBuffetTimer <= Diff)
{
DoCastVictim(SPELL_WING_BUFFET);
- m_uiWingBuffetTimer = urand(15000, 30000);
+ WingBuffetTimer = urand(15000, 30000);
}
else
- m_uiWingBuffetTimer -= uiDiff;
+ WingBuffetTimer -= Diff;
DoMeleeAttackIfReady();
}
@@ -408,86 +416,86 @@ public:
{
if (HealthBelowPct(40))
{
- m_uiPhase = PHASE_END;
+ Phase = PHASE_END;
if (instance)
- instance->SetData(DATA_ONYXIA_PHASE, m_uiPhase);
- DoScriptText(SAY_PHASE_3_TRANS, me);
+ instance->SetData(DATA_ONYXIA_PHASE, Phase);
+ Talk(SAY_PHASE_3_TRANS);
SetCombatMovement(true);
me->SetCanFly(false);
- m_bIsMoving = false;
+ IsMoving = false;
me->GetMotionMaster()->MovePoint(9, me->GetHomePosition());
return;
}
- if (m_uiDeepBreathTimer <= uiDiff)
+ if (DeepBreathTimer <= Diff)
{
- if (!m_bIsMoving)
+ if (!IsMoving)
{
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
- DoScriptText(EMOTE_BREATH, me);
- DoCast(me, m_pPointData->uiSpellId);
- m_uiDeepBreathTimer = 70000;
+ Talk(EMOTE_BREATH);
+ DoCast(me, PointData->SpellId);
+ DeepBreathTimer = 70000;
}
}
else
- m_uiDeepBreathTimer -= uiDiff;
+ DeepBreathTimer -= Diff;
- if (m_uiMovementTimer <= uiDiff)
+ if (MovementTimer <= Diff)
{
- if (!m_bIsMoving)
+ if (!IsMoving)
{
SetNextRandomPoint();
- m_pPointData = GetMoveData();
+ PointData = GetMoveData();
- if (!m_pPointData)
+ if (!PointData)
return;
- me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ);
- m_bIsMoving = true;
- m_uiMovementTimer = 25000;
+ me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ);
+ IsMoving = true;
+ MovementTimer = 25000;
}
}
else
- m_uiMovementTimer -= uiDiff;
+ MovementTimer -= Diff;
- if (m_uiFireballTimer <= uiDiff)
+ if (FireballTimer <= Diff)
{
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_FIREBALL);
- m_uiFireballTimer = 8000;
+ FireballTimer = 8000;
}
}
else
- m_uiFireballTimer -= uiDiff;
+ FireballTimer -= Diff;
- if (m_uiLairGuardTimer <= uiDiff)
+ if (LairGuardTimer <= Diff)
{
- me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
- m_uiLairGuardTimer = 30000;
+ me->SummonCreature(NPC_LAIRGUARD, SpawnLocations[2], TEMPSUMMON_CORPSE_DESPAWN);
+ LairGuardTimer = 30000;
}
else
- m_uiLairGuardTimer -= uiDiff;
+ LairGuardTimer -= Diff;
- if (m_uiWhelpTimer <= uiDiff)
+ if (WhelpTimer <= Diff)
{
- me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
- me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
- if (m_uiSummonWhelpCount >= RAID_MODE(20, 40))
+ me->SummonCreature(NPC_WHELP, SpawnLocations[0], TEMPSUMMON_CORPSE_DESPAWN);
+ me->SummonCreature(NPC_WHELP, SpawnLocations[1], TEMPSUMMON_CORPSE_DESPAWN);
+ if (SummonWhelpCount >= RAID_MODE(20, 40))
{
- m_uiSummonWhelpCount = 0;
- m_uiWhelpTimer = 90000;
+ SummonWhelpCount = 0;
+ WhelpTimer = 90000;
}
else
- m_uiWhelpTimer = 500;
+ WhelpTimer = 500;
}
else
- m_uiWhelpTimer -= uiDiff;
+ WhelpTimer -= Diff;
}
}
};
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
index 1c599ce7c6f..0689a8872bb 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
@@ -22,7 +22,12 @@ SDComment:
SDCategory: Onyxia's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
#include "onyxias_lair.h"
class instance_onyxias_lair : public InstanceMapScript
@@ -44,27 +49,27 @@ public:
std::map<uint64, uint32> FloorEruptionGUID[2];
std::queue<uint64> FloorEruptionGUIDQueue;
- uint64 m_uiOnyxiasGUID;
- uint32 m_uiOnyxiaLiftoffTimer;
- uint32 m_uiManyWhelpsCounter;
- uint32 m_uiEruptTimer;
+ uint64 OnyxiasGUID;
+ uint32 OnyxiaLiftoffTimer;
+ uint32 ManyWhelpsCounter;
+ uint32 EruptTimer;
- uint8 m_auiEncounter[MAX_ENCOUNTER];
+ uint8 Encounter[MAX_ENCOUNTER];
- bool m_bAchievManyWhelpsHandleIt;
- bool m_bAchievSheDeepBreathMore;
+ bool AchievManyWhelpsHandleIt;
+ bool AchievSheDeepBreathMore;
void Initialize()
{
- memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
+ memset(&Encounter, 0, sizeof(Encounter));
- m_uiOnyxiasGUID = 0;
- m_uiOnyxiaLiftoffTimer = 0;
- m_uiManyWhelpsCounter = 0;
- m_bAchievManyWhelpsHandleIt = false;
- m_bAchievSheDeepBreathMore = true;
+ OnyxiasGUID = 0;
+ OnyxiaLiftoffTimer = 0;
+ ManyWhelpsCounter = 0;
+ AchievManyWhelpsHandleIt = false;
+ AchievSheDeepBreathMore = true;
- m_uiEruptTimer = 0;
+ EruptTimer = 0;
}
void OnCreatureCreate(Creature* creature)
@@ -72,7 +77,7 @@ public:
switch (creature->GetEntry())
{
case NPC_ONYXIA:
- m_uiOnyxiasGUID = creature->GetGUID();
+ OnyxiasGUID = creature->GetGUID();
break;
}
}
@@ -93,7 +98,7 @@ public:
if (Creature* temp = go->SummonCreature(NPC_WHELP, goPos, TEMPSUMMON_CORPSE_DESPAWN))
{
temp->SetInCombatWithZone();
- ++m_uiManyWhelpsCounter;
+ ++ManyWhelpsCounter;
}
break;
}
@@ -139,88 +144,88 @@ public:
FloorEruptionGUID[1].erase(floorEruptedGUID);
}
- void SetData(uint32 uiType, uint32 uiData)
+ void SetData(uint32 Type, uint32 Data)
{
- switch (uiType)
+ switch (Type)
{
case DATA_ONYXIA:
- m_auiEncounter[0] = uiData;
- if (uiData == IN_PROGRESS)
+ Encounter[0] = Data;
+ if (Data == IN_PROGRESS)
SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS);
break;
case DATA_ONYXIA_PHASE:
- if (uiData == PHASE_BREATH) //Used to mark the liftoff phase
+ if (Data == PHASE_BREATH) //Used to mark the liftoff phase
{
- m_bAchievManyWhelpsHandleIt = false;
- m_uiManyWhelpsCounter = 0;
- m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS;
+ AchievManyWhelpsHandleIt = false;
+ ManyWhelpsCounter = 0;
+ OnyxiaLiftoffTimer = 10*IN_MILLISECONDS;
}
break;
case DATA_SHE_DEEP_BREATH_MORE:
- if (uiData == IN_PROGRESS)
+ if (Data == IN_PROGRESS)
{
- m_bAchievSheDeepBreathMore = true;
+ AchievSheDeepBreathMore = true;
}
- else if (uiData == FAIL)
+ else if (Data == FAIL)
{
- m_bAchievSheDeepBreathMore = false;
+ AchievSheDeepBreathMore = false;
}
break;
}
- if (uiType < MAX_ENCOUNTER && uiData == DONE)
+ if (Type < MAX_ENCOUNTER && Data == DONE)
SaveToDB();
}
- void SetData64(uint32 uiType, uint64 uiData)
+ void SetData64(uint32 Type, uint64 Data)
{
- switch (uiType)
+ switch (Type)
{
case DATA_FLOOR_ERUPTION_GUID:
FloorEruptionGUID[1] = FloorEruptionGUID[0];
- FloorEruptionGUIDQueue.push(uiData);
- m_uiEruptTimer = 2500;
+ FloorEruptionGUIDQueue.push(Data);
+ EruptTimer = 2500;
break;
}
}
- uint32 GetData(uint32 uiType)
+ uint32 GetData(uint32 Type)
{
- switch (uiType)
+ switch (Type)
{
case DATA_ONYXIA:
- return m_auiEncounter[0];
+ return Encounter[0];
}
return 0;
}
- uint64 GetData64(uint32 uiData)
+ uint64 GetData64(uint32 Data)
{
- switch (uiData)
+ switch (Data)
{
case DATA_ONYXIA_GUID:
- return m_uiOnyxiasGUID;
+ return OnyxiasGUID;
}
return 0;
}
- void Update(uint32 uiDiff)
+ void Update(uint32 Diff)
{
if (GetData(DATA_ONYXIA) == IN_PROGRESS)
{
- if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff)
+ if (OnyxiaLiftoffTimer && OnyxiaLiftoffTimer <= Diff)
{
- m_uiOnyxiaLiftoffTimer = 0;
- if (m_uiManyWhelpsCounter >= 50)
- m_bAchievManyWhelpsHandleIt = true;
- } else m_uiOnyxiaLiftoffTimer -= uiDiff;
+ OnyxiaLiftoffTimer = 0;
+ if (ManyWhelpsCounter >= 50)
+ AchievManyWhelpsHandleIt = true;
+ } else OnyxiaLiftoffTimer -= Diff;
}
if (!FloorEruptionGUIDQueue.empty())
{
- if (m_uiEruptTimer <= uiDiff)
+ if (EruptTimer <= Diff)
{
uint32 treeHeight = 0;
do
@@ -229,10 +234,10 @@ public:
FloorEruption(FloorEruptionGUIDQueue.front());
FloorEruptionGUIDQueue.pop();
} while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight);
- m_uiEruptTimer = 1000;
+ EruptTimer = 1000;
}
else
- m_uiEruptTimer -= uiDiff;
+ EruptTimer -= Diff;
}
}
@@ -242,10 +247,10 @@ public:
{
case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s
case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s
- return m_bAchievManyWhelpsHandleIt;
+ return AchievManyWhelpsHandleIt;
case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath
case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath
- return m_bAchievSheDeepBreathMore;
+ return AchievSheDeepBreathMore;
}
return false;
}
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
index eaf6cac43af..26fd9284ea2 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
@@ -18,13 +18,13 @@
#ifndef DEF_ONYXIAS_LAIR_H
#define DEF_ONYXIAS_LAIR_H
-enum eData64
+enum Data64
{
DATA_ONYXIA_GUID,
DATA_FLOOR_ERUPTION_GUID
};
-enum eInstanceData
+enum InstanceData
{
DATA_ONYXIA,
MAX_ENCOUNTER,
@@ -34,7 +34,7 @@ enum eInstanceData
DATA_MANY_WHELPS_COUNT
};
-enum eCreatures
+enum Creatures
{
NPC_WHELP = 11262,
NPC_LAIRGUARD = 36561,
@@ -42,20 +42,20 @@ enum eCreatures
NPC_ONYXIA = 10184
};
-enum eOnyxiaPhases
+enum OnyxiaPhases
{
PHASE_START = 1,
PHASE_BREATH = 2,
PHASE_END = 3
};
-enum eGameObjects
+enum GameObjects
{
GO_WHELP_SPAWNER = 176510,
GO_WHELP_EGG = 176511
};
-enum eAchievementData
+enum AchievementData
{
ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER = 12565, // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s
ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER = 12568, // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
index bda5267713d..44f9aa1184a 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Razorfen Downs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_AGGRO -1129000
#define SAY_SUMMON60 -1129001
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
index 8b138468f4c..a0a8bb02d90 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "razorfen_downs.h"
#define MAX_ENCOUNTER 1
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index b84ecea4de3..3a147007fce 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_henry_stern
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "razorfen_downs.h"
/*###
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index 98395305d57..cce0f8b180e 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Razorfen Kraul
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "razorfen_kraul.h"
#define WARD_KEEPERS_NR 2
@@ -63,7 +64,7 @@ public:
return player;
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 43e3fe6efdd..374059c46ac 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -27,7 +27,8 @@ EndScriptData */
npc_willix
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "razorfen_kraul.h"
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
index 459dc87a9b8..40d4d5d54b4 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
@@ -23,7 +23,8 @@ SDComment: Place Holder
SDCategory: Ruins of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
enum Yells
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
index 18a77519ba2..c05613d387f 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
enum Texts
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
index 91c0110abd5..e9bb8be67b7 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -23,7 +23,8 @@ SDComment: Place holder
SDCategory: Ruins of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
enum Yells
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
index d4549242a4c..2dbd52f7e42 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ruins_of_ahnqiraj.h"
class instance_ruins_of_ahnqiraj : public InstanceMapScript
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
index 36b1871c96e..0b78b5f9ab2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#define SPELL_CLEAVE 26350
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 11efccd14b7..95c6d033aab 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -23,7 +23,8 @@ SDComment: Darkglare tracking issue
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
/*
@@ -180,7 +181,7 @@ public:
{
instance = creature->GetInstanceScript();
if (!instance)
- sLog->outError("TSCR: No Instance eye_of_cthunAI");
+ sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI");
}
InstanceScript* instance;
@@ -486,7 +487,7 @@ public:
instance = creature->GetInstanceScript();
if (!instance)
- sLog->outError("TSCR: No Instance eye_of_cthunAI");
+ sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI");
}
InstanceScript* instance;
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
index 613bc91182b..5ebce2f04e2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
@@ -23,7 +23,8 @@ SDComment: sound not implemented
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SOUND_SENTENCE_YOU 8588
#define SOUND_SERVE_TO 8589
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
index 53fac3ee3ec..83af40c57f2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define EMOTE_GENERIC_FRENZY_KILL -1000001
#define EMOTE_GENERIC_BERSERK -1000004
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
index 81205780e7d..f7acf28dba3 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
@@ -23,7 +23,8 @@ SDComment: No model for submerging. Currently just invisible.
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#define SPELL_SWEEP 26103
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
index 8c6c0fa0ad0..02554bbe6b3 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_AGGRO -1531008
#define SAY_SLAY -1531009
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
index 4df4bf73330..36388cfbe9c 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
@@ -23,7 +23,8 @@ SDComment: Mind Control buggy.
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#include "Group.h"
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index abaab9d830e..b85999042dd 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#include "WorldPacket.h"
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index 7b30200b0b3..d0e97bc36c8 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -23,7 +23,8 @@ SDComment: place holder
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_POISON_SHOCK 25993
#define SPELL_POISONBOLT_VOLLEY 25991
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
index f1cc0b401c3..887ca4f3ad5 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "temple_of_ahnqiraj.h"
class instance_temple_of_ahnqiraj : public InstanceMapScript
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index 556247d85af..5bb65454e0a 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -23,7 +23,8 @@ SDComment: Shadow storm is not properly implemented in core it should only targe
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "WorldPacket.h"
#include "Item.h"
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
index e61e20c35bc..1bb5c1180bd 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
@@ -23,7 +23,8 @@ SDComment: Everything seems to work, still need some checking
SDCategory: Wailing Caverns
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "wailing_caverns.h"
#define MAX_ENCOUNTER 9
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index 7e93cc7e4c7..0d4efac4321 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -26,7 +26,9 @@ EndScriptData */
/* ContentData
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "wailing_caverns.h"
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
index b6c69584358..3a6a3f6241c 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "zulfarrak.h"
#define NPC_GAHZRILLA 7273
@@ -118,6 +119,18 @@ public:
void Initialize()
{
GahzRillaEncounter = NOT_STARTED;
+ ZumrahGUID = 0;
+ BlyGUID = 0;
+ WeegliGUID = 0;
+ OroGUID = 0;
+ RavenGUID = 0;
+ MurtaGUID = 0;
+ EndDoorGUID = 0;
+ PyramidPhase = 0;
+ major_wave_Timer = 0;
+ minor_wave_Timer = 0;
+ addGroupSize = 0;
+ waypoint = 0;
}
void OnCreatureCreate(Creature* creature)
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 9e3d9240321..03e3756f964 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -28,7 +28,9 @@ npc_sergeant_bly
npc_weegli_blastfuse
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "zulfarrak.h"
/*######
diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp
index cec5e42aee5..248932ecbb6 100644
--- a/src/server/scripts/Kalimdor/ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/ashenvale.cpp
@@ -28,7 +28,8 @@ npc_torek
npc_ruul_snowhoof
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*####
@@ -78,32 +79,31 @@ class npc_torek : public CreatureScript
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
- if (!player)
- return;
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 1:
- Talk(SAY_MOVE, player->GetGUID());
- break;
- case 8:
- Talk(SAY_PREPARE, player->GetGUID());
- break;
- case 19:
- //TODO: verify location and creatures amount.
- me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- break;
- case 20:
- DoScriptText(SAY_WIN, me, player);
- Completed = true;
- player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
- break;
- case 21:
- Talk(SAY_END, player->GetGUID());
- break;
+ switch (waypointId)
+ {
+ case 1:
+ Talk(SAY_MOVE, player->GetGUID());
+ break;
+ case 8:
+ Talk(SAY_PREPARE, player->GetGUID());
+ break;
+ case 19:
+ //TODO: verify location and creatures amount.
+ me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ break;
+ case 20:
+ DoScriptText(SAY_WIN, me, player);
+ Completed = true;
+ player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
+ break;
+ case 21:
+ Talk(SAY_END, player->GetGUID());
+ break;
+ }
}
}
@@ -169,8 +169,26 @@ class npc_torek : public CreatureScript
# npc_ruul_snowhoof
####*/
-#define QUEST_FREEDOM_TO_RUUL 6482
-#define GO_CAGE 178147
+enum RuulSnowhoof
+{
+ NPC_THISTLEFUR_URSA = 3921,
+ NPC_THISTLEFUR_TOTEMIC = 3922,
+ NPC_THISTLEFUR_PATHFINDER = 3926,
+
+ QUEST_FREEDOM_TO_RUUL = 6482,
+
+ GO_CAGE = 178147
+};
+
+Position const RuulSnowhoofSummonsCoord[6] =
+{
+ {3449.218018f, -587.825073f, 174.978867f, 4.714445f},
+ {3446.384521f, -587.830872f, 175.186279f, 4.714445f},
+ {3444.218994f, -587.835327f, 175.380600f, 4.714445f},
+ {3508.344482f, -492.024261f, 186.929031f, 4.145029f},
+ {3506.265625f, -490.531006f, 186.740128f, 4.239277f},
+ {3503.682373f, -489.393799f, 186.629684f, 4.349232f}
+};
class npc_ruul_snowhoof : public CreatureScript
{
@@ -195,14 +213,14 @@ class npc_ruul_snowhoof : public CreatureScript
Cage->SetGoState(GO_STATE_ACTIVE);
break;
case 13:
- me->SummonCreature(3922, 3449.218018f, -587.825073f, 174.978867f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
- me->SummonCreature(3921, 3446.384521f, -587.830872f, 175.186279f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
- me->SummonCreature(3926, 3444.218994f, -587.835327f, 175.380600f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[0], TEMPSUMMON_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[1], TEMPSUMMON_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[2], TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
case 19:
- me->SummonCreature(3922, 3508.344482f, -492.024261f, 186.929031f, 4.145029f, TEMPSUMMON_DEAD_DESPAWN, 60000);
- me->SummonCreature(3921, 3506.265625f, -490.531006f, 186.740128f, 4.239277f, TEMPSUMMON_DEAD_DESPAWN, 60000);
- me->SummonCreature(3926, 3503.682373f, -489.393799f, 186.629684f, 4.349232f, TEMPSUMMON_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[3], TEMPSUMMON_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[4], TEMPSUMMON_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[5], TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
case 21:
player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me);
@@ -214,8 +232,7 @@ class npc_ruul_snowhoof : public CreatureScript
void Reset()
{
- GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20);
- if (Cage)
+ if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_READY);
}
@@ -249,7 +266,7 @@ class npc_ruul_snowhoof : public CreatureScript
}
};
-enum eEnums
+enum Muglash
{
SAY_MUG_START1 = -1800054,
SAY_MUG_START2 = -1800055,
@@ -278,21 +295,21 @@ enum eEnums
NPC_MUGLASH = 12717
};
-static float m_afFirstNagaCoord[3][3]=
+Position const FirstNagaCoord[3] =
{
- {3603.504150f, 1122.631104f, 1.635f}, // rider
- {3589.293945f, 1148.664063f, 5.565f}, // sorceress
- {3609.925537f, 1168.759521f, -1.168f} // razortail
+ {3603.504150f, 1122.631104f, 1.635f, 0.0f}, // rider
+ {3589.293945f, 1148.664063f, 5.565f, 0.0f}, // sorceress
+ {3609.925537f, 1168.759521f, -1.168f, 0.0f} // razortail
};
-static float m_afSecondNagaCoord[3][3]=
+Position const SecondNagaCoord[3] =
{
- {3609.925537f, 1168.759521f, -1.168f}, // witch
- {3645.652100f, 1139.425415f, 1.322f}, // priest
- {3583.602051f, 1128.405762f, 2.347f} // myrmidon
+ {3609.925537f, 1168.759521f, -1.168f, 0.0f}, // witch
+ {3645.652100f, 1139.425415f, 1.322f, 0.0f}, // priest
+ {3583.602051f, 1128.405762f, 2.347f, 0.0f} // myrmidon
};
-static float m_fVorshaCoord[]={3633.056885f, 1172.924072f, -5.388f};
+Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f};
class npc_muglash : public CreatureScript
{
@@ -303,9 +320,9 @@ class npc_muglash : public CreatureScript
{
npc_muglashAI(Creature* creature) : npc_escortAI(creature) { }
- uint32 m_uiWaveId;
- uint32 m_uiEventTimer;
- bool m_bIsBrazierExtinguished;
+ uint8 WaveId;
+ uint32 EventTimer;
+ bool IsBrazierExtinguished;
void JustSummoned(Creature* summoned)
{
@@ -314,34 +331,33 @@ class npc_muglash : public CreatureScript
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 0:
- if (player)
+ switch (waypointId)
+ {
+ case 0:
DoScriptText(SAY_MUG_START2, me, player);
- break;
- case 24:
- if (player)
+ break;
+ case 24:
DoScriptText(SAY_MUG_BRAZIER, me, player);
- if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2))
- {
- go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- SetEscortPaused(true);
- }
- break;
- case 25:
- DoScriptText(SAY_MUG_GRATITUDE, me);
- player->GroupEventHappens(QUEST_VORSHA, me);
- break;
- case 26:
- DoScriptText(SAY_MUG_PATROL, me);
- break;
- case 27:
- DoScriptText(SAY_MUG_RETURN, me);
- break;
+ if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2))
+ {
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ SetEscortPaused(true);
+ }
+ break;
+ case 25:
+ DoScriptText(SAY_MUG_GRATITUDE, me);
+ player->GroupEventHappens(QUEST_VORSHA, me);
+ break;
+ case 26:
+ DoScriptText(SAY_MUG_PATROL, me);
+ break;
+ case 27:
+ DoScriptText(SAY_MUG_RETURN, me);
+ break;
+ }
}
}
@@ -358,9 +374,9 @@ class npc_muglash : public CreatureScript
void Reset()
{
- m_uiEventTimer = 10000;
- m_uiWaveId = 0;
- m_bIsBrazierExtinguished = false;
+ EventTimer = 10000;
+ WaveId = 0;
+ IsBrazierExtinguished = false;
}
void JustDied(Unit* /*killer*/)
@@ -372,20 +388,20 @@ class npc_muglash : public CreatureScript
void DoWaveSummon()
{
- switch (m_uiWaveId)
+ switch (WaveId)
{
case 1:
- me->SummonCreature(NPC_WRATH_RIDER, m_afFirstNagaCoord[0][0], m_afFirstNagaCoord[0][1], m_afFirstNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- me->SummonCreature(NPC_WRATH_SORCERESS, m_afFirstNagaCoord[1][0], m_afFirstNagaCoord[1][1], m_afFirstNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- me->SummonCreature(NPC_WRATH_RAZORTAIL, m_afFirstNagaCoord[2][0], m_afFirstNagaCoord[2][1], m_afFirstNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_WRATH_RIDER, FirstNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_WRATH_SORCERESS, FirstNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_WRATH_RAZORTAIL, FirstNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 2:
- me->SummonCreature(NPC_WRATH_PRIESTESS, m_afSecondNagaCoord[0][0], m_afSecondNagaCoord[0][1], m_afSecondNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- me->SummonCreature(NPC_WRATH_MYRMIDON, m_afSecondNagaCoord[1][0], m_afSecondNagaCoord[1][1], m_afSecondNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- me->SummonCreature(NPC_WRATH_SEAWITCH, m_afSecondNagaCoord[2][0], m_afSecondNagaCoord[2][1], m_afSecondNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_WRATH_PRIESTESS, SecondNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_WRATH_MYRMIDON, SecondNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_WRATH_SEAWITCH, SecondNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 3:
- me->SummonCreature(NPC_VORSHA, m_fVorshaCoord[0], m_fVorshaCoord[1], m_fVorshaCoord[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(NPC_VORSHA, VorshaCoord, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 4:
SetEscortPaused(false);
@@ -400,16 +416,16 @@ class npc_muglash : public CreatureScript
if (!me->getVictim())
{
- if (HasEscortState(STATE_ESCORT_PAUSED) && m_bIsBrazierExtinguished)
+ if (HasEscortState(STATE_ESCORT_PAUSED) && IsBrazierExtinguished)
{
- if (m_uiEventTimer < uiDiff)
+ if (EventTimer < uiDiff)
{
- ++m_uiWaveId;
+ ++WaveId;
DoWaveSummon();
- m_uiEventTimer = 10000;
+ EventTimer = 10000;
}
else
- m_uiEventTimer -= uiDiff;
+ EventTimer -= uiDiff;
}
return;
}
@@ -451,7 +467,7 @@ class go_naga_brazier : public GameObjectScript
{
DoScriptText(SAY_MUG_BRAZIER_WAIT, creature);
- pEscortAI->m_bIsBrazierExtinguished = true;
+ pEscortAI->IsBrazierExtinguished = true;
return false;
}
}
diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp
index 2e7b0a684c1..8d08c26f0a7 100644
--- a/src/server/scripts/Kalimdor/azshara.cpp
+++ b/src/server/scripts/Kalimdor/azshara.cpp
@@ -30,9 +30,9 @@ mob_rizzle_sprysprocket
mob_depth_charge
EndContentData */
-#include "ScriptPCH.h"
-#include "World.h"
-#include "WorldPacket.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## mobs_spitelashes
@@ -179,9 +179,12 @@ public:
# mob_rizzle_sprysprocket
####*/
-enum eRizzleSprysprocketData
+enum RizzleSprysprocketData
{
+ QUEST_CHASING_THE_MOONSTONE = 10994,
+
MOB_DEPTH_CHARGE = 23025,
+
SPELL_RIZZLE_BLACKJACK = 39865,
SPELL_RIZZLE_ESCAPE = 39871,
SPELL_RIZZLE_FROST_GRENADE = 40525,
@@ -199,67 +202,66 @@ enum eRizzleSprysprocketData
#define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go."
-float WPs[58][4] =
+Position const WPs[58] =
{
-//pos_x pos_y pos_z orien
-{3691.97f, -3962.41f, 35.9118f, 3.67f},
-{3675.02f, -3960.49f, 35.9118f, 3.67f},
-{3653.19f, -3958.33f, 33.9118f, 3.59f},
-{3621.12f, -3958.51f, 29.9118f, 3.48f},
-{3604.86f, -3963, 29.9118f, 3.48f},
-{3569.94f, -3970.25f, 29.9118f, 3.44f},
-{3541.03f, -3975.64f, 29.9118f, 3.41f},
-{3510.84f, -3978.71f, 29.9118f, 3.41f},
-{3472.7f, -3997.07f, 29.9118f, 3.35f},
-{3439.15f, -4014.55f, 29.9118f, 3.29f},
-{3412.8f, -4025.87f, 29.9118f, 3.25f},
-{3384.95f, -4038.04f, 29.9118f, 3.24f},
-{3346.77f, -4052.93f, 29.9118f, 3.22f},
-{3299.56f, -4071.59f, 29.9118f, 3.20f},
-{3261.22f, -4080.38f, 30.9118f, 3.19f},
-{3220.68f, -4083.09f, 31.9118f, 3.18f},
-{3187.11f, -4070.45f, 33.9118f, 3.16f},
-{3162.78f, -4062.75f, 33.9118f, 3.15f},
-{3136.09f, -4050.32f, 33.9118f, 3.07f},
-{3119.47f, -4044.51f, 36.0363f, 3.07f},
-{3098.95f, -4019.8f, 33.9118f, 3.07f},
-{3073.07f, -4011.42f, 33.9118f, 3.07f},
-{3051.71f, -3993.37f, 33.9118f, 3.02f},
-{3027.52f, -3978.6f, 33.9118f, 3.00f},
-{3003.78f, -3960.14f, 33.9118f, 2.98f},
-{2977.99f, -3941.98f, 31.9118f, 2.96f},
-{2964.57f, -3932.07f, 30.9118f, 2.96f},
-{2947.9f, -3921.31f, 29.9118f, 2.96f},
-{2924.91f, -3910.8f, 29.9118f, 2.94f},
-{2903.04f, -3896.42f, 29.9118f, 2.93f},
-{2884.75f, -3874.03f, 29.9118f, 2.90f},
-{2868.19f, -3851.48f, 29.9118f, 2.82f},
-{2854.62f, -3819.72f, 29.9118f, 2.80f},
-{2825.53f, -3790.4f, 29.9118f, 2.744f},
-{2804.31f, -3773.05f, 29.9118f, 2.71f},
-{2769.78f, -3763.57f, 29.9118f, 2.70f},
-{2727.23f, -3745.92f, 30.9118f, 2.69f},
-{2680.12f, -3737.49f, 30.9118f, 2.67f},
-{2647.62f, -3739.94f, 30.9118f, 2.66f},
-{2616.6f, -3745.75f, 30.9118f, 2.64f},
-{2589.38f, -3731.97f, 30.9118f, 2.61f},
-{2562.94f, -3722.35f, 31.9118f, 2.56f},
-{2521.05f, -3716.6f, 31.9118f, 2.55f},
-{2485.26f, -3706.67f, 31.9118f, 2.51f},
-{2458.93f, -3696.67f, 31.9118f, 2.51f},
-{2432, -3692.03f, 31.9118f, 2.46f},
-{2399.59f, -3681.97f, 31.9118f, 2.45f},
-{2357.75f, -3666.6f, 31.9118f, 2.44f},
-{2311.99f, -3656.88f, 31.9118f, 2.94f},
-{2263.41f, -3649.55f, 31.9118f, 3.02f},
-{2209.05f, -3641.76f, 31.9118f, 2.99f},
-{2164.83f, -3637.64f, 31.9118f, 3.15f},
-{2122.42f, -3639, 31.9118f, 3.21f},
-{2075.73f, -3643.59f, 31.9118f, 3.22f},
-{2033.59f, -3649.52f, 31.9118f, 3.42f},
-{1985.22f, -3662.99f, 31.9118f, 3.42f},
-{1927.09f, -3679.56f, 33.9118f, 3.42f},
-{1873.57f, -3695.32f, 33.9118f, 3.44f}
+ {3691.97f, -3962.41f, 35.9118f, 3.67f},
+ {3675.02f, -3960.49f, 35.9118f, 3.67f},
+ {3653.19f, -3958.33f, 33.9118f, 3.59f},
+ {3621.12f, -3958.51f, 29.9118f, 3.48f},
+ {3604.86f, -3963, 29.9118f, 3.48f},
+ {3569.94f, -3970.25f, 29.9118f, 3.44f},
+ {3541.03f, -3975.64f, 29.9118f, 3.41f},
+ {3510.84f, -3978.71f, 29.9118f, 3.41f},
+ {3472.7f, -3997.07f, 29.9118f, 3.35f},
+ {3439.15f, -4014.55f, 29.9118f, 3.29f},
+ {3412.8f, -4025.87f, 29.9118f, 3.25f},
+ {3384.95f, -4038.04f, 29.9118f, 3.24f},
+ {3346.77f, -4052.93f, 29.9118f, 3.22f},
+ {3299.56f, -4071.59f, 29.9118f, 3.20f},
+ {3261.22f, -4080.38f, 30.9118f, 3.19f},
+ {3220.68f, -4083.09f, 31.9118f, 3.18f},
+ {3187.11f, -4070.45f, 33.9118f, 3.16f},
+ {3162.78f, -4062.75f, 33.9118f, 3.15f},
+ {3136.09f, -4050.32f, 33.9118f, 3.07f},
+ {3119.47f, -4044.51f, 36.0363f, 3.07f},
+ {3098.95f, -4019.8f, 33.9118f, 3.07f},
+ {3073.07f, -4011.42f, 33.9118f, 3.07f},
+ {3051.71f, -3993.37f, 33.9118f, 3.02f},
+ {3027.52f, -3978.6f, 33.9118f, 3.00f},
+ {3003.78f, -3960.14f, 33.9118f, 2.98f},
+ {2977.99f, -3941.98f, 31.9118f, 2.96f},
+ {2964.57f, -3932.07f, 30.9118f, 2.96f},
+ {2947.9f, -3921.31f, 29.9118f, 2.96f},
+ {2924.91f, -3910.8f, 29.9118f, 2.94f},
+ {2903.04f, -3896.42f, 29.9118f, 2.93f},
+ {2884.75f, -3874.03f, 29.9118f, 2.90f},
+ {2868.19f, -3851.48f, 29.9118f, 2.82f},
+ {2854.62f, -3819.72f, 29.9118f, 2.80f},
+ {2825.53f, -3790.4f, 29.9118f, 2.744f},
+ {2804.31f, -3773.05f, 29.9118f, 2.71f},
+ {2769.78f, -3763.57f, 29.9118f, 2.70f},
+ {2727.23f, -3745.92f, 30.9118f, 2.69f},
+ {2680.12f, -3737.49f, 30.9118f, 2.67f},
+ {2647.62f, -3739.94f, 30.9118f, 2.66f},
+ {2616.6f, -3745.75f, 30.9118f, 2.64f},
+ {2589.38f, -3731.97f, 30.9118f, 2.61f},
+ {2562.94f, -3722.35f, 31.9118f, 2.56f},
+ {2521.05f, -3716.6f, 31.9118f, 2.55f},
+ {2485.26f, -3706.67f, 31.9118f, 2.51f},
+ {2458.93f, -3696.67f, 31.9118f, 2.51f},
+ {2432, -3692.03f, 31.9118f, 2.46f},
+ {2399.59f, -3681.97f, 31.9118f, 2.45f},
+ {2357.75f, -3666.6f, 31.9118f, 2.44f},
+ {2311.99f, -3656.88f, 31.9118f, 2.94f},
+ {2263.41f, -3649.55f, 31.9118f, 3.02f},
+ {2209.05f, -3641.76f, 31.9118f, 2.99f},
+ {2164.83f, -3637.64f, 31.9118f, 3.15f},
+ {2122.42f, -3639, 31.9118f, 3.21f},
+ {2075.73f, -3643.59f, 31.9118f, 3.22f},
+ {2033.59f, -3649.52f, 31.9118f, 3.42f},
+ {1985.22f, -3662.99f, 31.9118f, 3.42f},
+ {1927.09f, -3679.56f, 33.9118f, 3.42f},
+ {1873.57f, -3695.32f, 33.9118f, 3.44f}
};
class mob_rizzle_sprysprocket : public CreatureScript
@@ -270,19 +272,19 @@ public:
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
- if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE)
+ if (action == GOSSIP_ACTION_INFO_DEF + 1 && player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE)
{
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_GIVE_SOUTHFURY_MOONSTONE, true);
- CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die_Timer = 3000;
- CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->Must_Die = true;
+ CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDieTimer = 3000;
+ CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, creature->AI())->MustDie = true;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature)
{
- if (player->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE)
+ if (player->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) != QUEST_STATUS_INCOMPLETE)
return true;
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(10811, creature->GetGUID());
@@ -298,32 +300,32 @@ public:
{
mob_rizzle_sprysprocketAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 spellEscape_Timer;
- uint32 Teleport_Timer;
- uint32 Check_Timer;
- uint32 Grenade_Timer;
- uint32 Must_Die_Timer;
+ uint32 SpellEscapeTimer;
+ uint32 TeleportTimer;
+ uint32 CheckTimer;
+ uint32 GrenadeTimer;
+ uint32 MustDieTimer;
uint32 CurrWP;
uint64 PlayerGUID;
- bool Must_Die;
+ bool MustDie;
bool Escape;
bool ContinueWP;
bool Reached;
void Reset()
{
- spellEscape_Timer = 1300;
- Teleport_Timer = 3500;
- Check_Timer = 10000;
- Grenade_Timer = 30000;
- Must_Die_Timer = 3000;
+ SpellEscapeTimer = 1300;
+ TeleportTimer = 3500;
+ CheckTimer = 10000;
+ GrenadeTimer = 30000;
+ MustDieTimer = 3000;
CurrWP = 0;
PlayerGUID = 0;
- Must_Die = false;
+ MustDie = false;
Escape = false;
ContinueWP = false;
Reached = false;
@@ -331,13 +333,13 @@ public:
void UpdateAI(const uint32 diff)
{
- if (Must_Die)
+ if (MustDie)
{
- if (Must_Die_Timer <= diff)
+ if (MustDieTimer <= diff)
{
me->DespawnOrUnsummon();
return;
- } else Must_Die_Timer -= diff;
+ } else MustDieTimer -= diff;
}
if (!Escape)
@@ -345,17 +347,16 @@ public:
if (!PlayerGUID)
return;
- if (spellEscape_Timer <= diff)
+ if (SpellEscapeTimer <= diff)
{
DoCast(me, SPELL_RIZZLE_ESCAPE, false);
- spellEscape_Timer = 10000;
- } else spellEscape_Timer -= diff;
+ SpellEscapeTimer = 10000;
+ } else SpellEscapeTimer -= diff;
- if (Teleport_Timer <= diff)
+ if (TeleportTimer <= diff)
{
//temp solution - unit can't be teleported by core using spelleffect 5, only players
- Map* map = me->GetMap();
- if (map)
+ if (me->GetMap())
{
me->SetPosition(3706.39f, -3969.15f, 35.9118f, 0);
me->AI_SendMoveToPacket(3706.39f, -3969.15f, 35.9118f, 0, 0, 0);
@@ -367,20 +368,20 @@ public:
me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING);
me->SetSpeed(MOVE_RUN, 0.85f, true);
me->GetMotionMaster()->MovementExpired();
- me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]);
+ me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]);
Escape = true;
- } else Teleport_Timer -= diff;
+ } else TeleportTimer -= diff;
return;
}
if (ContinueWP)
{
- me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]);
+ me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]);
ContinueWP = false;
}
- if (Grenade_Timer <= diff)
+ if (GrenadeTimer <= diff)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player)
@@ -388,10 +389,10 @@ public:
DoScriptText(SAY_RIZZLE_GRENADE, me, player);
DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true);
}
- Grenade_Timer = 30000;
- } else Grenade_Timer -= diff;
+ GrenadeTimer = 30000;
+ } else GrenadeTimer -= diff;
- if (Check_Timer <= diff)
+ if (CheckTimer <= diff)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (!player)
@@ -410,8 +411,8 @@ public:
Reached = true;
}
- Check_Timer = 1000;
- } else Check_Timer -= diff;
+ CheckTimer = 1000;
+ } else CheckTimer -= diff;
}
@@ -427,7 +428,7 @@ public:
if (!who || PlayerGUID)
return;
- if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE)
+ if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE)
{
PlayerGUID = who->GetGUID();
DoScriptText(SAY_RIZZLE_START, me);
@@ -472,25 +473,25 @@ public:
{
mob_depth_chargeAI(Creature* creature) : ScriptedAI(creature) {}
- bool we_must_die;
- uint32 must_die_timer;
+ bool WeMustDie;
+ uint32 WeMustDieTimer;
void Reset()
{
me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- we_must_die = false;
- must_die_timer = 1000;
+ WeMustDie = false;
+ WeMustDieTimer = 1000;
}
void UpdateAI(const uint32 diff)
{
- if (we_must_die)
+ if (WeMustDie)
{
- if (must_die_timer <= diff)
- {
+ if (WeMustDieTimer <= diff)
me->DespawnOrUnsummon();
- } else must_die_timer -= diff;
+ else
+ WeMustDieTimer -= diff;
}
return;
}
@@ -503,18 +504,14 @@ public:
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5))
{
DoCast(who, SPELL_DEPTH_CHARGE_TRAP);
- we_must_die = true;
+ WeMustDie = true;
return;
}
}
- void AttackStart(Unit* /*who*/)
- {
- }
+ void AttackStart(Unit* /*who*/) {}
- void EnterCombat(Unit* /*who*/)
- {
- }
+ void EnterCombat(Unit* /*who*/) {}
};
};
diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
index dfb1f3b0bdf..96e67c8de47 100644
--- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
@@ -33,15 +33,19 @@ go_ravager_cage
npc_death_ravager
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
-#include <cmath>
+#include "ScriptedGossip.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
/*######
## npc_draenei_survivor
######*/
-enum eEnums
+enum draeneiSurvivor
{
SAY_HEAL1 = -1000176,
SAY_HEAL2 = -1000177,
@@ -175,7 +179,7 @@ public:
## npc_engineer_spark_overgrind
######*/
-enum eOvergrind
+enum Overgrind
{
SAY_TEXT = -1000184,
SAY_EMOTE = -1000185,
@@ -235,15 +239,15 @@ public:
uint32 NormFaction;
uint32 NpcFlags;
- uint32 Dynamite_Timer;
- uint32 Emote_Timer;
+ uint32 DynamiteTimer;
+ uint32 EmoteTimer;
bool IsTreeEvent;
void Reset()
{
- Dynamite_Timer = 8000;
- Emote_Timer = urand(120000, 150000);
+ DynamiteTimer = 8000;
+ EmoteTimer = urand(120000, 150000);
me->setFaction(NormFaction);
me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags);
@@ -260,12 +264,12 @@ public:
{
if (!me->isInCombat() && !IsTreeEvent)
{
- if (Emote_Timer <= diff)
+ if (EmoteTimer <= diff)
{
DoScriptText(SAY_TEXT, me);
DoScriptText(SAY_EMOTE, me);
- Emote_Timer = urand(120000, 150000);
- } else Emote_Timer -= diff;
+ EmoteTimer = urand(120000, 150000);
+ } else EmoteTimer -= diff;
}
else if (IsTreeEvent)
return;
@@ -273,11 +277,11 @@ public:
if (!UpdateVictim())
return;
- if (Dynamite_Timer <= diff)
+ if (DynamiteTimer <= diff)
{
DoCast(me->getVictim(), SPELL_DYNAMITE);
- Dynamite_Timer = 8000;
- } else Dynamite_Timer -= diff;
+ DynamiteTimer = 8000;
+ } else DynamiteTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -307,7 +311,7 @@ public:
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
me->SetHealth(me->CountPctFromMaxHealth(15));
- switch (rand()%2)
+ switch (urand(0, 1))
{
case 0:
me->SetStandState(UNIT_STAND_STATE_SIT);
@@ -321,14 +325,9 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void MoveInLineOfSight(Unit* /*who*/)
- {
- }
-
- void UpdateAI(const uint32 /*diff*/)
- {
- }
+ void MoveInLineOfSight(Unit* /*who*/) {}
+ void UpdateAI(const uint32 /*diff*/) {}
};
};
@@ -337,7 +336,7 @@ public:
## npc_magwin
######*/
-enum eMagwin
+enum Magwin
{
SAY_START = -1000111,
SAY_AGGRO = -1000112,
@@ -376,26 +375,25 @@ public:
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
- if (!player)
- return;
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 0:
- DoScriptText(SAY_START, me, player);
- break;
- case 17:
- DoScriptText(SAY_PROGRESS, me, player);
- break;
- case 28:
- DoScriptText(SAY_END1, me, player);
- break;
- case 29:
- DoScriptText(EMOTE_HUG, me, player);
- DoScriptText(SAY_END2, me, player);
- player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me);
- break;
+ switch (waypointId)
+ {
+ case 0:
+ DoScriptText(SAY_START, me, player);
+ break;
+ case 17:
+ DoScriptText(SAY_PROGRESS, me, player);
+ break;
+ case 28:
+ DoScriptText(SAY_END1, me, player);
+ break;
+ case 29:
+ DoScriptText(EMOTE_HUG, me, player);
+ DoScriptText(SAY_END2, me, player);
+ player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me);
+ break;
+ }
}
}
@@ -404,7 +402,7 @@ public:
DoScriptText(SAY_AGGRO, me, who);
}
- void Reset() { }
+ void Reset() {}
};
};
@@ -413,7 +411,7 @@ public:
## npc_geezle
######*/
-enum eGeezle
+enum Geezle
{
QUEST_TREES_COMPANY = 9531,
@@ -433,7 +431,7 @@ enum eGeezle
GO_NAGA_FLAG = 181694
};
-static float SparkPos[3] = {-5029.91f, -11291.79f, 8.096f};
+Position const SparkPos = {-5029.91f, -11291.79f, 8.096f, 0.0f};
class npc_geezle : public CreatureScript
{
@@ -451,7 +449,7 @@ public:
uint64 SparkGUID;
- uint32 Step;
+ uint8 Step;
uint32 SayTimer;
bool EventStarted;
@@ -469,8 +467,7 @@ public:
{
Step = 0;
EventStarted = true;
- Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
- if (Spark)
+ if (Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000))
{
SparkGUID = Spark->GetGUID();
Spark->setActive(true);
@@ -479,47 +476,47 @@ public:
SayTimer = 8000;
}
- uint32 NextStep(uint32 Step)
+ uint32 NextStep(uint8 Step)
{
Creature* Spark = Unit::GetCreature(*me, SparkGUID);
switch (Step)
{
- case 0:
- if (Spark)
- Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f);
- me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f);
- return 9000; // NPCs are walking up to fire
- case 1:
- DespawnNagaFlag(true);
- DoScriptText(EMOTE_SPARK, Spark);
- return 1000;
- case 2:
- DoScriptText(GEEZLE_SAY_1, me, Spark);
- if (Spark)
- {
- Spark->SetInFront(me);
- me->SetInFront(Spark);
- }
- return 5000;
- case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000;
- case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000;
- case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000;
- case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000;
- case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000;
- case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000;
- case 9:
- me->GetMotionMaster()->MoveTargetedHome();
- if (Spark)
- Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]);
- CompleteQuest();
- return 9000;
- case 10:
- if (Spark)
- Spark->DisappearAndDie();
- DespawnNagaFlag(false);
- me->DisappearAndDie();
- default: return 99999999;
+ case 0:
+ if (Spark)
+ Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f);
+ me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f);
+ return 9000; // NPCs are walking up to fire
+ case 1:
+ DespawnNagaFlag(true);
+ DoScriptText(EMOTE_SPARK, Spark);
+ return 1000;
+ case 2:
+ DoScriptText(GEEZLE_SAY_1, me, Spark);
+ if (Spark)
+ {
+ Spark->SetInFront(me);
+ me->SetInFront(Spark);
+ }
+ return 5000;
+ case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000;
+ case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000;
+ case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000;
+ case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000;
+ case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000;
+ case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000;
+ case 9:
+ me->GetMotionMaster()->MoveTargetedHome();
+ if (Spark)
+ Spark->GetMotionMaster()->MovePoint(0, SparkPos);
+ CompleteQuest();
+ return 9000;
+ case 10:
+ if (Spark)
+ Spark->DisappearAndDie();
+ DespawnNagaFlag(false);
+ me->DisappearAndDie();
+ default: return 99999999;
}
}
@@ -533,13 +530,8 @@ public:
me->VisitNearbyWorldObject(radius, searcher);
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE
- &&(*itr)->HasAura(SPELL_TREE_DISGUISE))
- {
+ if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE && (*itr)->HasAura(SPELL_TREE_DISGUISE))
(*itr)->KilledMonsterCredit(MOB_SPARK, 0);
- }
- }
}
void DespawnNagaFlag(bool despawn)
@@ -552,13 +544,13 @@ public:
for (std::list<GameObject*>::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr)
{
if (despawn)
- {
(*itr)->SetLootState(GO_JUST_DEACTIVATED);
- }
else
(*itr)->Respawn();
}
- } else sLog->outError("SD2 ERROR: FlagList is empty!");
+ }
+ else
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!");
}
void UpdateAI(const uint32 diff)
@@ -566,16 +558,16 @@ public:
if (SayTimer <= diff)
{
if (EventStarted)
- {
SayTimer = NextStep(Step++);
- }
- } else SayTimer -= diff;
+ }
+ else
+ SayTimer -= diff;
}
};
};
-enum eRavegerCage
+enum RavegerCage
{
NPC_DEATH_RAVAGER = 17556,
diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp
index ffc2fb3fb61..3883b740d02 100644
--- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp
@@ -28,14 +28,16 @@ mob_webbed_creature
npc_captured_sunhawk_agent
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## mob_webbed_creature
######*/
//possible creatures to be spawned
-const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327};
+uint32 const possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327};
class mob_webbed_creature : public CreatureScript
{
@@ -51,13 +53,9 @@ public:
{
mob_webbed_creatureAI(Creature* creature) : ScriptedAI(creature) {}
- void Reset()
- {
- }
+ void Reset() {}
- void EnterCombat(Unit* /*who*/)
- {
- }
+ void EnterCombat(Unit* /*who*/) {}
void JustDied(Unit* killer)
{
@@ -153,7 +151,7 @@ public:
## Quest 9667: Saving Princess Stillpine
######*/
-enum eStillpine
+enum Stillpine
{
QUEST_SAVING_PRINCESS_STILLPINE = 9667,
NPC_PRINCESS_STILLPINE = 17682,
@@ -193,7 +191,7 @@ public:
if (type == POINT_MOTION_TYPE && id == 1)
{
DoScriptText(SAY_DIRECTION, me);
- me->ForcedDespawn();
+ me->DespawnOrUnsummon();
}
}
};
diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp
index c344de8cb51..ec098951c03 100644
--- a/src/server/scripts/Kalimdor/boss_azuregos.cpp
+++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp
@@ -23,17 +23,24 @@ SDComment: Teleport not included, spell reflect not effecting dots (Core problem
SDCategory: Azshara
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SAY_TELEPORT -1000100
+enum Say
+{
+ SAY_TELEPORT = -1000100
+};
-#define SPELL_MARKOFFROST 23182
-#define SPELL_MANASTORM 21097
-#define SPELL_CHILL 21098
-#define SPELL_FROSTBREATH 21099
-#define SPELL_REFLECT 22067
-#define SPELL_CLEAVE 8255 //Perhaps not right ID
-#define SPELL_ENRAGE 23537
+enum Spells
+{
+ SPELL_MARKOFFROST = 23182,
+ SPELL_MANASTORM = 21097,
+ SPELL_CHILL = 21098,
+ SPELL_FROSTBREATH = 21099,
+ SPELL_REFLECT = 22067,
+ SPELL_CLEAVE = 8255, //Perhaps not right ID
+ SPELL_ENRAGE = 23537
+};
class boss_azuregos : public CreatureScript
{
@@ -49,26 +56,26 @@ public:
{
boss_azuregosAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 MarkOfFrost_Timer;
- uint32 ManaStorm_Timer;
- uint32 Chill_Timer;
- uint32 Breath_Timer;
- uint32 Teleport_Timer;
- uint32 Reflect_Timer;
- uint32 Cleave_Timer;
- uint32 Enrage_Timer;
+ uint32 MarkOfFrostTimer;
+ uint32 ManaStormTimer;
+ uint32 ChillTimer;
+ uint32 BreathTimer;
+ uint32 TeleportTimer;
+ uint32 ReflectTimer;
+ uint32 CleaveTimer;
+ uint32 EnrageTimer;
bool Enraged;
void Reset()
{
- MarkOfFrost_Timer = 35000;
- ManaStorm_Timer = urand(5000, 17000);
- Chill_Timer = urand(10000, 30000);
- Breath_Timer = urand(2000, 8000);
- Teleport_Timer = 30000;
- Reflect_Timer = urand(15000, 30000);
- Cleave_Timer = 7000;
- Enrage_Timer = 0;
+ MarkOfFrostTimer = 35000;
+ ManaStormTimer = urand(5000, 17000);
+ ChillTimer = urand(10000, 30000);
+ BreathTimer = urand(2000, 8000);
+ TeleportTimer = 30000;
+ ReflectTimer = urand(15000, 30000);
+ CleaveTimer = 7000;
+ EnrageTimer = 0;
Enraged = false;
}
@@ -80,12 +87,12 @@ public:
if (!UpdateVictim())
return;
- if (Teleport_Timer <= diff)
+ if (TeleportTimer <= diff)
{
DoScriptText(SAY_TELEPORT, me);
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
- for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
+ std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
+ std::list<HostileReference*>::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i!= threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -95,53 +102,53 @@ public:
}
DoResetThreat();
- Teleport_Timer = 30000;
- } else Teleport_Timer -= diff;
+ TeleportTimer = 30000;
+ } else TeleportTimer -= diff;
- // //MarkOfFrost_Timer
- // if (MarkOfFrost_Timer <= diff)
+ // //MarkOfFrostTimer
+ // if (MarkOfFrostTimer <= diff)
// {
// DoCast(me->getVictim(), SPELL_MARKOFFROST);
- // MarkOfFrost_Timer = 25000;
- // } else MarkOfFrost_Timer -= diff;
+ // MarkOfFrostTimer = 25000;
+ // } else MarkOfFrostTimer -= diff;
- //Chill_Timer
- if (Chill_Timer <= diff)
+ //ChillTimer
+ if (ChillTimer <= diff)
{
DoCast(me->getVictim(), SPELL_CHILL);
- Chill_Timer = urand(13000, 25000);
- } else Chill_Timer -= diff;
+ ChillTimer = urand(13000, 25000);
+ } else ChillTimer -= diff;
- //Breath_Timer
- if (Breath_Timer <= diff)
+ //BreathTimer
+ if (BreathTimer <= diff)
{
DoCast(me->getVictim(), SPELL_FROSTBREATH);
- Breath_Timer = urand(10000, 15000);
- } else Breath_Timer -= diff;
+ BreathTimer = urand(10000, 15000);
+ } else BreathTimer -= diff;
- //ManaStorm_Timer
- if (ManaStorm_Timer <= diff)
+ //ManaStormTimer
+ if (ManaStormTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_MANASTORM);
- ManaStorm_Timer = urand(7500, 12500);
- } else ManaStorm_Timer -= diff;
+ ManaStormTimer = urand(7500, 12500);
+ } else ManaStormTimer -= diff;
- //Reflect_Timer
- if (Reflect_Timer <= diff)
+ //ReflectTimer
+ if (ReflectTimer <= diff)
{
DoCast(me, SPELL_REFLECT);
- Reflect_Timer = urand(20000, 35000);
- } else Reflect_Timer -= diff;
+ ReflectTimer = urand(20000, 35000);
+ } else ReflectTimer -= diff;
- //Cleave_Timer
- if (Cleave_Timer <= diff)
+ //CleaveTimer
+ if (CleaveTimer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
- Cleave_Timer = 7000;
- } else Cleave_Timer -= diff;
+ CleaveTimer = 7000;
+ } else CleaveTimer -= diff;
- //Enrage_Timer
+ //EnrageTimer
if (HealthBelowPct(26) && !Enraged)
{
DoCast(me, SPELL_ENRAGE);
diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp
index 1de04db61c4..0e02a77169e 100644
--- a/src/server/scripts/Kalimdor/darkshore.cpp
+++ b/src/server/scripts/Kalimdor/darkshore.cpp
@@ -29,7 +29,9 @@ npc_prospector_remtravel
npc_threshwackonator
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
@@ -37,7 +39,7 @@ EndContentData */
# npc_kerlonian
####*/
-enum eKerlonian
+enum Kerlonian
{
SAY_KER_START = -1000434,
@@ -94,11 +96,11 @@ public:
{
npc_kerlonianAI(Creature* creature) : FollowerAI(creature) { }
- uint32 m_uiFallAsleepTimer;
+ uint32 FallAsleepTimer;
void Reset()
{
- m_uiFallAsleepTimer = urand(10000, 45000);
+ FallAsleepTimer = urand(10000, 45000);
}
void MoveInLineOfSight(Unit* who)
@@ -150,7 +152,7 @@ public:
SetFollowPaused(false);
}
- void UpdateFollowerAI(const uint32 uiDiff)
+ void UpdateFollowerAI(const uint32 Diff)
{
if (!UpdateVictim())
{
@@ -159,13 +161,13 @@ public:
if (!HasFollowState(STATE_FOLLOW_PAUSED))
{
- if (m_uiFallAsleepTimer <= uiDiff)
+ if (FallAsleepTimer <= Diff)
{
SetSleeping();
- m_uiFallAsleepTimer = urand(25000, 90000);
+ FallAsleepTimer = urand(25000, 90000);
}
else
- m_uiFallAsleepTimer -= uiDiff;
+ FallAsleepTimer -= Diff;
}
return;
@@ -181,7 +183,7 @@ public:
# npc_prospector_remtravel
####*/
-enum eRemtravel
+enum Remtravel
{
SAY_REM_START = -1000327,
SAY_REM_AGGRO = -1000328,
@@ -233,63 +235,62 @@ public:
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
- if (!player)
- return;
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 0:
- DoScriptText(SAY_REM_START, me, player);
- break;
- case 5:
- DoScriptText(SAY_REM_RAMP1_1, me, player);
- break;
- case 6:
- DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- break;
- case 9:
- DoScriptText(SAY_REM_RAMP1_2, me, player);
- break;
- case 14:
- //depend quest rewarded?
- DoScriptText(SAY_REM_BOOK, me, player);
- break;
- case 15:
- DoScriptText(SAY_REM_TENT1_1, me, player);
- break;
- case 16:
- DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- break;
- case 17:
- DoScriptText(SAY_REM_TENT1_2, me, player);
- break;
- case 26:
- DoScriptText(SAY_REM_MOSS, me, player);
- break;
- case 27:
- DoScriptText(EMOTE_REM_MOSS, me, player);
- break;
- case 28:
- DoScriptText(SAY_REM_MOSS_PROGRESS, me, player);
- break;
- case 29:
- DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- break;
- case 31:
- DoScriptText(SAY_REM_PROGRESS, me, player);
- break;
- case 41:
- DoScriptText(SAY_REM_REMEMBER, me, player);
- break;
- case 42:
- DoScriptText(EMOTE_REM_END, me, player);
- player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me);
- break;
+ switch (waypointId)
+ {
+ case 0:
+ DoScriptText(SAY_REM_START, me, player);
+ break;
+ case 5:
+ DoScriptText(SAY_REM_RAMP1_1, me, player);
+ break;
+ case 6:
+ DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ break;
+ case 9:
+ DoScriptText(SAY_REM_RAMP1_2, me, player);
+ break;
+ case 14:
+ //depend quest rewarded?
+ DoScriptText(SAY_REM_BOOK, me, player);
+ break;
+ case 15:
+ DoScriptText(SAY_REM_TENT1_1, me, player);
+ break;
+ case 16:
+ DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ break;
+ case 17:
+ DoScriptText(SAY_REM_TENT1_2, me, player);
+ break;
+ case 26:
+ DoScriptText(SAY_REM_MOSS, me, player);
+ break;
+ case 27:
+ DoScriptText(EMOTE_REM_MOSS, me, player);
+ break;
+ case 28:
+ DoScriptText(SAY_REM_MOSS_PROGRESS, me, player);
+ break;
+ case 29:
+ DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ break;
+ case 31:
+ DoScriptText(SAY_REM_PROGRESS, me, player);
+ break;
+ case 41:
+ DoScriptText(SAY_REM_REMEMBER, me, player);
+ break;
+ case 42:
+ DoScriptText(EMOTE_REM_END, me, player);
+ player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me);
+ break;
+ }
}
}
@@ -297,7 +298,7 @@ public:
void EnterCombat(Unit* who)
{
- if (rand()%2)
+ if (urand(0, 1))
DoScriptText(SAY_REM_AGGRO, me, who);
}
@@ -314,7 +315,7 @@ public:
# npc_threshwackonator
####*/
-enum eThreshwackonator
+enum Threshwackonator
{
EMOTE_START = -1000325, //signed for 4966
SAY_AT_CLOSE = -1000326, //signed for 4966
diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp
index f295d7626ac..e196c71f681 100644
--- a/src/server/scripts/Kalimdor/desolace.cpp
+++ b/src/server/scripts/Kalimdor/desolace.cpp
@@ -30,10 +30,12 @@ npc_dalinda_malem
go_demon_portal
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
-enum eDyingKodo
+enum DyingKodo
{
// signed for 9999
SAY_SMEED_HOME_1 = -1000348,
@@ -114,11 +116,11 @@ public:
{
npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
- uint32 m_uiDespawnTimer;
+ uint32 DespawnTimer;
void Reset()
{
- m_uiDespawnTimer = 0;
+ DespawnTimer = 0;
}
void MoveInLineOfSight(Unit* who)
@@ -143,14 +145,14 @@ public:
if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP)
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- m_uiDespawnTimer = 60000;
+ DespawnTimer = 60000;
}
}
void UpdateAI(const uint32 diff)
{
//timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat.
- if (m_uiDespawnTimer && m_uiDespawnTimer <= diff)
+ if (DespawnTimer && DespawnTimer <= diff)
{
if (!me->getVictim() && me->isAlive())
{
@@ -159,7 +161,7 @@ public:
me->Respawn();
return;
}
- } else m_uiDespawnTimer -= diff;
+ } else DespawnTimer -= diff;
if (!UpdateVictim())
return;
@@ -175,7 +177,7 @@ public:
## Hand of Iruxos
######*/
-enum
+enum Iruxos
{
QUEST_HAND_IRUXOS = 5381,
NPC_DEMON_SPIRIT = 11876,
@@ -199,7 +201,10 @@ class go_iruxos : public GameObjectScript
## npc_dalinda_malem. Quest 1440
######*/
-#define QUEST_RETURN_TO_VAHLARRIEL 1440
+enum Dalinda
+{
+ QUEST_RETURN_TO_VAHLARRIEL = 1440
+};
class npc_dalinda : public CreatureScript
{
@@ -255,9 +260,9 @@ public:
return;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 Diff)
{
- npc_escortAI::UpdateAI(uiDiff);
+ npc_escortAI::UpdateAI(Diff);
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp
index 88bc3352ea1..ec06a542b6f 100644
--- a/src/server/scripts/Kalimdor/durotar.cpp
+++ b/src/server/scripts/Kalimdor/durotar.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "Vehicle.h"
+#include "SpellScript.h"
/*######
##Quest 5441: Lazy Peons
@@ -50,15 +52,15 @@ public:
{
npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature) {}
- uint64 uiPlayerGUID;
+ uint64 PlayerGUID;
- uint32 m_uiRebuffTimer;
+ uint32 RebuffTimer;
bool work;
void Reset()
{
- uiPlayerGUID = 0;
- m_uiRebuffTimer = 0;
+ PlayerGUID = 0;
+ RebuffTimer = 0;
work = false;
}
@@ -81,17 +83,17 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 Diff)
{
if (work == true)
me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD);
- if (m_uiRebuffTimer <= uiDiff)
+ if (RebuffTimer <= Diff)
{
DoCast(me, SPELL_BUFF_SLEEP);
- m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes
+ RebuffTimer = 300000; //Rebuff agian in 5 minutes
}
else
- m_uiRebuffTimer -= uiDiff;
+ RebuffTimer -= Diff;
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
@@ -264,7 +266,7 @@ class npc_tiger_matriarch : public CreatureScript
vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER);
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
}
- me->ForcedDespawn();
+ me->DespawnOrUnsummon();
}
void DamageTaken(Unit* attacker, uint32& damage)
@@ -287,7 +289,7 @@ class npc_tiger_matriarch : public CreatureScript
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
}
- me->ForcedDespawn();
+ me->DespawnOrUnsummon();
}
}
diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
index 4a1b67ba477..5800a6a58a0 100644
--- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
@@ -25,15 +25,17 @@ EndScriptData */
/* ContentData
mobs_risen_husk_spirit
-npc_deserter_agitator
npc_lady_jaina_proudmoore
npc_nat_pagle
npc_private_hendel
npc_cassa_crimsonwing - handled by npc_taxi
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
/*######
## mobs_risen_husk_spirit
@@ -129,96 +131,10 @@ class mobs_risen_husk_spirit : public CreatureScript
};
/*######
-## npc_deserter_agitator
+## npc_theramor_guard
######*/
-enum eDeserter
-{
- QUEST_TRAITORS_AMONG_US = 11126,
- NPC_THERAMORE_DESERTER = 23602,
-};
-
-const Position DeserterDisappearPos = {-3609.03f, -4332.91f, 9.39354f, 3.73862f};
-
-#define GOSSIP_ITEM_DESERTER "Your propaganda wont`t work on me. Spout your treasonous filth elsewhere traitor!"
-
-class npc_deserter_agitator : public CreatureScript
-{
-public:
- npc_deserter_agitator() : CreatureScript("npc_deserter_agitator") { }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (player->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DESERTER, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO);
-
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
-
- return true;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
-
- if (action == GOSSIP_SENDER_INFO)
- {
- player->CLOSE_GOSSIP_MENU();
- switch (urand(0, 1))
- {
- case 0:
- creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- creature->setFaction(14);
- creature->AI()->AttackStart(player);
- break;
- case 1:
- player->KilledMonsterCredit(NPC_THERAMORE_DESERTER, 0);
- creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- creature->SetSpeed(MOVE_RUN, creature->GetSpeedRate(MOVE_RUN), true);
- creature->setFaction(35);
- creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE);
- creature->SetReactState(REACT_PASSIVE);
- creature->GetMotionMaster()->MovePoint(1, DeserterDisappearPos);
- break;
- }
- }
-
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_deserter_agitatorAI(creature);
- }
-
- struct npc_deserter_agitatorAI : public ScriptedAI
- {
- npc_deserter_agitatorAI(Creature* creature) : ScriptedAI(creature) { }
-
- void Reset()
- {
- me->RestoreFaction();
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE);
- me->SetReactState(REACT_AGGRESSIVE);
- me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- }
-
- void MovementInform(uint32 uiType, uint32 uiId)
- {
- if (uiType != POINT_MOTION_TYPE)
- return;
-
- if (uiId == 1)
- me->DisappearAndDie();
- }
- };
-};
-
-/*######
-## npc_deserter_agitator
-######*/
-
-enum eTheramoreGuard
+enum TheramoreGuard
{
SAY_QUEST1 = -1000641,
SAY_QUEST2 = -1000642,
@@ -266,7 +182,7 @@ public:
DoScriptText(SAY_QUEST1, creature);
creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false);
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->uiYellTimer = 4000;
+ CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000;
CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->bYellTimer = true;
}
@@ -282,40 +198,40 @@ public:
{
npc_theramore_guardAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 uiYellTimer;
- uint32 uiStep;
+ uint32 YellTimer;
+ uint32 Step;
bool bYellTimer;
void Reset()
{
bYellTimer = false;
- uiStep = 0;
+ Step = 0;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 Diff)
{
if (!me->HasAura(SPELL_PROPAGANDIZED))
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- if (bYellTimer && uiYellTimer <= uiDiff)
+ if (bYellTimer && YellTimer <= Diff)
{
- switch (uiStep)
+ switch (Step)
{
case 0:
DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me);
- uiYellTimer = 3000;
- ++uiStep;
+ YellTimer = 3000;
+ ++Step;
break;
case 1:
DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
- uiStep = 0;
+ Step = 0;
bYellTimer = false;
break;
}
}
else
- uiYellTimer -= uiDiff;
+ YellTimer -= Diff;
}
};
};
@@ -324,7 +240,7 @@ public:
## npc_lady_jaina_proudmoore
######*/
-enum eLadyJaina
+enum LadyJaina
{
QUEST_JAINAS_AUTOGRAPH = 558,
SPELL_JAINAS_AUTOGRAPH = 23122
@@ -367,7 +283,7 @@ public:
## npc_nat_pagle
######*/
-enum eNatPagle
+enum NatPagle
{
QUEST_NATS_MEASURING_TAPE = 8227
};
@@ -408,7 +324,7 @@ public:
## npc_private_hendel
######*/
-enum eHendel
+enum Hendel
{
// looks like all this text ids are wrong.
SAY_PROGRESS_1_TER = -1000411, // signed for 3568
@@ -464,11 +380,11 @@ public:
AttackStart(pAttacker);
}
- void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
+ void DamageTaken(Unit* pDoneBy, uint32 &Damage)
{
- if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(20, uiDamage))
+ if (Damage > me->GetHealth() || me->HealthBelowPctDamaged(20, Damage))
{
- uiDamage = 0;
+ Damage = 0;
if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself())
player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me);
@@ -485,9 +401,9 @@ public:
## npc_zelfrax
######*/
-const Position MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f};
+Position const MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f};
-enum eZelfrax
+enum Zelfrax
{
SAY_ZELFRAX = -1000472,
SAY_ZELFRAX_2 = -1000473
@@ -525,9 +441,9 @@ public:
}
}
- void MovementInform(uint32 uiType, uint32 /*uiId*/)
+ void MovementInform(uint32 Type, uint32 /*Id*/)
{
- if (uiType != POINT_MOTION_TYPE)
+ if (Type != POINT_MOTION_TYPE)
return;
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
@@ -547,7 +463,7 @@ public:
DoScriptText(SAY_ZELFRAX_2, me);
}
- void UpdateAI(uint32 const /*uiDiff*/)
+ void UpdateAI(uint32 const /*Diff*/)
{
if (!UpdateVictim())
return;
@@ -562,7 +478,7 @@ public:
## npc_stinky
######*/
-enum eStinky
+enum Stinky
{
QUEST_STINKYS_ESCAPE_H = 1270,
QUEST_STINKYS_ESCAPE_A = 1222,
@@ -713,7 +629,7 @@ class spell_ooze_zap : public SpellScriptLoader
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
- if (!GetTargetUnit())
+ if (!GetExplTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
@@ -791,16 +707,16 @@ class spell_energize_aoe : public SpellScriptLoader
return true;
}
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
+ for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
- unitList.erase(itr++);
+ targets.erase(itr++);
}
- unitList.push_back(GetCaster());
+ targets.push_back(GetCaster());
}
void HandleScript(SpellEffIndex effIndex)
@@ -812,8 +728,8 @@ class spell_energize_aoe : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
@@ -847,7 +763,7 @@ public:
player->KilledMonsterCredit(NPC_THERAMORE_PRISONER, 0);
prisoner->AI()->Talk(SAY_FREE); // We also emote cry here (handled in creature_text.emote)
- prisoner->ForcedDespawn(6000);
+ prisoner->DespawnOrUnsummon(6000);
}
return true;
}
@@ -862,7 +778,6 @@ void AddSC_dustwallow_marsh()
new npc_zelfrax();
new npc_stinky();
new npc_theramore_guard();
- new npc_deserter_agitator();
new spell_ooze_zap();
new spell_ooze_zap_channel_end();
new spell_energize_aoe();
diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp
index e1f59ec26be..1a0aa7b21c0 100644
--- a/src/server/scripts/Kalimdor/felwood.cpp
+++ b/src/server/scripts/Kalimdor/felwood.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npcs_riverbreeze_and_silversky
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npcs_riverbreeze_and_silversky
@@ -35,6 +37,17 @@ EndContentData */
#define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon"
+enum RiverbreezeAndSilversky
+{
+ SPELL_CENARION_BEACON = 15120,
+
+ NPC_ARATHANDRIS_SILVERSKY = 9528,
+ NPC_MAYBESS_RIVERBREEZE = 9529,
+
+ QUEST_CLEASING_FELWOOD_A = 4101,
+ QUEST_CLEASING_FELWOOD_H = 4102
+};
+
class npcs_riverbreeze_and_silversky : public CreatureScript
{
public:
@@ -46,7 +59,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF+1)
{
player->CLOSE_GOSSIP_MENU();
- creature->CastSpell(player, 15120, false);
+ creature->CastSpell(player, SPELL_CENARION_BEACON, false);
}
return true;
}
@@ -58,9 +71,9 @@ public:
uint32 creatureId = creature->GetEntry();
- if (creatureId == 9528)
+ if (creatureId == NPC_ARATHANDRIS_SILVERSKY)
{
- if (player->GetQuestRewardStatus(4101))
+ if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_A))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(2848, creature->GetGUID());
@@ -70,9 +83,9 @@ public:
player->SEND_GOSSIP_MENU(2844, creature->GetGUID());
}
- if (creatureId == 9529)
+ if (creatureId == NPC_MAYBESS_RIVERBREEZE)
{
- if (player->GetQuestRewardStatus(4102))
+ if (player->GetQuestRewardStatus(QUEST_CLEASING_FELWOOD_H))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(2849, creature->GetGUID());
diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp
index 480b94d6767..4fcd20951c9 100644
--- a/src/server/scripts/Kalimdor/feralas.cpp
+++ b/src/server/scripts/Kalimdor/feralas.cpp
@@ -23,8 +23,10 @@ SDComment: Quest support: 3520, 2767, Special vendor Gregan Brewspewer
SDCategory: Feralas
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
/*######
## npc_gregan_brewspewer
@@ -68,7 +70,7 @@ public:
## npc_oox22fe
######*/
-enum eOOX
+enum OOX
{
//signed for 7806
SAY_OOX_START = -1000287,
diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp
index 08f5b2aa592..3c8d2267903 100644
--- a/src/server/scripts/Kalimdor/moonglade.cpp
+++ b/src/server/scripts/Kalimdor/moonglade.cpp
@@ -31,14 +31,16 @@ npc_clintar_spirit
npc_clintar_dreamwalker
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
/*######
## npc_bunthen_plainswind
######*/
-enum eBunthen
+enum Bunthen
{
QUEST_SEA_LION_HORDE = 30,
QUEST_SEA_LION_ALLY = 272,
@@ -218,70 +220,68 @@ public:
## npc_clintar_spirit
######*/
-float Clintar_spirit_WP[41][5] =
+float const Clintar_spirit_WP[41][5] =
{
- //pos_x pos_y pos_z orien waitTime
-{7465.28f, -3115.46f, 439.327f, 0.83f, 4000},
-{7476.49f, -3101, 443.457f, 0.89f, 0},
-{7486.57f, -3085.59f, 439.478f, 1.07f, 0},
-{7472.19f, -3085.06f, 443.142f, 3.07f, 0},
-{7456.92f, -3085.91f, 438.862f, 3.24f, 0},
-{7446.68f, -3083.43f, 438.245f, 2.40f, 0},
-{7446.17f, -3080.21f, 439.826f, 1.10f, 6000},
-{7452.41f, -3085.8f, 438.984f, 5.78f, 0},
-{7469.11f, -3084.94f, 443.048f, 6.25f, 0},
-{7483.79f, -3085.44f, 439.607f, 6.25f, 0},
-{7491.14f, -3090.96f, 439.983f, 5.44f, 0},
-{7497.62f, -3098.22f, 436.854f, 5.44f, 0},
-{7498.72f, -3113.41f, 434.596f, 4.84f, 0},
-{7500.06f, -3122.51f, 434.749f, 5.17f, 0},
-{7504.96f, -3131.53f, 434.475f, 4.74f, 0},
-{7504.31f, -3133.53f, 435.693f, 3.84f, 6000},
-{7504.55f, -3133.27f, 435.476f, 0.68f, 15000},
-{7501.99f, -3126.01f, 434.93f, 1.83f, 0},
-{7490.76f, -3114.97f, 434.431f, 2.51f, 0},
-{7479.64f, -3105.51f, 431.123f, 1.83f, 0},
-{7474.63f, -3086.59f, 428.994f, 1.83f, 2000},
-{7472.96f, -3074.18f, 427.566f, 1.57f, 0},
-{7472.25f, -3063, 428.268f, 1.55f, 0},
-{7473.46f, -3054.22f, 427.588f, 0.36f, 0},
-{7475.08f, -3053.6f, 428.653f, 0.36f, 6000},
-{7474.66f, -3053.56f, 428.433f, 3.19f, 4000},
-{7471.81f, -3058.84f, 427.073f, 4.29f, 0},
-{7472.16f, -3064.91f, 427.772f, 4.95f, 0},
-{7471.56f, -3085.36f, 428.924f, 4.72f, 0},
-{7473.56f, -3093.48f, 429.294f, 5.04f, 0},
-{7478.94f, -3104.29f, 430.638f, 5.23f, 0},
-{7484.46f, -3109.61f, 432.769f, 5.79f, 0},
-{7490.23f, -3111.08f, 434.431f, 0.02f, 0},
-{7496.29f, -3108, 434.783f, 1.15f, 0},
-{7497.46f, -3100.66f, 436.191f, 1.50f, 0},
-{7495.64f, -3093.39f, 438.349f, 2.10f, 0},
-{7492.44f, -3086.01f, 440.267f, 1.38f, 0},
-{7498.26f, -3076.44f, 440.808f, 0.71f, 0},
-{7506.4f, -3067.35f, 443.64f, 0.77f, 0},
-{7518.37f, -3057.42f, 445.584f, 0.74f, 0},
-{7517.51f, -3056.3f, 444.568f, 2.49f, 4500}
+ //pos_x pos_y pos_z orien waitTime
+ {7465.28f, -3115.46f, 439.327f, 0.83f, 4000},
+ {7476.49f, -3101, 443.457f, 0.89f, 0},
+ {7486.57f, -3085.59f, 439.478f, 1.07f, 0},
+ {7472.19f, -3085.06f, 443.142f, 3.07f, 0},
+ {7456.92f, -3085.91f, 438.862f, 3.24f, 0},
+ {7446.68f, -3083.43f, 438.245f, 2.40f, 0},
+ {7446.17f, -3080.21f, 439.826f, 1.10f, 6000},
+ {7452.41f, -3085.8f, 438.984f, 5.78f, 0},
+ {7469.11f, -3084.94f, 443.048f, 6.25f, 0},
+ {7483.79f, -3085.44f, 439.607f, 6.25f, 0},
+ {7491.14f, -3090.96f, 439.983f, 5.44f, 0},
+ {7497.62f, -3098.22f, 436.854f, 5.44f, 0},
+ {7498.72f, -3113.41f, 434.596f, 4.84f, 0},
+ {7500.06f, -3122.51f, 434.749f, 5.17f, 0},
+ {7504.96f, -3131.53f, 434.475f, 4.74f, 0},
+ {7504.31f, -3133.53f, 435.693f, 3.84f, 6000},
+ {7504.55f, -3133.27f, 435.476f, 0.68f, 15000},
+ {7501.99f, -3126.01f, 434.93f, 1.83f, 0},
+ {7490.76f, -3114.97f, 434.431f, 2.51f, 0},
+ {7479.64f, -3105.51f, 431.123f, 1.83f, 0},
+ {7474.63f, -3086.59f, 428.994f, 1.83f, 2000},
+ {7472.96f, -3074.18f, 427.566f, 1.57f, 0},
+ {7472.25f, -3063, 428.268f, 1.55f, 0},
+ {7473.46f, -3054.22f, 427.588f, 0.36f, 0},
+ {7475.08f, -3053.6f, 428.653f, 0.36f, 6000},
+ {7474.66f, -3053.56f, 428.433f, 3.19f, 4000},
+ {7471.81f, -3058.84f, 427.073f, 4.29f, 0},
+ {7472.16f, -3064.91f, 427.772f, 4.95f, 0},
+ {7471.56f, -3085.36f, 428.924f, 4.72f, 0},
+ {7473.56f, -3093.48f, 429.294f, 5.04f, 0},
+ {7478.94f, -3104.29f, 430.638f, 5.23f, 0},
+ {7484.46f, -3109.61f, 432.769f, 5.79f, 0},
+ {7490.23f, -3111.08f, 434.431f, 0.02f, 0},
+ {7496.29f, -3108, 434.783f, 1.15f, 0},
+ {7497.46f, -3100.66f, 436.191f, 1.50f, 0},
+ {7495.64f, -3093.39f, 438.349f, 2.10f, 0},
+ {7492.44f, -3086.01f, 440.267f, 1.38f, 0},
+ {7498.26f, -3076.44f, 440.808f, 0.71f, 0},
+ {7506.4f, -3067.35f, 443.64f, 0.77f, 0},
+ {7518.37f, -3057.42f, 445.584f, 0.74f, 0},
+ {7517.51f, -3056.3f, 444.568f, 2.49f, 4500}
};
-#define ASPECT_RAVEN 22915
-
-#define ASPECT_RAVEN_SUMMON_X 7472.96f
-#define ASPECT_RAVEN_SUMMON_Y -3074.18f
-#define ASPECT_RAVEN_SUMMON_Z 427.566f
-#define CLINTAR_SPIRIT_SUMMON_X 7459.2275f
-#define CLINTAR_SPIRIT_SUMMON_Y -3122.5632f
-#define CLINTAR_SPIRIT_SUMMON_Z 438.9842f
-#define CLINTAR_SPIRIT_SUMMON_O 0.8594f
-
-//from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong.
-#define CLINTAR_SPIRIT_SAY_START -1000286
-#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287
-#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 -1000288
-#define CLINTAR_SPIRIT_SAY_GET_ONE -1000289
-#define CLINTAR_SPIRIT_SAY_GET_TWO -1000290
-#define CLINTAR_SPIRIT_SAY_GET_THREE -1000291
-#define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292
+Position const AspectRavenSummon = {7472.96f, -3074.18f, 427.566f, 0.0f};
+Position const ClintarSpiritSummon = {7459.2275f, -3122.5632f, 438.9842f, 0.8594f};
+
+enum ClintarSpirit
+{
+ ASPECT_RAVEN = 22915,
+
+ //from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong.
+ CLINTAR_SPIRIT_SAY_START = -1000286,
+ CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 = -1000287,
+ CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 = -1000288,
+ CLINTAR_SPIRIT_SAY_GET_ONE = -1000289,
+ CLINTAR_SPIRIT_SAY_GET_TWO = -1000290,
+ CLINTAR_SPIRIT_SAY_GET_THREE = -1000291,
+ CLINTAR_SPIRIT_SAY_GET_FINAL = -1000292
+};
class npc_clintar_spirit : public CreatureScript
{
@@ -296,16 +296,19 @@ public:
struct npc_clintar_spiritAI : public npc_escortAI
{
public:
- npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {}
+ npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature)
+ {
+ PlayerGUID = 0;
+ }
- uint32 Step;
+ uint8 Step;
uint32 CurrWP;
- uint32 Event_Timer;
- uint32 checkPlayer_Timer;
+ uint32 EventTimer;
+ uint32 checkPlayerTimer;
uint64 PlayerGUID;
- bool Event_onWait;
+ bool EventOnWait;
void Reset()
{
@@ -313,10 +316,10 @@ public:
{
Step = 0;
CurrWP = 0;
- Event_Timer = 0;
+ EventTimer = 0;
PlayerGUID = 0;
- checkPlayer_Timer = 1000;
- Event_onWait = false;
+ checkPlayerTimer = 1000;
+ EventOnWait = false;
}
}
@@ -347,8 +350,7 @@ public:
void EnterCombat(Unit* who)
{
- uint32 rnd = rand()%2;
- switch (rnd)
+ switch (urand(0, 1))
{
case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break;
case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break;
@@ -357,9 +359,7 @@ public:
void StartEvent(Player* player)
{
- if (!player)
- return;
- if (player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
+ if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
{
for (uint8 i = 0; i < 41; ++i)
{
@@ -381,18 +381,18 @@ public:
return;
}
- if (!me->isInCombat() && !Event_onWait)
+ if (!me->isInCombat() && !EventOnWait)
{
- if (checkPlayer_Timer <= diff)
+ if (checkPlayerTimer <= diff)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player && player->isInCombat() && player->getAttackerForHelper())
AttackStart(player->getAttackerForHelper());
- checkPlayer_Timer = 1000;
- } else checkPlayer_Timer -= diff;
+ checkPlayerTimer = 1000;
+ } else checkPlayerTimer -= diff;
}
- if (Event_onWait && Event_Timer <= diff)
+ if (EventOnWait && EventTimer <= diff)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
@@ -409,11 +409,11 @@ public:
{
case 0:
me->Say(CLINTAR_SPIRIT_SAY_START, 0, PlayerGUID);
- Event_Timer = 8000;
+ EventTimer = 8000;
Step = 1;
break;
case 1:
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -422,13 +422,13 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133);
- Event_Timer = 5000;
+ EventTimer = 5000;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, player);
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -437,12 +437,12 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133);
- Event_Timer = 5000;
+ EventTimer = 5000;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -451,11 +451,11 @@ public:
{
case 0:
DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, player);
- Event_Timer = 15000;
+ EventTimer = 15000;
Step = 1;
break;
case 1:
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -463,19 +463,16 @@ public:
switch (Step)
{
case 0:
- {
- Creature* mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000);
- if (mob)
+ if (Creature* mob = me->SummonCreature(ASPECT_RAVEN, AspectRavenSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000))
{
mob->AddThreat(me, 10000.0f);
mob->AI()->AttackStart(me);
}
- Event_Timer = 2000;
+ EventTimer = 2000;
Step = 1;
break;
- }
case 1:
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -484,12 +481,12 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133);
- Event_Timer = 5000;
+ EventTimer = 5000;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -498,11 +495,11 @@ public:
{
case 0:
DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, player);
- Event_Timer = 4000;
+ EventTimer = 4000;
Step = 1;
break;
case 1:
- Event_onWait = false;
+ EventOnWait = false;
break;
}
break;
@@ -513,12 +510,12 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2);
DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, player);
player->CompleteQuest(10965);
- Event_Timer = 1500;
+ EventTimer = 1500;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
- Event_Timer = 3000;
+ EventTimer = 3000;
Step = 2;
break;
case 2:
@@ -530,19 +527,19 @@ public:
}
break;
default:
- Event_onWait = false;
+ EventOnWait = false;
break;
}
- } else if (Event_onWait) Event_Timer -= diff;
+ } else if (EventOnWait) EventTimer -= diff;
}
void WaypointReached(uint32 waypointId)
{
CurrWP = waypointId;
- Event_Timer = 0;
+ EventTimer = 0;
Step = 0;
- Event_onWait = true;
+ EventOnWait = true;
}
};
@@ -552,7 +549,10 @@ public:
# npc_clintar_dreamwalker
####*/
-#define CLINTAR_SPIRIT 22916
+enum Clintar
+{
+ CLINTAR_SPIRIT = 22916
+};
class npc_clintar_dreamwalker : public CreatureScript
{
@@ -562,11 +562,8 @@ public:
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
{
if (quest->GetQuestId() == 10965)
- {
- Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000);
- if (clintar_spirit)
+ if (Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, ClintarSpiritSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000))
CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player);
- }
return true;
}
diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp
index bd4cf55b7b2..5b35688c2b8 100644
--- a/src/server/scripts/Kalimdor/mulgore.cpp
+++ b/src/server/scripts/Kalimdor/mulgore.cpp
@@ -29,8 +29,9 @@ npc_kyle_frenzied
npc_plains_vision
EndContentData */
-#include "ScriptPCH.h"
-#include "ScriptedEscortAI.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
# npc_skorn_whitecloud
@@ -71,7 +72,7 @@ public:
# npc_kyle_frenzied
######*/
-enum eKyleFrenzied
+enum KyleFrenzied
{
//emote signed for 7780 but propably thats wrong id.
EMOTE_SEE_LUNCH = -1000340,
@@ -98,30 +99,30 @@ public:
{
npc_kyle_frenziedAI(Creature* creature) : ScriptedAI(creature) {}
- bool bEvent;
- bool m_bIsMovingToLunch;
- uint64 uiPlayerGUID;
- uint32 uiEventTimer;
- uint8 uiEventPhase;
+ bool EventActive;
+ bool IsMovingToLunch;
+ uint64 PlayerGUID;
+ uint32 EventTimer;
+ uint8 EventPhase;
void Reset()
{
- bEvent = false;
- m_bIsMovingToLunch = false;
- uiPlayerGUID = 0;
- uiEventTimer = 5000;
- uiEventPhase = 0;
+ EventActive = false;
+ IsMovingToLunch = false;
+ PlayerGUID = 0;
+ EventTimer = 5000;
+ EventPhase = 0;
if (me->GetEntry() == NPC_KYLE_FRIENDLY)
me->UpdateEntry(NPC_KYLE_FRENZIED);
}
- void SpellHit(Unit* pCaster, SpellInfo const* pSpell)
+ void SpellHit(Unit* Caster, SpellInfo const* Spell)
{
- if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH)
+ if (!me->getVictim() && !EventActive && Spell->Id == SPELL_LUNCH)
{
- if (pCaster->GetTypeId() == TYPEID_PLAYER)
- uiPlayerGUID = pCaster->GetGUID();
+ if (Caster->GetTypeId() == TYPEID_PLAYER)
+ PlayerGUID = Caster->GetGUID();
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
@@ -130,41 +131,41 @@ public:
me->StopMoving();
}
- bEvent = true;
+ EventActive = true;
DoScriptText(EMOTE_SEE_LUNCH, me);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL);
}
}
- void MovementInform(uint32 uiType, uint32 uiPointId)
+ void MovementInform(uint32 Type, uint32 PointId)
{
- if (uiType != POINT_MOTION_TYPE || !bEvent)
+ if (Type != POINT_MOTION_TYPE || !EventActive)
return;
- if (uiPointId == POINT_ID)
- m_bIsMovingToLunch = false;
+ if (PointId == POINT_ID)
+ IsMovingToLunch = false;
}
void UpdateAI(const uint32 diff)
{
- if (bEvent)
+ if (EventActive)
{
- if (m_bIsMovingToLunch)
+ if (IsMovingToLunch)
return;
- if (uiEventTimer <= diff)
+ if (EventTimer <= diff)
{
- uiEventTimer = 5000;
- ++uiEventPhase;
+ EventTimer = 5000;
+ ++EventPhase;
- switch (uiEventPhase)
+ switch (EventPhase)
{
case 1:
- if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID))
+ if (Unit* unit = Unit::GetUnit(*me, PlayerGUID))
{
if (GameObject* go = unit->GetGameObject(SPELL_LUNCH))
{
- m_bIsMovingToLunch = true;
+ IsMovingToLunch = true;
me->GetMotionMaster()->MovePoint(POINT_ID, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
}
}
@@ -174,13 +175,13 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
break;
case 3:
- if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID))
+ if (Player* unit = Unit::GetPlayer(*me, PlayerGUID))
unit->TalkedToCreature(me->GetEntry(), me->GetGUID());
me->UpdateEntry(NPC_KYLE_FRIENDLY);
break;
case 4:
- uiEventTimer = 30000;
+ EventTimer = 30000;
DoScriptText(EMOTE_DANCE, me);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL);
break;
@@ -192,7 +193,7 @@ public:
}
}
else
- uiEventTimer -= diff;
+ EventTimer -= diff;
}
}
};
@@ -203,58 +204,58 @@ public:
# npc_plains_vision
######*/
-float wp_plain_vision[50][3] =
+Position const wpPlainVision[50] =
{
- {-2226.32f, -408.095f, -9.36235f},
- {-2203.04f, -437.212f, -5.72498f},
- {-2163.91f, -457.851f, -7.09049f},
- {-2123.87f, -448.137f, -9.29591f},
- {-2104.66f, -427.166f, -6.49513f},
- {-2101.48f, -422.826f, -5.3567f},
- {-2097.56f, -417.083f, -7.16716f},
- {-2084.87f, -398.626f, -9.88973f},
- {-2072.71f, -382.324f, -10.2488f},
- {-2054.05f, -356.728f, -6.22468f},
- {-2051.8f, -353.645f, -5.35791f},
- {-2049.08f, -349.912f, -6.15723f},
- {-2030.6f, -310.724f, -9.59302f},
- {-2002.15f, -249.308f, -10.8124f},
- {-1972.85f, -195.811f, -10.6316f},
- {-1940.93f, -147.652f, -11.7055f},
- {-1888.06f, -81.943f, -11.4404f},
- {-1837.05f, -34.0109f, -12.258f},
- {-1796.12f, -14.6462f, -10.3581f},
- {-1732.61f, -4.27746f, -10.0213f},
- {-1688.94f, -0.829945f, -11.7103f},
- {-1681.32f, 13.0313f, -9.48056f},
- {-1677.04f, 36.8349f, -7.10318f},
- {-1675.2f, 68.559f, -8.95384f},
- {-1676.57f, 89.023f, -9.65104f},
- {-1678.16f, 110.939f, -10.1782f},
- {-1677.86f, 128.681f, -5.73869f},
- {-1675.27f, 144.324f, -3.47916f},
- {-1671.7f, 163.169f, -1.23098f},
- {-1666.61f, 181.584f, 5.26145f},
- {-1661.51f, 196.154f, 8.95252f},
- {-1655.47f, 210.811f, 8.38727f},
- {-1647.07f, 226.947f, 5.27755f},
- {-1621.65f, 232.91f, 2.69579f},
- {-1600.23f, 237.641f, 2.98539f},
- {-1576.07f, 242.546f, 4.66541f},
- {-1554.57f, 248.494f, 6.60377f},
- {-1547.53f, 259.302f, 10.6741f},
- {-1541.7f, 269.847f, 16.4418f},
- {-1539.83f, 278.989f, 21.0597f},
- {-1540.16f, 290.219f, 27.8247f},
- {-1538.99f, 298.983f, 34.0032f},
- {-1540.38f, 307.337f, 41.3557f},
- {-1536.61f, 314.884f, 48.0179f},
- {-1532.42f, 323.277f, 55.6667f},
- {-1528.77f, 329.774f, 61.1525f},
- {-1525.65f, 333.18f, 63.2161f},
- {-1517.01f, 350.713f, 62.4286f},
- {-1511.39f, 362.537f, 62.4539f},
- {-1508.68f, 366.822f, 62.733f}
+ {-2226.32f, -408.095f, -9.36235f, 0.0f},
+ {-2203.04f, -437.212f, -5.72498f, 0.0f},
+ {-2163.91f, -457.851f, -7.09049f, 0.0f},
+ {-2123.87f, -448.137f, -9.29591f, 0.0f},
+ {-2104.66f, -427.166f, -6.49513f, 0.0f},
+ {-2101.48f, -422.826f, -5.3567f, 0.0f},
+ {-2097.56f, -417.083f, -7.16716f, 0.0f},
+ {-2084.87f, -398.626f, -9.88973f, 0.0f},
+ {-2072.71f, -382.324f, -10.2488f, 0.0f},
+ {-2054.05f, -356.728f, -6.22468f, 0.0f},
+ {-2051.8f, -353.645f, -5.35791f, 0.0f},
+ {-2049.08f, -349.912f, -6.15723f, 0.0f},
+ {-2030.6f, -310.724f, -9.59302f, 0.0f},
+ {-2002.15f, -249.308f, -10.8124f, 0.0f},
+ {-1972.85f, -195.811f, -10.6316f, 0.0f},
+ {-1940.93f, -147.652f, -11.7055f, 0.0f},
+ {-1888.06f, -81.943f, -11.4404f, 0.0f},
+ {-1837.05f, -34.0109f, -12.258f, 0.0f},
+ {-1796.12f, -14.6462f, -10.3581f, 0.0f},
+ {-1732.61f, -4.27746f, -10.0213f, 0.0f},
+ {-1688.94f, -0.829945f, -11.7103f, 0.0f},
+ {-1681.32f, 13.0313f, -9.48056f, 0.0f},
+ {-1677.04f, 36.8349f, -7.10318f, 0.0f},
+ {-1675.2f, 68.559f, -8.95384f, 0.0f},
+ {-1676.57f, 89.023f, -9.65104f, 0.0f},
+ {-1678.16f, 110.939f, -10.1782f, 0.0f},
+ {-1677.86f, 128.681f, -5.73869f, 0.0f},
+ {-1675.27f, 144.324f, -3.47916f, 0.0f},
+ {-1671.7f, 163.169f, -1.23098f, 0.0f},
+ {-1666.61f, 181.584f, 5.26145f, 0.0f},
+ {-1661.51f, 196.154f, 8.95252f, 0.0f},
+ {-1655.47f, 210.811f, 8.38727f, 0.0f},
+ {-1647.07f, 226.947f, 5.27755f, 0.0f},
+ {-1621.65f, 232.91f, 2.69579f, 0.0f},
+ {-1600.23f, 237.641f, 2.98539f, 0.0f},
+ {-1576.07f, 242.546f, 4.66541f, 0.0f},
+ {-1554.57f, 248.494f, 6.60377f, 0.0f},
+ {-1547.53f, 259.302f, 10.6741f, 0.0f},
+ {-1541.7f, 269.847f, 16.4418f, 0.0f},
+ {-1539.83f, 278.989f, 21.0597f, 0.0f},
+ {-1540.16f, 290.219f, 27.8247f, 0.0f},
+ {-1538.99f, 298.983f, 34.0032f, 0.0f},
+ {-1540.38f, 307.337f, 41.3557f, 0.0f},
+ {-1536.61f, 314.884f, 48.0179f, 0.0f},
+ {-1532.42f, 323.277f, 55.6667f, 0.0f},
+ {-1528.77f, 329.774f, 61.1525f, 0.0f},
+ {-1525.65f, 333.18f, 63.2161f, 0.0f},
+ {-1517.01f, 350.713f, 62.4286f, 0.0f},
+ {-1511.39f, 362.537f, 62.4539f, 0.0f},
+ {-1508.68f, 366.822f, 62.733f, 0.0f}
};
class npc_plains_vision : public CreatureScript
@@ -305,7 +306,7 @@ public:
{
if (newWaypoint)
{
- me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]);
+ me->GetMotionMaster()->MovePoint(WayPointId, wpPlainVision[WayPointId]);
newWaypoint = false;
}
}
diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp
index 2ff2d28768a..fca8d0f5fc5 100644
--- a/src/server/scripts/Kalimdor/orgrimmar.cpp
+++ b/src/server/scripts/Kalimdor/orgrimmar.cpp
@@ -28,13 +28,15 @@ npc_shenthul
npc_thrall_warchief
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_shenthul
######*/
-enum eShenthul
+enum Shenthul
{
QUEST_SHATTERED_SALUTE = 2460
};
@@ -65,16 +67,16 @@ public:
bool CanTalk;
bool CanEmote;
- uint32 Salute_Timer;
- uint32 Reset_Timer;
+ uint32 SaluteTimer;
+ uint32 ResetTimer;
uint64 PlayerGUID;
void Reset()
{
CanTalk = false;
CanEmote = false;
- Salute_Timer = 6000;
- Reset_Timer = 0;
+ SaluteTimer = 6000;
+ ResetTimer = 0;
PlayerGUID = 0;
}
@@ -84,7 +86,7 @@ public:
{
if (CanEmote)
{
- if (Reset_Timer <= diff)
+ if (ResetTimer <= diff)
{
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
{
@@ -92,17 +94,17 @@ public:
player->FailQuest(QUEST_SHATTERED_SALUTE);
}
Reset();
- } else Reset_Timer -= diff;
+ } else ResetTimer -= diff;
}
if (CanTalk && !CanEmote)
{
- if (Salute_Timer <= diff)
+ if (SaluteTimer <= diff)
{
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
CanEmote = true;
- Reset_Timer = 60000;
- } else Salute_Timer -= diff;
+ ResetTimer = 60000;
+ } else SaluteTimer -= diff;
}
if (!UpdateVictim())
@@ -130,10 +132,13 @@ public:
## npc_thrall_warchief
######*/
-#define QUEST_6566 6566
+enum ThrallWarchief
+{
+ QUEST_6566 = 6566,
-#define SPELL_CHAIN_LIGHTNING 16033
-#define SPELL_SHOCK 16034
+ SPELL_CHAIN_LIGHTNING = 16033,
+ SPELL_SHOCK = 16034
+};
#define GOSSIP_HTW "Please share your wisdom with me, Warchief."
#define GOSSIP_STW1 "What discoveries?"
@@ -207,13 +212,13 @@ public:
{
npc_thrall_warchiefAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 ChainLightning_Timer;
- uint32 Shock_Timer;
+ uint32 ChainLightningTimer;
+ uint32 ShockTimer;
void Reset()
{
- ChainLightning_Timer = 2000;
- Shock_Timer = 8000;
+ ChainLightningTimer = 2000;
+ ShockTimer = 8000;
}
void EnterCombat(Unit* /*who*/) {}
@@ -223,17 +228,17 @@ public:
if (!UpdateVictim())
return;
- if (ChainLightning_Timer <= diff)
+ if (ChainLightningTimer <= diff)
{
DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING);
- ChainLightning_Timer = 9000;
- } else ChainLightning_Timer -= diff;
+ ChainLightningTimer = 9000;
+ } else ChainLightningTimer -= diff;
- if (Shock_Timer <= diff)
+ if (ShockTimer <= diff)
{
DoCast(me->getVictim(), SPELL_SHOCK);
- Shock_Timer = 15000;
- } else Shock_Timer -= diff;
+ ShockTimer = 15000;
+ } else ShockTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp
index 2e6234c3269..639de3dc3b2 100644
--- a/src/server/scripts/Kalimdor/silithus.cpp
+++ b/src/server/scripts/Kalimdor/silithus.cpp
@@ -29,7 +29,9 @@ npcs_rutgar_and_frankal
quest_a_pawn_on_the_eternal_pawn
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "Group.h"
/*###
@@ -125,9 +127,11 @@ public:
#define GOSSIP_ITEM14 "I should ask the monkey about this"
#define GOSSIP_ITEM15 "Then what..."
-//trigger creatures to kill
-#define TRIGGER_RUTGAR 15222
-#define TRIGGER_FRANKAL 15221
+enum RutgarAndFrankal //trigger creatures to kill
+{
+ TRIGGER_FRANKAL = 15221,
+ TRIGGER_RUTGAR = 15222
+};
class npcs_rutgar_and_frankal : public CreatureScript
{
@@ -223,7 +227,7 @@ public:
/*####
# quest_a_pawn_on_the_eternal_board (Defines)
####*/
-enum eEternalBoard
+enum EternalBoard
{
QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519,
@@ -290,7 +294,6 @@ TO DO: get correct spell IDs and timings for spells cast upon dragon transformat
TO DO: Dragons should use the HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF) after transformation, but for some unknown reason it doesnt work.
EndContentData */
-#define QUEST_A_PAWN_ON_THE_ETERNAL_BOARD 8519
#define EVENT_AREA_RADIUS 65 //65yds
#define EVENT_COOLDOWN 500000 //in ms. appear after event completed or failed (should be = Adds despawn time)
@@ -373,13 +376,8 @@ static QuestCinematic EventAnim[]=
{0, 0, 0}
};
-struct Location
-{
- float x, y, z, o;
-};
-
//Cordinates for Spawns
-static Location SpawnLocation[]=
+Position const SpawnLocation[] =
{
{-8085.0f, 1528.0f, 2.61f, 3.141592f}, //Kaldorei Infantry
{-8080.0f, 1526.0f, 2.61f, 3.141592f}, //Kaldorei Infantry
@@ -460,7 +458,7 @@ struct WaveData
int32 WaveTextId;
};
-static WaveData WavesInfo[] =
+static WaveData WavesInfo[5] =
{
{30, 0, 15423, 0, 0, 24000, 0}, // Kaldorei Soldier
{ 3, 35, 15424, 0, 0, 24000, 0}, // Anubisath Conqueror
@@ -475,7 +473,7 @@ struct SpawnSpells
uint32 Timer1, Timer2, SpellId;
};
-static SpawnSpells SpawnCast[]=//
+static SpawnSpells SpawnCast[4] =
{
{100000, 2000, 33652}, // Stop Time
{38500, 300000, 28528}, // Poison Cloud
@@ -972,20 +970,14 @@ public:
void SummonNextWave()
{
- //uint8 count = WavesInfo[WaveCount].SpawnCount;
uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint;
- //uint8 KaldoreiSoldierCount = 0;
- //uint8 AnubisathConquerorCount = 0;
- //uint8 QirajiWaspCount = 0;
- for (uint8 i = 0; i < 67; ++i)
+ uint8 count = locIndex + WavesInfo[WaveCount].SpawnCount;
+
+ for (uint8 i = locIndex; i <= count; ++i)
{
- float x = SpawnLocation[locIndex + i].x;
- float y = SpawnLocation[locIndex + i].y;
- float z = SpawnLocation[locIndex + i].z;
- float o = SpawnLocation[locIndex + i].o;
uint32 desptimer = WavesInfo[WaveCount].DespTimer;
- if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer))
+ if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer))
{
if (spawn->GetEntry() == 15423)
spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427+rand()%4);
@@ -1004,6 +996,7 @@ public:
}
}
}
+
WaveTimer = WavesInfo[WaveCount].SpawnTimer;
AnnounceTimer = WavesInfo[WaveCount].YellTimer;
}
diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
index 635bb50509e..d38395c7b37 100644
--- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
+++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
@@ -28,7 +28,9 @@ npc_braug_dimspirit
npc_kaya_flathoof
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
@@ -90,7 +92,7 @@ public:
## npc_kaya_flathoof
######*/
-enum eKaya
+enum Kaya
{
FACTION_ESCORTEE_H = 775,
diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp
index da0e0e738cf..9b742b495bb 100644
--- a/src/server/scripts/Kalimdor/tanaris.cpp
+++ b/src/server/scripts/Kalimdor/tanaris.cpp
@@ -33,7 +33,9 @@ npc_OOX17
npc_tooga
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
@@ -41,10 +43,13 @@ EndContentData */
## mob_aquementas
######*/
-#define AGGRO_YELL_AQUE -1000350
+enum Aquementas
+{
+ AGGRO_YELL_AQUE = -1000350,
-#define SPELL_AQUA_JET 13586
-#define SPELL_FROST_SHOCK 15089
+ SPELL_AQUA_JET = 13586,
+ SPELL_FROST_SHOCK = 15089
+};
class mob_aquementas : public CreatureScript
{
@@ -60,22 +65,22 @@ public:
{
mob_aquementasAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 SendItem_Timer;
- uint32 SwitchFaction_Timer;
+ uint32 SendItemTimer;
+ uint32 SwitchFactionTimer;
bool isFriendly;
- uint32 FrostShock_Timer;
- uint32 AquaJet_Timer;
+ uint32 FrostShockTimer;
+ uint32 AquaJetTimer;
void Reset()
{
- SendItem_Timer = 0;
- SwitchFaction_Timer = 10000;
+ SendItemTimer = 0;
+ SwitchFactionTimer = 10000;
me->setFaction(35);
isFriendly = true;
- AquaJet_Timer = 5000;
- FrostShock_Timer = 1000;
+ AquaJetTimer = 5000;
+ FrostShockTimer = 1000;
}
void SendItem(Unit* receiver)
@@ -101,11 +106,11 @@ public:
{
if (isFriendly)
{
- if (SwitchFaction_Timer <= diff)
+ if (SwitchFactionTimer <= diff)
{
me->setFaction(91);
isFriendly = false;
- } else SwitchFaction_Timer -= diff;
+ } else SwitchFactionTimer -= diff;
}
if (!UpdateVictim())
@@ -113,25 +118,25 @@ public:
if (!isFriendly)
{
- if (SendItem_Timer <= diff)
+ if (SendItemTimer <= diff)
{
if (me->getVictim()->GetTypeId() == TYPEID_PLAYER)
SendItem(me->getVictim());
- SendItem_Timer = 5000;
- } else SendItem_Timer -= diff;
+ SendItemTimer = 5000;
+ } else SendItemTimer -= diff;
}
- if (FrostShock_Timer <= diff)
+ if (FrostShockTimer <= diff)
{
DoCast(me->getVictim(), SPELL_FROST_SHOCK);
- FrostShock_Timer = 15000;
- } else FrostShock_Timer -= diff;
+ FrostShockTimer = 15000;
+ } else FrostShockTimer -= diff;
- if (AquaJet_Timer <= diff)
+ if (AquaJetTimer <= diff)
{
DoCast(me, SPELL_AQUA_JET);
- AquaJet_Timer = 15000;
- } else AquaJet_Timer -= diff;
+ AquaJetTimer = 15000;
+ } else AquaJetTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -143,20 +148,23 @@ public:
## npc_custodian_of_time
######*/
-#define WHISPER_CUSTODIAN_1 -1000217
-#define WHISPER_CUSTODIAN_2 -1000218
-#define WHISPER_CUSTODIAN_3 -1000219
-#define WHISPER_CUSTODIAN_4 -1000220
-#define WHISPER_CUSTODIAN_5 -1000221
-#define WHISPER_CUSTODIAN_6 -1000222
-#define WHISPER_CUSTODIAN_7 -1000223
-#define WHISPER_CUSTODIAN_8 -1000224
-#define WHISPER_CUSTODIAN_9 -1000225
-#define WHISPER_CUSTODIAN_10 -1000226
-#define WHISPER_CUSTODIAN_11 -1000227
-#define WHISPER_CUSTODIAN_12 -1000228
-#define WHISPER_CUSTODIAN_13 -1000229
-#define WHISPER_CUSTODIAN_14 -1000230
+enum CustodianOfTime
+{
+ WHISPER_CUSTODIAN_1 = -1000217,
+ WHISPER_CUSTODIAN_2 = -1000218,
+ WHISPER_CUSTODIAN_3 = -1000219,
+ WHISPER_CUSTODIAN_4 = -1000220,
+ WHISPER_CUSTODIAN_5 = -1000221,
+ WHISPER_CUSTODIAN_6 = -1000222,
+ WHISPER_CUSTODIAN_7 = -1000223,
+ WHISPER_CUSTODIAN_8 = -1000224,
+ WHISPER_CUSTODIAN_9 = -1000225,
+ WHISPER_CUSTODIAN_10 = -1000226,
+ WHISPER_CUSTODIAN_11 = -1000227,
+ WHISPER_CUSTODIAN_12 = -1000228,
+ WHISPER_CUSTODIAN_13 = -1000229,
+ WHISPER_CUSTODIAN_14 = -1000230
+};
class npc_custodian_of_time : public CreatureScript
{
@@ -174,69 +182,68 @@ public:
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
- if (!player)
- return;
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 0:
- DoScriptText(WHISPER_CUSTODIAN_1, me, player);
- break;
- case 1:
- DoScriptText(WHISPER_CUSTODIAN_2, me, player);
- break;
- case 2:
- DoScriptText(WHISPER_CUSTODIAN_3, me, player);
- break;
- case 3:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
- break;
- case 5:
- DoScriptText(WHISPER_CUSTODIAN_5, me, player);
- break;
- case 6:
- DoScriptText(WHISPER_CUSTODIAN_6, me, player);
- break;
- case 7:
- DoScriptText(WHISPER_CUSTODIAN_7, me, player);
- break;
- case 8:
- DoScriptText(WHISPER_CUSTODIAN_8, me, player);
- break;
- case 9:
- DoScriptText(WHISPER_CUSTODIAN_9, me, player);
- break;
- case 10:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
- break;
- case 13:
- DoScriptText(WHISPER_CUSTODIAN_10, me, player);
- break;
- case 14:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
- break;
- case 16:
- DoScriptText(WHISPER_CUSTODIAN_11, me, player);
- break;
- case 17:
- DoScriptText(WHISPER_CUSTODIAN_12, me, player);
- break;
- case 18:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
- break;
- case 22:
- DoScriptText(WHISPER_CUSTODIAN_13, me, player);
- break;
- case 23:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
- break;
- case 24:
- DoScriptText(WHISPER_CUSTODIAN_14, me, player);
- DoCast(player, 34883);
- // below here is temporary workaround, to be removed when spell works properly
- player->AreaExploredOrEventHappens(10277);
- break;
+ switch (waypointId)
+ {
+ case 0:
+ DoScriptText(WHISPER_CUSTODIAN_1, me, player);
+ break;
+ case 1:
+ DoScriptText(WHISPER_CUSTODIAN_2, me, player);
+ break;
+ case 2:
+ DoScriptText(WHISPER_CUSTODIAN_3, me, player);
+ break;
+ case 3:
+ DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ break;
+ case 5:
+ DoScriptText(WHISPER_CUSTODIAN_5, me, player);
+ break;
+ case 6:
+ DoScriptText(WHISPER_CUSTODIAN_6, me, player);
+ break;
+ case 7:
+ DoScriptText(WHISPER_CUSTODIAN_7, me, player);
+ break;
+ case 8:
+ DoScriptText(WHISPER_CUSTODIAN_8, me, player);
+ break;
+ case 9:
+ DoScriptText(WHISPER_CUSTODIAN_9, me, player);
+ break;
+ case 10:
+ DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ break;
+ case 13:
+ DoScriptText(WHISPER_CUSTODIAN_10, me, player);
+ break;
+ case 14:
+ DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ break;
+ case 16:
+ DoScriptText(WHISPER_CUSTODIAN_11, me, player);
+ break;
+ case 17:
+ DoScriptText(WHISPER_CUSTODIAN_12, me, player);
+ break;
+ case 18:
+ DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ break;
+ case 22:
+ DoScriptText(WHISPER_CUSTODIAN_13, me, player);
+ break;
+ case 23:
+ DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ break;
+ case 24:
+ DoScriptText(WHISPER_CUSTODIAN_14, me, player);
+ DoCast(player, 34883);
+ // below here is temporary workaround, to be removed when spell works properly
+ player->AreaExploredOrEventHappens(10277);
+ break;
+ }
}
}
@@ -259,7 +266,7 @@ public:
}
void EnterCombat(Unit* /*who*/) {}
- void Reset() { }
+ void Reset() {}
void UpdateAI(const uint32 diff)
{
@@ -416,7 +423,7 @@ public:
## npc_OOX17
######*/
-enum e00X17
+enum Npc00X17
{
//texts are signed for 7806
SAY_OOX_START = -1000287,
@@ -464,30 +471,29 @@ public:
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
- if (!player)
- return;
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 23:
- me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_OOX_AMBUSH, me);
- break;
- case 56:
- me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_OOX_AMBUSH, me);
- if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30))
- DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff);
- break;
- case 86:
- DoScriptText(SAY_OOX_END, me);
- player->GroupEventHappens(Q_OOX17, me);
- break;
+ switch (waypointId)
+ {
+ case 23:
+ me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ DoScriptText(SAY_OOX_AMBUSH, me);
+ break;
+ case 56:
+ me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ DoScriptText(SAY_OOX_AMBUSH, me);
+ if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30))
+ DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff);
+ break;
+ case 86:
+ DoScriptText(SAY_OOX_END, me);
+ player->GroupEventHappens(Q_OOX17, me);
+ break;
+ }
}
}
@@ -509,7 +515,7 @@ public:
# npc_tooga
####*/
-enum eTooga
+enum Tooga
{
SAY_TOOG_THIRST = -1000391,
SAY_TOOG_WORRIED = -1000392,
@@ -527,7 +533,7 @@ enum eTooga
FACTION_TOOG_ESCORTEE = 113
};
-const float m_afToWaterLoc[] = {-7032.664551f, -4906.199219f, -1.606446f};
+Position const ToWaterLoc = {-7032.664551f, -4906.199219f, -1.606446f, 0.0f};
class npc_tooga : public CreatureScript
{
@@ -554,17 +560,17 @@ public:
{
npc_toogaAI(Creature* creature) : FollowerAI(creature) { }
- uint32 m_uiCheckSpeechTimer;
- uint32 m_uiPostEventTimer;
- uint32 m_uiPhasePostEvent;
+ uint32 CheckSpeechTimer;
+ uint32 PostEventTimer;
+ uint32 PhasePostEvent;
uint64 TortaGUID;
void Reset()
{
- m_uiCheckSpeechTimer = 2500;
- m_uiPostEventTimer = 1000;
- m_uiPhasePostEvent = 0;
+ CheckSpeechTimer = 2500;
+ PostEventTimer = 1000;
+ PhasePostEvent = 0;
TortaGUID = 0;
}
@@ -577,11 +583,9 @@ public:
{
if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE))
{
- if (Player* player = GetLeaderForFollower())
- {
- if (player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE)
- player->GroupEventHappens(QUEST_TOOGA, me);
- }
+ Player* player = GetLeaderForFollower();
+ if (player && player->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE)
+ player->GroupEventHappens(QUEST_TOOGA, me);
TortaGUID = who->GetGUID();
SetFollowComplete(true);
@@ -589,27 +593,27 @@ public:
}
}
- void MovementInform(uint32 uiMotionType, uint32 uiPointId)
+ void MovementInform(uint32 MotionType, uint32 PointId)
{
- FollowerAI::MovementInform(uiMotionType, uiPointId);
+ FollowerAI::MovementInform(MotionType, PointId);
- if (uiMotionType != POINT_MOTION_TYPE)
+ if (MotionType != POINT_MOTION_TYPE)
return;
- if (uiPointId == POINT_ID_TO_WATER)
+ if (PointId == POINT_ID_TO_WATER)
SetFollowComplete();
}
- void UpdateFollowerAI(const uint32 uiDiff)
+ void UpdateFollowerAI(const uint32 Diff)
{
if (!UpdateVictim())
{
//we are doing the post-event, or...
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
- if (m_uiPostEventTimer <= uiDiff)
+ if (PostEventTimer <= Diff)
{
- m_uiPostEventTimer = 5000;
+ PostEventTimer = 5000;
Unit* pTorta = Unit::GetUnit(*me, TortaGUID);
if (!pTorta || !pTorta->isAlive())
@@ -619,7 +623,7 @@ public:
return;
}
- switch (m_uiPhasePostEvent)
+ switch (PhasePostEvent)
{
case 1:
DoScriptText(SAY_TOOG_POST_1, me);
@@ -638,27 +642,27 @@ public:
break;
case 6:
DoScriptText(SAY_TORT_POST_6, pTorta);
- me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]);
+ me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, ToWaterLoc);
break;
}
- ++m_uiPhasePostEvent;
+ ++PhasePostEvent;
}
else
- m_uiPostEventTimer -= uiDiff;
+ PostEventTimer -= Diff;
}
//...we are doing regular speech check
else if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- if (m_uiCheckSpeechTimer <= uiDiff)
+ if (CheckSpeechTimer <= Diff)
{
- m_uiCheckSpeechTimer = 5000;
+ CheckSpeechTimer = 5000;
if (urand(0, 9) > 8)
DoScriptText(RAND(SAY_TOOG_THIRST, SAY_TOOG_WORRIED), me);
}
else
- m_uiCheckSpeechTimer -= uiDiff;
+ CheckSpeechTimer -= Diff;
}
return;
diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp
index d7cac99c374..7f2b2fc7f05 100644
--- a/src/server/scripts/Kalimdor/teldrassil.cpp
+++ b/src/server/scripts/Kalimdor/teldrassil.cpp
@@ -27,14 +27,15 @@ EndScriptData */
npc_mist
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedFollowerAI.h"
/*####
# npc_mist
####*/
-enum eMist
+enum Mist
{
SAY_AT_HOME = -1000323,
EMOTE_AT_HOME = -1000324,
@@ -51,10 +52,8 @@ public:
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
{
if (quest->GetQuestId() == QUEST_MIST)
- {
if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, creature->AI()))
pMistAI->StartFollow(player, FACTION_DARNASSUS, quest);
- }
return true;
}
@@ -88,18 +87,16 @@ public:
{
DoScriptText(EMOTE_AT_HOME, me);
- if (Player* player = GetLeaderForFollower())
- {
- if (player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
- player->GroupEventHappens(QUEST_MIST, me);
- }
+ Player* player = GetLeaderForFollower();
+ if (player && player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
+ player->GroupEventHappens(QUEST_MIST, me);
//The follow is over (and for later development, run off to the woods before really end)
SetFollowComplete();
}
//call not needed here, no known abilities
- /*void UpdateFollowerAI(const uint32 uiDiff)
+ /*void UpdateFollowerAI(const uint32 Diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp
index c56991e2553..f4983558b67 100644
--- a/src/server/scripts/Kalimdor/the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/the_barrens.cpp
@@ -32,7 +32,9 @@ npc_twiggy_flathead
npc_wizzlecrank_shredder
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
@@ -41,7 +43,7 @@ EndContentData */
#define GOSSIP_CORPSE "Examine corpse in detail..."
-enum eQuests
+enum BeatenCorpse
{
QUEST_LOST_IN_BATTLE = 4921
};
@@ -77,7 +79,7 @@ public:
# npc_gilthares
######*/
-enum eGilthares
+enum Gilthares
{
SAY_GIL_START = -1000370,
SAY_GIL_AT_LAST = -1000371,
@@ -214,7 +216,7 @@ public:
## npc_taskmaster_fizzule
######*/
-enum eEnums
+enum TaskmasterFizzule
{
FACTION_FRIENDLY_F = 35,
SPELL_FLARE = 10113,
@@ -240,13 +242,13 @@ public:
uint32 factionNorm;
bool IsFriend;
- uint32 Reset_Timer;
+ uint32 ResetTimer;
uint8 FlareCount;
void Reset()
{
IsFriend = false;
- Reset_Timer = 120000;
+ ResetTimer = 120000;
FlareCount = 0;
me->setFaction(factionNorm);
}
@@ -281,11 +283,11 @@ public:
{
if (IsFriend)
{
- if (Reset_Timer <= diff)
+ if (ResetTimer <= diff)
{
EnterEvadeMode();
return;
- } else Reset_Timer -= diff;
+ } else ResetTimer -= diff;
}
if (!UpdateVictim())
@@ -315,7 +317,7 @@ public:
## npc_twiggy_flathead
#####*/
-enum eTwiggyFlathead
+enum TwiggyFlathead
{
NPC_BIG_WILL = 6238,
NPC_AFFRAY_CHALLENGER = 6240,
@@ -327,7 +329,7 @@ enum eTwiggyFlathead
SAY_TWIGGY_FLATHEAD_OVER = -1000127,
};
-float AffrayChallengerLoc[6][4]=
+Position const AffrayChallengerLoc[6] =
{
{-1683.0f, -4326.0f, 2.79f, 0.0f},
{-1682.0f, -4329.0f, 2.79f, 0.0f},
@@ -354,10 +356,10 @@ public:
bool EventInProgress;
bool EventGrate;
bool EventBigWill;
- bool Challenger_down[6];
- uint32 Wave;
- uint32 Wave_Timer;
- uint32 Challenger_checker;
+ bool ChallengerDown[6];
+ uint8 Wave;
+ uint32 WaveTimer;
+ uint32 ChallengerChecker;
uint64 PlayerGUID;
uint64 AffrayChallenger[6];
uint64 BigWill;
@@ -367,15 +369,15 @@ public:
EventInProgress = false;
EventGrate = false;
EventBigWill = false;
- Wave_Timer = 600000;
- Challenger_checker = 0;
+ WaveTimer = 600000;
+ ChallengerChecker = 0;
Wave = 0;
PlayerGUID = 0;
for (uint8 i = 0; i < 6; ++i)
{
AffrayChallenger[i] = 0;
- Challenger_down[i] = false;
+ ChallengerDown[i] = false;
}
BigWill = 0;
}
@@ -408,42 +410,26 @@ public:
return;
if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) {
- EventInProgress = false;
DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me);
pWarrior->FailQuest(1719);
- for (uint8 i = 0; i < 6; ++i)
+ for (uint8 i = 0; i < 6; ++i) // unsummon challengers
{
if (AffrayChallenger[i])
{
Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]);
- if (creature) {
- if (creature->isAlive())
- {
- creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
- creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- creature->setDeathState(JUST_DIED);
- }
- }
+ if (creature && creature->isAlive())
+ creature->DisappearAndDie();
}
- AffrayChallenger[i] = 0;
- Challenger_down[i] = false;
}
- if (BigWill)
+ if (BigWill) // unsummon bigWill
{
Creature* creature = Unit::GetCreature((*me), BigWill);
- if (creature)
- {
- if (creature->isAlive())
- {
- creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
- creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- creature->setDeathState(JUST_DIED);
- }
- }
+ if (creature && creature->isAlive())
+ creature->DisappearAndDie();
}
- BigWill = 0;
+ Reset();
}
if (!EventGrate && EventInProgress)
@@ -453,11 +439,11 @@ public:
if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) {
pWarrior->AreaExploredOrEventHappens(1719);
- DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me);
+ DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me, pWarrior);
for (uint8 i = 0; i < 6; ++i)
{
- Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
+ Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
if (!creature)
continue;
creature->setFaction(35);
@@ -466,31 +452,31 @@ public:
creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
AffrayChallenger[i] = creature->GetGUID();
}
- Wave_Timer = 5000;
- Challenger_checker = 1000;
+ WaveTimer = 5000;
+ ChallengerChecker = 1000;
EventGrate = true;
}
}
else if (EventInProgress)
{
- if (Challenger_checker <= diff)
+ if (ChallengerChecker <= diff)
{
for (uint8 i = 0; i < 6; ++i)
{
if (AffrayChallenger[i])
{
Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]);
- if ((!creature || (!creature->isAlive())) && !Challenger_down[i])
+ if ((!creature || (!creature->isAlive())) && !ChallengerDown[i])
{
DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me);
- Challenger_down[i] = true;
+ ChallengerDown[i] = true;
}
}
}
- Challenger_checker = 1000;
- } else Challenger_checker -= diff;
+ ChallengerChecker = 1000;
+ } else ChallengerChecker -= diff;
- if (Wave_Timer <= diff)
+ if (WaveTimer <= diff)
{
if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill)
{
@@ -504,7 +490,7 @@ public:
creature->setFaction(14);
creature->AI()->AttackStart(pWarrior);
++Wave;
- Wave_Timer = 20000;
+ WaveTimer = 20000;
}
}
else if (Wave >= 6 && !EventBigWill) {
@@ -516,7 +502,7 @@ public:
creature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79f);
creature->HandleEmoteCommand(EMOTE_STATE_READY_UNARMED);
EventBigWill = true;
- Wave_Timer = 1000;
+ WaveTimer = 1000;
}
}
else if (Wave >= 6 && EventBigWill && BigWill)
@@ -525,14 +511,10 @@ public:
if (!creature || !creature->isAlive())
{
DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me);
- EventInProgress = false;
- EventBigWill = false;
- EventGrate = false;
- PlayerGUID = 0;
- Wave = 0;
+ Reset();
}
}
- } else Wave_Timer -= diff;
+ } else WaveTimer -= diff;
}
}
}
@@ -544,7 +526,7 @@ public:
## npc_wizzlecrank_shredder
#####*/
-enum eEnums_Wizzlecrank
+enum Wizzlecrank
{
SAY_START = -1000298,
SAY_STARTUP1 = -1000299,
@@ -570,14 +552,14 @@ public:
{
npc_wizzlecrank_shredderAI(Creature* creature) : npc_escortAI(creature)
{
- m_bIsPostEvent = false;
- m_uiPostEventTimer = 1000;
- m_uiPostEventCount = 0;
+ IsPostEvent = false;
+ PostEventTimer = 1000;
+ PostEventCount = 0;
}
- bool m_bIsPostEvent;
- uint32 m_uiPostEventTimer;
- uint32 m_uiPostEventCount;
+ bool IsPostEvent;
+ uint32 PostEventTimer;
+ uint32 PostEventCount;
void Reset()
{
@@ -586,9 +568,9 @@ public:
if (me->getStandState() == UNIT_STAND_STATE_DEAD)
me->SetStandState(UNIT_STAND_STATE_STAND);
- m_bIsPostEvent = false;
- m_uiPostEventTimer = 1000;
- m_uiPostEventCount = 0;
+ IsPostEvent = false;
+ PostEventTimer = 1000;
+ PostEventCount = 0;
}
}
@@ -610,19 +592,19 @@ public:
}
break;
case 24:
- m_bIsPostEvent = true;
+ IsPostEvent = true;
break;
}
}
- void WaypointStart(uint32 uiPointId)
+ void WaypointStart(uint32 PointId)
{
Player* player = GetPlayerForEscort();
if (!player)
return;
- switch (uiPointId)
+ switch (PointId)
{
case 9:
DoScriptText(SAY_STARTUP2, me, player);
@@ -643,15 +625,15 @@ public:
summoned->AI()->AttackStart(me);
}
- void UpdateEscortAI(const uint32 uiDiff)
+ void UpdateEscortAI(const uint32 Diff)
{
if (!UpdateVictim())
{
- if (m_bIsPostEvent)
+ if (IsPostEvent)
{
- if (m_uiPostEventTimer <= uiDiff)
+ if (PostEventTimer <= Diff)
{
- switch (m_uiPostEventCount)
+ switch (PostEventCount)
{
case 0:
DoScriptText(SAY_PROGRESS_2, me);
@@ -671,11 +653,11 @@ public:
break;
}
- ++m_uiPostEventCount;
- m_uiPostEventTimer = 5000;
+ ++PostEventCount;
+ PostEventTimer = 5000;
}
else
- m_uiPostEventTimer -= uiDiff;
+ PostEventTimer -= Diff;
}
return;
diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp
index 5b77b8dc2c0..b9ae356ddf1 100644
--- a/src/server/scripts/Kalimdor/thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/thousand_needles.cpp
@@ -32,14 +32,16 @@ npc_enraged_panther
go_panther_cage
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*#####
# npc_kanati
######*/
-enum eKanati
+enum Kanati
{
SAY_KAN_START = -1000410,
@@ -47,7 +49,7 @@ enum eKanati
NPC_GALAK_ASS = 10720
};
-const float m_afGalakLoc[]= {-4867.387695f, -1357.353760f, -48.226f };
+Position const GalakLoc = {-4867.387695f, -1357.353760f, -48.226f, 0.0f};
class npc_kanati : public CreatureScript
{
@@ -57,10 +59,9 @@ public:
bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest)
{
if (quest->GetQuestId() == QUEST_PROTECT_KANATI)
- {
if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanati::npc_kanatiAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest, true);
- }
+
return true;
}
@@ -73,7 +74,7 @@ public:
{
npc_kanatiAI(Creature* creature) : npc_escortAI(creature) { }
- void Reset() { }
+ void Reset() {}
void WaypointReached(uint32 waypointId)
{
@@ -93,9 +94,7 @@ public:
void DoSpawnGalak()
{
for (int i = 0; i < 3; ++i)
- me->SummonCreature(NPC_GALAK_ASS,
- m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f,
- TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(NPC_GALAK_ASS, GalakLoc, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
}
void JustSummoned(Creature* summoned)
@@ -110,7 +109,7 @@ public:
# npc_lakota_windsong
######*/
-enum eLakota
+enum Lakota
{
SAY_LAKO_START = -1000365,
SAY_LAKO_LOOK_OUT = -1000366,
@@ -127,14 +126,14 @@ enum eLakota
ID_AMBUSH_3 = 4
};
-float m_afBanditLoc[6][6]=
+Position const BanditLoc[6] =
{
- {-4905.479492f, -2062.732666f, 84.352f},
- {-4915.201172f, -2073.528320f, 84.733f},
- {-4878.883301f, -1986.947876f, 91.966f},
- {-4877.503906f, -1966.113403f, 91.859f},
- {-4767.985352f, -1873.169189f, 90.192f},
- {-4788.861328f, -1888.007813f, 89.888f}
+ {-4905.479492f, -2062.732666f, 84.352f, 0.0f},
+ {-4915.201172f, -2073.528320f, 84.733f, 0.0f},
+ {-4878.883301f, -1986.947876f, 91.966f, 0.0f},
+ {-4877.503906f, -1966.113403f, 91.859f, 0.0f},
+ {-4767.985352f, -1873.169189f, 90.192f, 0.0f},
+ {-4788.861328f, -1888.007813f, 89.888f, 0.0f}
};
class npc_lakota_windsong : public CreatureScript
@@ -164,7 +163,7 @@ public:
{
npc_lakota_windsongAI(Creature* creature) : npc_escortAI(creature) { }
- void Reset() { }
+ void Reset() {}
void WaypointReached(uint32 waypointId)
{
@@ -189,12 +188,10 @@ public:
}
}
- void DoSpawnBandits(int uiAmbushId)
+ void DoSpawnBandits(int AmbushId)
{
for (int i = 0; i < 2; ++i)
- me->SummonCreature(NPC_GRIM_BANDIT,
- m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f,
- TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_GRIM_BANDIT, BanditLoc[i+AmbushId], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
}
};
@@ -204,7 +201,7 @@ public:
# npc_paoka_swiftmountain
######*/
-enum ePacka
+enum Packa
{
SAY_START = -1000362,
SAY_WYVERN = -1000363,
@@ -215,11 +212,11 @@ enum ePacka
FACTION_ESCORTEE = 232 //guessed
};
-float m_afWyvernLoc[3][3]=
+Position const WyvernLoc[3] =
{
- {-4990.606f, -906.057f, -5.343f},
- {-4970.241f, -927.378f, -4.951f},
- {-4985.364f, -952.528f, -5.199f}
+ {-4990.606f, -906.057f, -5.343f, 0.0f},
+ {-4970.241f, -927.378f, -4.951f, 0.0f},
+ {-4985.364f, -952.528f, -5.199f, 0.0f}
};
class npc_paoka_swiftmountain : public CreatureScript
@@ -249,7 +246,7 @@ public:
{
npc_paoka_swiftmountainAI(Creature* creature) : npc_escortAI(creature) { }
- void Reset() { }
+ void Reset() {}
void WaypointReached(uint32 waypointId)
{
@@ -272,9 +269,7 @@ public:
void DoSpawnWyvern()
{
for (int i = 0; i < 3; ++i)
- me->SummonCreature(NPC_WYVERN,
- m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f,
- TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
+ me->SummonCreature(NPC_WYVERN, WyvernLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
}
};
};
@@ -285,7 +280,7 @@ public:
#define GOSSIP_P "Please tell me the Phrase.."
-enum ePlucky
+enum Plucky
{
FACTION_FRIENDLY = 35,
QUEST_SCOOP = 1950,
@@ -328,17 +323,17 @@ public:
struct npc_pluckyAI : public ScriptedAI
{
- npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { m_uiNormFaction = creature->getFaction(); }
+ npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->getFaction(); }
- uint32 m_uiNormFaction;
- uint32 m_uiResetTimer;
+ uint32 NormFaction;
+ uint32 ResetTimer;
void Reset()
{
- m_uiResetTimer = 120000;
+ ResetTimer = 120000;
- if (me->getFaction() != m_uiNormFaction)
- me->setFaction(m_uiNormFaction);
+ if (me->getFaction() != NormFaction)
+ me->setFaction(NormFaction);
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -346,11 +341,11 @@ public:
DoCast(me, SPELL_PLUCKY_CHICKEN, false);
}
- void ReceiveEmote(Player* player, uint32 uiTextEmote)
+ void ReceiveEmote(Player* player, uint32 TextEmote)
{
if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE)
{
- if (uiTextEmote == TEXT_EMOTE_BECKON)
+ if (TextEmote == TEXT_EMOTE_BECKON)
{
me->setFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -358,7 +353,7 @@ public:
}
}
- if (uiTextEmote == TEXT_EMOTE_CHICKEN)
+ if (TextEmote == TEXT_EMOTE_CHICKEN)
{
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
return;
@@ -372,11 +367,11 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 Diff)
{
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
{
- if (m_uiResetTimer <= uiDiff)
+ if (ResetTimer <= Diff)
{
if (!me->getVictim())
EnterEvadeMode();
@@ -386,7 +381,7 @@ public:
return;
}
else
- m_uiResetTimer -= uiDiff;
+ ResetTimer -= Diff;
}
if (!UpdateVictim())
@@ -398,7 +393,7 @@ public:
};
-enum ePantherCage
+enum PantherCage
{
ENRAGED_PANTHER = 10992
};
diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp
index 5aa55ddea66..b8b05b9692f 100644
--- a/src/server/scripts/Kalimdor/thunder_bluff.cpp
+++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp
@@ -23,17 +23,22 @@ SDComment: Quest support: 925
SDCategory: Thunder Bluff
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*#####
# npc_cairne_bloodhoof
######*/
-#define SPELL_BERSERKER_CHARGE 16636
-#define SPELL_CLEAVE 16044
-#define SPELL_MORTAL_STRIKE 16856
-#define SPELL_THUNDERCLAP 23931
-#define SPELL_UPPERCUT 22916
+enum CairneBloodhoof
+{
+ SPELL_BERSERKER_CHARGE = 16636,
+ SPELL_CLEAVE = 16044,
+ SPELL_MORTAL_STRIKE = 16856,
+ SPELL_THUNDERCLAP = 23931,
+ SPELL_UPPERCUT = 22916
+};
#define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint."
//TODO: verify abilities/timers
@@ -75,19 +80,19 @@ public:
{
npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 BerserkerCharge_Timer;
- uint32 Cleave_Timer;
- uint32 MortalStrike_Timer;
- uint32 Thunderclap_Timer;
- uint32 Uppercut_Timer;
+ uint32 BerserkerChargeTimer;
+ uint32 CleaveTimer;
+ uint32 MortalStrikeTimer;
+ uint32 ThunderclapTimer;
+ uint32 UppercutTimer;
void Reset()
{
- BerserkerCharge_Timer = 30000;
- Cleave_Timer = 5000;
- MortalStrike_Timer = 10000;
- Thunderclap_Timer = 15000;
- Uppercut_Timer = 10000;
+ BerserkerChargeTimer = 30000;
+ CleaveTimer = 5000;
+ MortalStrikeTimer = 10000;
+ ThunderclapTimer = 15000;
+ UppercutTimer = 10000;
}
void EnterCombat(Unit* /*who*/) {}
@@ -97,37 +102,37 @@ public:
if (!UpdateVictim())
return;
- if (BerserkerCharge_Timer <= diff)
+ if (BerserkerChargeTimer <= diff)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
DoCast(target, SPELL_BERSERKER_CHARGE);
- BerserkerCharge_Timer = 25000;
- } else BerserkerCharge_Timer -= diff;
+ BerserkerChargeTimer = 25000;
+ } else BerserkerChargeTimer -= diff;
- if (Uppercut_Timer <= diff)
+ if (UppercutTimer <= diff)
{
DoCast(me->getVictim(), SPELL_UPPERCUT);
- Uppercut_Timer = 20000;
- } else Uppercut_Timer -= diff;
+ UppercutTimer = 20000;
+ } else UppercutTimer -= diff;
- if (Thunderclap_Timer <= diff)
+ if (ThunderclapTimer <= diff)
{
DoCast(me->getVictim(), SPELL_THUNDERCLAP);
- Thunderclap_Timer = 15000;
- } else Thunderclap_Timer -= diff;
+ ThunderclapTimer = 15000;
+ } else ThunderclapTimer -= diff;
- if (MortalStrike_Timer <= diff)
+ if (MortalStrikeTimer <= diff)
{
DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
- MortalStrike_Timer = 15000;
- } else MortalStrike_Timer -= diff;
+ MortalStrikeTimer = 15000;
+ } else MortalStrikeTimer -= diff;
- if (Cleave_Timer <= diff)
+ if (CleaveTimer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
- Cleave_Timer = 7000;
- } else Cleave_Timer -= diff;
+ CleaveTimer = 7000;
+ } else CleaveTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp
index 232dba404e0..786d2fc0cd3 100644
--- a/src/server/scripts/Kalimdor/ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp
@@ -28,11 +28,12 @@ npc_a-me
npc_ringo
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
-enum eAMeData
+enum AmeData
{
SAY_READY = -1000517,
SAY_AGGRO1 = -1000518,
@@ -76,41 +77,40 @@ public:
{
npc_ameAI(Creature* creature) : npc_escortAI(creature) {}
- uint32 DEMORALIZINGSHOUT_Timer;
+ uint32 DemoralizingShoutTimer;
void WaypointReached(uint32 waypointId)
{
- Player* player = GetPlayerForEscort();
- if (!player)
- return;
-
- switch (waypointId)
+ if (Player* player = GetPlayerForEscort())
{
- case 19:
- me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_AGGRO1, me, player);
- break;
- case 28:
- DoScriptText(SAY_SEARCH, me, player);
- break;
- case 38:
- me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_AGGRO2, me, player);
- break;
- case 49:
- me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_AGGRO3, me, player);
- break;
- case 55:
- DoScriptText(SAY_FINISH, me, player);
- player->GroupEventHappens(QUEST_CHASING_AME, me);
- break;
+ switch (waypointId)
+ {
+ case 19:
+ me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ DoScriptText(SAY_AGGRO1, me, player);
+ break;
+ case 28:
+ DoScriptText(SAY_SEARCH, me, player);
+ break;
+ case 38:
+ me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ DoScriptText(SAY_AGGRO2, me, player);
+ break;
+ case 49:
+ me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ DoScriptText(SAY_AGGRO3, me, player);
+ break;
+ case 55:
+ DoScriptText(SAY_FINISH, me, player);
+ player->GroupEventHappens(QUEST_CHASING_AME, me);
+ break;
+ }
}
}
void Reset()
{
- DEMORALIZINGSHOUT_Timer = 5000;
+ DemoralizingShoutTimer = 5000;
}
void JustSummoned(Creature* summoned)
@@ -130,11 +130,11 @@ public:
if (!UpdateVictim())
return;
- if (DEMORALIZINGSHOUT_Timer <= diff)
+ if (DemoralizingShoutTimer <= diff)
{
DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT);
- DEMORALIZINGSHOUT_Timer = 70000;
- } else DEMORALIZINGSHOUT_Timer -= diff;
+ DemoralizingShoutTimer = 70000;
+ } else DemoralizingShoutTimer -= diff;
}
};
};
@@ -143,7 +143,7 @@ public:
# npc_ringo
####*/
-enum eRingo
+enum Ringo
{
SAY_RIN_START_1 = -1000416,
SAY_RIN_START_2 = -1000417,
@@ -201,17 +201,17 @@ public:
{
npc_ringoAI(Creature* creature) : FollowerAI(creature) { }
- uint32 m_uiFaintTimer;
- uint32 m_uiEndEventProgress;
- uint32 m_uiEndEventTimer;
+ uint32 FaintTimer;
+ uint32 EndEventProgress;
+ uint32 EndEventTimer;
uint64 SpraggleGUID;
void Reset()
{
- m_uiFaintTimer = urand(30000, 60000);
- m_uiEndEventProgress = 0;
- m_uiEndEventTimer = 1000;
+ FaintTimer = urand(30000, 60000);
+ EndEventProgress = 0;
+ EndEventTimer = 1000;
SpraggleGUID = 0;
}
@@ -266,13 +266,13 @@ public:
SetFollowPaused(false);
}
- void UpdateFollowerAI(const uint32 uiDiff)
+ void UpdateFollowerAI(const uint32 Diff)
{
if (!UpdateVictim())
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
- if (m_uiEndEventTimer <= uiDiff)
+ if (EndEventTimer <= Diff)
{
Unit* pSpraggle = Unit::GetUnit(*me, SpraggleGUID);
if (!pSpraggle || !pSpraggle->isAlive())
@@ -281,64 +281,61 @@ public:
return;
}
- switch (m_uiEndEventProgress)
+ switch (EndEventProgress)
{
case 1:
DoScriptText(SAY_RIN_END_1, me);
- m_uiEndEventTimer = 3000;
+ EndEventTimer = 3000;
break;
case 2:
DoScriptText(SAY_SPR_END_2, pSpraggle);
- m_uiEndEventTimer = 5000;
+ EndEventTimer = 5000;
break;
case 3:
DoScriptText(SAY_RIN_END_3, me);
- m_uiEndEventTimer = 1000;
+ EndEventTimer = 1000;
break;
case 4:
DoScriptText(EMOTE_RIN_END_4, me);
SetFaint();
- m_uiEndEventTimer = 9000;
+ EndEventTimer = 9000;
break;
case 5:
DoScriptText(EMOTE_RIN_END_5, me);
ClearFaint();
- m_uiEndEventTimer = 1000;
+ EndEventTimer = 1000;
break;
case 6:
DoScriptText(SAY_RIN_END_6, me);
- m_uiEndEventTimer = 3000;
+ EndEventTimer = 3000;
break;
case 7:
DoScriptText(SAY_SPR_END_7, pSpraggle);
- m_uiEndEventTimer = 10000;
+ EndEventTimer = 10000;
break;
case 8:
DoScriptText(EMOTE_RIN_END_8, me);
- m_uiEndEventTimer = 5000;
+ EndEventTimer = 5000;
break;
case 9:
SetFollowComplete();
break;
}
- ++m_uiEndEventProgress;
+ ++EndEventProgress;
}
else
- m_uiEndEventTimer -= uiDiff;
+ EndEventTimer -= Diff;
}
- else if (HasFollowState(STATE_FOLLOW_INPROGRESS))
+ else if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !HasFollowState(STATE_FOLLOW_PAUSED))
{
- if (!HasFollowState(STATE_FOLLOW_PAUSED))
+ if (FaintTimer <= Diff)
{
- if (m_uiFaintTimer <= uiDiff)
- {
- SetFaint();
- m_uiFaintTimer = urand(60000, 120000);
- }
- else
- m_uiFaintTimer -= uiDiff;
+ SetFaint();
+ FaintTimer = urand(60000, 120000);
}
+ else
+ FaintTimer -= Diff;
}
return;
diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp
index ab5e4c4023a..2c4da0fdf7c 100644
--- a/src/server/scripts/Kalimdor/winterspring.cpp
+++ b/src/server/scripts/Kalimdor/winterspring.cpp
@@ -18,83 +18,18 @@
/* ScriptData
SDName: Winterspring
-SD%Complete: 90
-SDComment: Quest support: 5126 (Loraxs' tale missing proper gossip items text). Vendor Rivern Frostwind. Obtain Cache of Mau'ari
+SD%Complete: Almost Completely Emptied
+SDComment: Vendor Rivern Frostwind.
SDCategory: Winterspring
EndScriptData */
/* ContentData
-npc_lorax
npc_rivern_frostwind
-npc_witch_doctor_mauari
EndContentData */
-#include "ScriptPCH.h"
-
-/*######
-## npc_lorax
-######*/
-
-#define GOSSIP_HL "Talk to me"
-
-#define GOSSIP_SL1 "What do you do here?"
-#define GOSSIP_SL2 "I can help you"
-#define GOSSIP_SL3 "What deal?"
-#define GOSSIP_SL4 "Then what happened?"
-#define GOSSIP_SL5 "He is not safe, i'll make sure of that."
-
-class npc_lorax : public CreatureScript
-{
-public:
- npc_lorax() : CreatureScript("npc_lorax") { }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->SEND_GOSSIP_MENU(3759, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->SEND_GOSSIP_MENU(3760, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
- player->SEND_GOSSIP_MENU(3761, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
- player->SEND_GOSSIP_MENU(3762, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
- player->SEND_GOSSIP_MENU(3763, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+5:
- player->CLOSE_GOSSIP_MENU();
- player->AreaExploredOrEventHappens(5126);
- break;
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
-
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
-
- return true;
- }
-
-};
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## npc_rivern_frostwind
@@ -129,49 +64,7 @@ public:
};
-/*######
-## npc_witch_doctor_mauari
-######*/
-
-#define GOSSIP_HWDM "I'd like you to make me a new Cache of Mau'ari please."
-
-class npc_witch_doctor_mauari : public CreatureScript
-{
-public:
- npc_witch_doctor_mauari() : CreatureScript("npc_witch_doctor_mauari") { }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- player->CLOSE_GOSSIP_MENU();
- creature->CastSpell(player, 16351, false);
- }
-
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestRewardStatus(975))
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(3377, creature->GetGUID());
- }
- else
- player->SEND_GOSSIP_MENU(3375, creature->GetGUID());
-
- return true;
- }
-};
-
void AddSC_winterspring()
{
- new npc_lorax();
new npc_rivern_frostwind();
- new npc_witch_doctor_mauari();
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index 8f34fa56525..89064a5d18c 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -19,7 +19,8 @@
* Comment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users...
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
enum Spells
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
index ea757e86f4d..7f4da5666ff 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
//not in db
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 f1eaa0c87c5..e81d58b4ef3 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -19,7 +19,8 @@
* Comment: Missing AI for Twisted Visages
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
enum Spells
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 d6e50097765..7c167fb9c27 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -19,7 +19,8 @@
* Comment: Complete - BUT THE TRIGGER NEEDS DATA WHETHER THE PRISON OF TALDARAM IS OFFLINE !
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
enum Yells
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
index 328d1ab1cd4..f8e2fc0f99f 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
enum Spells
@@ -354,7 +355,7 @@ public:
//! HACK: Creature's can't have MOVEMENTFLAG_FLYING
me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
me->setFaction(16);
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
+ me->SetObjectScale(1.0f);
DoCast(me, SPELL_FLAME_SPHERE_VISUAL);
DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT);
DoCast(me, SPELL_FLAME_SPHERE_PERIODIC);
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index 74643e58e30..f870c61dd5f 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "ahnkahet.h"
/* Ahn'kahet encounters:
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index ca71d8c313e..dcf1338bc74 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "azjol_nerub.h"
enum Spells
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
index 6587631f249..2690ea13ab1 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
@@ -28,7 +28,8 @@
* Hadronox to make his way to you. When Hadronox enters the main room, she will web the doors, and no more non-elites will spawn.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "azjol_nerub.h"
enum Spells
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
index 4d83be53c93..1acc3b77a61 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
@@ -19,7 +19,8 @@
* Comment: Find in the future best timers and the event is not implemented.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "azjol_nerub.h"
enum Spells
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
index 12622174e29..4e06ac0ba3a 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "azjol_nerub.h"
#define MAX_ENCOUNTER 3
diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
index 31aa924365d..dd8dd17c947 100644
--- a/src/server/scripts/Northrend/CMakeLists.txt
+++ b/src/server/scripts/Northrend/CMakeLists.txt
@@ -10,6 +10,7 @@
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
+ Northrend/wintergrasp.cpp
Northrend/isle_of_conquest.cpp
Northrend/storm_peaks.cpp
Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
@@ -22,7 +23,7 @@ set(scripts_STAT_SRCS
Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
Northrend/Ulduar/Ulduar/boss_thorim.cpp
Northrend/Ulduar/Ulduar/boss_ignis.cpp
- Northrend/Ulduar/Ulduar/boss_algalon.cpp
+ Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
Northrend/Ulduar/Ulduar/instance_ulduar.cpp
Northrend/Ulduar/Ulduar/boss_auriaya.cpp
Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index b115a4ee827..a9d6d9d91ba 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -15,7 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "obsidian_sanctum.h"
enum eEnums
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
index 91d67697ebb..7d4438ed7c7 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "obsidian_sanctum.h"
#define MAX_ENCOUNTER 1
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
index b2cf755c7af..41eb31d815d 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ruby_sanctum.h"
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
index 4e5e01cc745..c4008564029 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruby_sanctum.h"
enum Texts
@@ -186,7 +187,7 @@ class ConflagrationTargetSelector
public:
ConflagrationTargetSelector() { }
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* unit) const
{
return unit->GetTypeId() != TYPEID_PLAYER;
}
@@ -201,12 +202,12 @@ class spell_saviana_conflagration_init : public SpellScriptLoader
{
PrepareSpellScript(spell_saviana_conflagration_init_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- unitList.remove_if (ConflagrationTargetSelector());
+ targets.remove_if(ConflagrationTargetSelector());
uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3);
- if (unitList.size() > maxSize)
- Trinity::Containers::RandomResizeList(unitList, maxSize);
+ if (targets.size() > maxSize)
+ Trinity::Containers::RandomResizeList(targets, maxSize);
}
void HandleDummy(SpellEffIndex effIndex)
@@ -218,7 +219,7 @@ class spell_saviana_conflagration_init : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_init_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
index f9e302d7634..5678bbbeb83 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ruby_sanctum.h"
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
index 19ae66b6a60..273c860a2ad 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ruby_sanctum.h"
enum Texts
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 305266ee628..d77c84b2978 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -22,7 +22,9 @@ SDComment: AI for Argent Soldiers are not implemented. AI from bosses need more
SDCategory: Trial of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "trial_of_the_champion.h"
#include "ScriptedEscortAI.h"
@@ -60,9 +62,9 @@ class OrientationCheck : public std::unary_function<Unit*, bool>
{
public:
explicit OrientationCheck(Unit* _caster) : caster(_caster) { }
- bool operator() (Unit* unit)
+ bool operator()(WorldObject* object)
{
- return !unit->isInFront(caster, 2.5f) || !unit->IsWithinDist(caster, 40.0f);
+ return !object->isInFront(caster, 2.5f) || !object->IsWithinDist(caster, 40.0f);
}
private:
@@ -76,15 +78,16 @@ class spell_eadric_radiance : public SpellScriptLoader
class spell_eadric_radiance_SpellScript : public SpellScript
{
PrepareSpellScript(spell_eadric_radiance_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (OrientationCheck(GetCaster()));
+ unitList.remove_if(OrientationCheck(GetCaster()));
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -216,8 +219,6 @@ public:
}
InstanceScript* instance;
-
- Creature* pMemory;
uint64 MemoryGUID;
bool bHealth;
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 9768b50b214..c56d44ceb08 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -22,7 +22,8 @@ SDComment: missing yells. not sure about timers.
SDCategory: Trial of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "trial_of_the_champion.h"
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 18c972b966c..f3b6078d536 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -23,7 +23,8 @@ SDComment: Is missing the ai to make the npcs look for a new mount and use it.
SDCategory: Trial Of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Vehicle.h"
#include "trial_of_the_champion.h"
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
index 9ccd136731a..310dd1003c3 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
@@ -21,7 +21,9 @@ SDComment:
SDCategory: Trial Of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "trial_of_the_champion.h"
#define MAX_ENCOUNTER 4
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 c8236ace88c..a2488513d63 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
@@ -26,7 +26,9 @@ EndScriptData */
npc_announcer_toc5
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "trial_of_the_champion.h"
#include "Vehicle.h"
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 c718c0cee5f..89fdcc7f725 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -31,20 +31,23 @@ EndScriptData */
// Scarab - Kill credit isn't crediting?
// FrostSph - often they are casting Permafrost a little above the ground
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
enum Yells
{
- SAY_INTRO = -1649055,
- SAY_AGGRO = -1649056,
- SAY_KILL1 = -1649057,
- SAY_KILL2 = -1649058,
- SAY_DEATH = -1649059,
- EMOTE_SPIKE = -1649060,
- SAY_BURROWER = -1649061,
- EMOTE_LEECHING_SWARM = -1649062,
- SAY_LEECHING_SWARM = -1649063,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_SUBMERGE = 2,
+ EMOTE_BURROWER = 3,
+ SAY_EMERGE = 4,
+ SAY_LEECHING_SWARM = 5,
+ EMOTE_LEECHING_SWARM = 6,
+ SAY_KILL_PLAYER = 7,
+ SAY_DEATH = 8,
+
+ EMOTE_SPIKE = 0,
};
enum Summons
@@ -104,7 +107,7 @@ enum BossSpells
SPELL_SPIKE_TELE = 66170,
};
-#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67856, 67855, 67857)
+#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67855, 67856, 67857)
enum SummonActions
{
@@ -194,7 +197,7 @@ public:
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me);
+ Talk(SAY_KILL_PLAYER);
if (instance)
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
@@ -204,7 +207,7 @@ public:
{
if (!m_bIntro)
{
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
m_bIntro = false;
}
}
@@ -222,7 +225,7 @@ public:
void JustDied(Unit* /*killer*/)
{
Summons.DespawnAll();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_ANUBARAK, DONE);
}
@@ -239,7 +242,7 @@ public:
break;
case NPC_SPIKE:
summoned->CombatStart(target);
- DoScriptText(EMOTE_SPIKE, me, target);
+ Talk(EMOTE_SPIKE, target->GetGUID());
break;
}
Summons.Summon(summoned);
@@ -257,7 +260,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetInCombatWithZone();
if (instance)
@@ -320,7 +323,7 @@ public:
DoCast(me, SPELL_SUBMERGE_ANUBARAK);
DoCast(me, SPELL_CLEAR_ALL_DEBUFFS);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- DoScriptText(SAY_BURROWER, me);
+ Talk(EMOTE_BURROWER);
m_uiScarabSummoned = 0;
m_uiSummonScarabTimer = 4*IN_MILLISECONDS;
m_uiStage = 2;
@@ -402,8 +405,8 @@ public:
{
m_bReachedPhase3 = true;
DoCastAOE(SPELL_LEECHING_SWARM);
- DoScriptText(EMOTE_LEECHING_SWARM, me);
- DoScriptText(SAY_LEECHING_SWARM, me);
+ Talk(EMOTE_LEECHING_SWARM);
+ Talk(SAY_LEECHING_SWARM);
}
if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK))
@@ -615,7 +618,7 @@ class mob_frost_sphere : public CreatureScript
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
DoCast(SPELL_PERMAFROST_VISUAL);
DoCast(SPELL_PERMAFROST);
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f);
+ me->SetObjectScale(2.0f);
break;
}
}
@@ -659,10 +662,16 @@ public:
m_uiTargetGUID = 0;
}
+ bool CanAIAttack(Unit const* victim) const
+ {
+ return victim->GetTypeId() == TYPEID_PLAYER;
+ }
+
void EnterCombat(Unit* who)
{
m_uiTargetGUID = who->GetGUID();
DoCast(who, SPELL_MARK);
+ Talk(EMOTE_SPIKE, who->GetGUID());
me->SetSpeed(MOVE_RUN, 0.5f);
m_uiSpeed = 0;
m_uiIncreaseSpeedTimer = 1*IN_MILLISECONDS;
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 79bbb470edf..c662daf3671 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -27,13 +27,15 @@ EndScriptData */
// All - untested
// Pets aren't being summoned by their masters
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "trial_of_the_crusader.h"
-enum eYell
+enum Yells
{
- SAY_GARROSH_KILL_ALLIANCE_PLAYER4 = -1649118,
- SAY_VARIAN_KILL_HORDE_PLAYER4 = -1649123,
+ SAY_KILL_PLAYER = 6,
};
enum eAIs
@@ -356,11 +358,12 @@ struct boss_faction_championsAI : public ScriptedAI
if (TeamInInstance == ALLIANCE)
{
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN)))
- DoScriptText(SAY_VARIAN_KILL_HORDE_PLAYER4+urand(0, 3), temp); // + cause we are on negative
+ temp->AI()->Talk(SAY_KILL_PLAYER);
}
else
- if (Creature* temp = me->FindNearestCreature(NPC_GARROSH, 300.f))
- DoScriptText(SAY_GARROSH_KILL_ALLIANCE_PLAYER4+urand(0, 3), temp); // + cause we are on negative
+ if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH)))
+ temp->AI()->Talk(SAY_KILL_PLAYER);
+
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
@@ -945,18 +948,18 @@ public:
};
-enum eWarlockSpells
+enum WarlockSpells
{
- SPELL_HELLFIRE = 65816,
- SPELL_CORRUPTION = 65810,
- SPELL_CURSE_OF_AGONY = 65814,
- SPELL_CURSE_OF_EXHAUSTION = 65815,
- SPELL_FEAR = 65809, //8s
- SPELL_SEARING_PAIN = 65819,
- SPELL_SHADOW_BOLT = 65821,
- SPELL_UNSTABLE_AFFLICTION = 65812,
- SPELL_SUMMON_FELHUNTER = 67514,
- H_SPELL_UNSTABLE_AFFLICTION = 68155, //15s
+ SPELL_HELLFIRE = 65816,
+ SPELL_CORRUPTION = 65810,
+ SPELL_CURSE_OF_AGONY = 65814,
+ SPELL_CURSE_OF_EXHAUSTION = 65815,
+ SPELL_FEAR = 65809, // 8s
+ SPELL_SEARING_PAIN = 65819,
+ SPELL_SHADOW_BOLT = 65821,
+ SPELL_UNSTABLE_AFFLICTION = 65812, // 15s
+ SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813,
+ SPELL_SUMMON_FELHUNTER = 67514,
};
class mob_toc_warlock : public CreatureScript
@@ -2030,6 +2033,40 @@ public:
};
};
+class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader
+{
+ public:
+ spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { }
+
+ class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL))
+ return false;
+ return true;
+ }
+
+ void HandleDispel(DispelInfo* dispelInfo)
+ {
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0));
+ }
+
+ void Register()
+ {
+ AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_faction_champion_warl_unstable_affliction_AuraScript();
+ }
+};
+
void AddSC_boss_faction_champions()
{
new boss_toc_champion_controller();
@@ -2049,4 +2086,5 @@ void AddSC_boss_faction_champions()
new mob_toc_retro_paladin();
new mob_toc_pet_warlock();
new mob_toc_pet_hunter();
+ new spell_faction_champion_warl_unstable_affliction();
}
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 6f817a6d0eb..10f7150351e 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -30,21 +30,24 @@ EndScriptData */
// Redone summon's scripts in SAI
// Add immunities to the boss and summons
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
enum Yells
{
- SAY_INTRO = -1649030,
- SAY_AGGRO = -1649031,
- SAY_DEATH = -1649032,
- EMOTE_INCINERATE = -1649033,
- SAY_INCINERATE = -1649034,
- EMOTE_LEGION_FLAME = -1649035,
- EMOTE_NETHER_PORTAL = -1649036,
- SAY_NETHER_PORTAL = -1649037,
- EMOTE_INFERNAL_ERUPTION = -1649038,
- SAY_INFERNAL_ERUPTION = -1649039,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_LEGION_FLAME = 2,
+ EMOTE_NETHER_PORTAL = 3,
+ SAY_MISTRESS_OF_PAIN = 4,
+ EMOTE_INCINERATE = 5,
+ SAY_INCINERATE = 6,
+ EMOTE_INFERNAL_ERUPTION = 7,
+ SAY_INFERNAL_ERUPTION = 8,
+ SAY_KILL_PLAYER = 9,
+ SAY_DEATH = 10,
+ SAY_BERSERK = 11,
};
enum Equipment
@@ -158,7 +161,7 @@ public:
void JustDied(Unit* /*killer*/)
{
Summons.DespawnAll();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_JARAXXUS, DONE);
}
@@ -173,7 +176,7 @@ public:
me->SetInCombatWithZone();
if (instance)
instance->SetData(TYPE_JARAXXUS, IN_PROGRESS);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 uiDiff)
@@ -183,16 +186,16 @@ public:
if (m_uiSummonInfernalEruptionTimer <= uiDiff)
{
- DoScriptText(EMOTE_INFERNAL_ERUPTION, me);
- DoScriptText(SAY_INFERNAL_ERUPTION, me);
+ Talk(EMOTE_INFERNAL_ERUPTION);
+ Talk(SAY_INFERNAL_ERUPTION);
DoCast(SPELL_INFERNAL_ERUPTION);
m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS;
} else m_uiSummonInfernalEruptionTimer -= uiDiff;
if (m_uiSummonNetherPortalTimer <= uiDiff)
{
- DoScriptText(EMOTE_NETHER_PORTAL, me);
- DoScriptText(SAY_NETHER_PORTAL, me);
+ Talk(EMOTE_NETHER_PORTAL);
+ Talk(SAY_MISTRESS_OF_PAIN);
DoCast(SPELL_NETHER_PORTAL);
m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS;
} else m_uiSummonNetherPortalTimer -= uiDiff;
@@ -214,8 +217,8 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))
{
- DoScriptText(EMOTE_INCINERATE, me, target);
- DoScriptText(SAY_INCINERATE, me);
+ Talk(EMOTE_INCINERATE, target->GetGUID());
+ Talk(SAY_INCINERATE);
DoCast(target, SPELL_INCINERATE_FLESH);
}
m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS);
@@ -231,7 +234,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))
{
- DoScriptText(EMOTE_LEGION_FLAME, me, target);
+ Talk(EMOTE_LEGION_FLAME, target->GetGUID());
DoCast(target, SPELL_LEGION_FLAME);
}
m_uiLegionFlameTimer = 30*IN_MILLISECONDS;
@@ -515,36 +518,6 @@ public:
};
-class spell_spinning_pain_spike : public SpellScriptLoader
-{
- public:
- spell_spinning_pain_spike() : SpellScriptLoader("spell_spinning_pain_spike") {}
-
- class spell_spinning_pain_spike_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_spinning_pain_spike_SpellScript);
-
- void HandleScript(SpellEffIndex /*eff*/)
- {
- Unit* target = GetHitUnit();
- if (!target)
- return;
-
- if (target->isAlive())
- SetHitDamage(target->CountPctFromMaxHealth(50));
- }
- void Register()
- {
- OnEffectHitTarget += SpellEffectFn(spell_spinning_pain_spike_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
- }
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_spinning_pain_spike_SpellScript();
- }
-};
-
void AddSC_boss_jaraxxus()
{
new boss_jaraxxus();
@@ -553,5 +526,4 @@ void AddSC_boss_jaraxxus()
new mob_fel_infernal();
new mob_nether_portal();
new mob_mistress_of_pain();
- new spell_spinning_pain_spike();
}
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 5bda32941c2..506467be8a5 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -29,21 +29,22 @@ EndScriptData */
// Snakes - miss the 1-hitkill from emerging
// - visual changes between mobile and stationary models seems not to work sometimes
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
enum Yells
{
- //Gormok
- SAY_SNOBOLLED = -1649000,
- //Acidmaw & Dreadscale
- SAY_SUBMERGE = -1649010,
- SAY_EMERGE = -1649011,
- SAY_BERSERK = -1649012,
- //Icehowl
- SAY_TRAMPLE_STARE = -1649020,
- SAY_TRAMPLE_FAIL = -1649021,
- SAY_TRAMPLE_START = -1649022,
+ // Gormok
+ EMOTE_SNOBOLLED = 0,
+
+ // Acidmaw & Dreadscale
+ EMOTE_ENRAGE = 0,
+
+ // Icehowl
+ EMOTE_TRAMPLE_START = 0,
+ EMOTE_TRAMPLE_CRASH = 1,
+ EMOTE_TRAMPLE_FAIL = 2,
};
enum Equipment
@@ -238,7 +239,7 @@ public:
if (m_uiSummonCount > 0)
{
me->SummonCreature(NPC_SNOBOLD_VASSAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN);
- DoScriptText(SAY_SNOBOLLED, me);
+ Talk(EMOTE_SNOBOLLED);
}
m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
} else m_uiSummonTimer -= diff;
@@ -459,12 +460,11 @@ struct boss_jormungarAI : public ScriptedAI
if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged)
{
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(SPELL_ENRAGE);
enraged = true;
- DoScriptText(SAY_BERSERK, me);
+ Talk(EMOTE_ENRAGE);
switch (stage)
{
case 0:
@@ -511,7 +511,6 @@ struct boss_jormungarAI : public ScriptedAI
case 1: // Submerge
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_SUBMERGE_0);
- DoScriptText(SAY_SUBMERGE, me);
me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
stage = 2;
case 2: // Wait til emerge
@@ -523,7 +522,6 @@ struct boss_jormungarAI : public ScriptedAI
break;
case 3: // Emerge
me->SetDisplayId(modelStationary);
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
DoCast(me, SPELL_EMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
@@ -557,7 +555,6 @@ struct boss_jormungarAI : public ScriptedAI
case 5: // Submerge
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_SUBMERGE_0);
- DoScriptText(SAY_SUBMERGE, me);
me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
stage = 6;
case 6: // Wait til emerge
@@ -569,7 +566,6 @@ struct boss_jormungarAI : public ScriptedAI
break;
case 7: // Emerge
me->SetDisplayId(modelMobile);
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
DoCast(me, SPELL_EMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
@@ -909,6 +905,8 @@ public:
if (m_uiMassiveCrashTimer <= diff)
{
me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room
+ SetCombatMovement(false);
+ me->AttackStop();
m_uiStage = 7; //Invalid (Do nothing more than move)
m_uiMassiveCrashTimer = 30*IN_MILLISECONDS;
} else m_uiMassiveCrashTimer -= diff;
@@ -917,23 +915,28 @@ public:
break;
case 1:
DoCastAOE(SPELL_MASSIVE_CRASH);
+ me->StopMoving();
+ me->AttackStop();
m_uiStage = 2;
break;
case 2:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
{
+ me->StopMoving();
+ me->AttackStop();
m_uiTrampleTargetGUID = target->GetGUID();
me->SetTarget(m_uiTrampleTargetGUID);
- DoScriptText(SAY_TRAMPLE_STARE, me, target);
m_bTrampleCasted = false;
- SetCombatMovement(false);
- me->GetMotionMaster()->MoveIdle();
+ //SetCombatMovement(false);
+ //me->GetMotionMaster()->MoveIdle();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_uiTrampleTimer = 4*IN_MILLISECONDS;
m_uiStage = 3;
} else m_uiStage = 6;
break;
case 3:
+ me->StopMoving();
+ me->AttackStop();
if (m_uiTrampleTimer <= diff)
{
if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID))
@@ -946,13 +949,15 @@ public:
me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX,
2*me->GetPositionY()-m_fTrampleTargetY,
me->GetPositionZ(),
- 10.0f, 20.0f); // 2: Hop Backwards
+ 20.0f, 30.0f); // 2: Hop Backwards
m_uiStage = 7; //Invalid (Do nothing more than move)
} else m_uiStage = 6;
} else m_uiTrampleTimer -= diff;
break;
case 4:
- DoScriptText(SAY_TRAMPLE_START, me);
+ me->StopMoving();
+ me->AttackStop();
+ Talk(EMOTE_TRAMPLE_START, m_uiTrampleTargetGUID);
me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1);
me->SetTarget(0);
m_uiStage = 5;
@@ -984,7 +989,12 @@ public:
if (!m_bTrampleCasted)
{
DoCast(me, SPELL_STAGGERED_DAZE);
- DoScriptText(SAY_TRAMPLE_FAIL, me);
+ Talk(EMOTE_TRAMPLE_CRASH);
+ }
+ else
+ {
+ DoCast(me, SPELL_FROTHING_RAGE, true);
+ Talk(EMOTE_TRAMPLE_FAIL);
}
m_bMovementStarted = false;
me->GetMotionMaster()->MovementExpired();
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 74b9c038482..a65eaebbc0c 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -27,22 +27,28 @@ EndScriptData */
// - They should be floating but they aren't respecting the floor =(
// - Hardcoded bullets spawner
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "trial_of_the_crusader.h"
enum Yells
{
- SAY_AGGRO = -1649040,
- SAY_DEATH = -1649041,
- SAY_BERSERK = -1649042,
- EMOTE_SHIELD = -1649043,
- SAY_SHIELD = -1649044,
- SAY_KILL1 = -1649045,
- SAY_KILL2 = -1649046,
- EMOTE_LIGHT_VORTEX = -1649047,
- SAY_LIGHT_VORTEX = -1649048,
- EMOTE_DARK_VORTEX = -1649049,
- SAY_DARK_VORTEX = -1649050,
+ SAY_AGGRO = 0,
+ SAY_NIGHT = 1,
+ SAY_LIGHT = 2,
+ EMOTE_VORTEX = 3,
+ EMOTE_TWINK_PACT = 4,
+ SAY_TWINK_PACT = 5,
+ SAY_KILL_PLAYER = 6,
+ SAY_BERSERK = 7,
+ SAY_DEATH = 8,
};
enum Equipment
@@ -159,7 +165,6 @@ struct boss_twin_baseAI : public ScriptedAI
uint32 m_uiTouchTimer;
uint32 m_uiBerserkTimer;
- int32 m_uiVortexSay;
int32 m_uiVortexEmote;
uint32 m_uiSisterNpcId;
uint32 m_uiMyEmphatySpellId;
@@ -171,7 +176,8 @@ struct boss_twin_baseAI : public ScriptedAI
uint32 m_uiSpikeSpellId;
uint32 m_uiTouchSpellId;
- void Reset() {
+ void Reset()
+ {
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
me->ModifyAuraState(m_uiAuraState, true);
@@ -216,7 +222,7 @@ struct boss_twin_baseAI : public ScriptedAI
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me);
+ Talk(SAY_KILL_PLAYER);
if (instance)
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
@@ -248,7 +254,7 @@ struct boss_twin_baseAI : public ScriptedAI
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
if (Creature* pSister = GetSister())
@@ -290,7 +296,7 @@ struct boss_twin_baseAI : public ScriptedAI
instance->SetData(TYPE_VALKIRIES, IN_PROGRESS);
}
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, m_uiSurgeSpellId);
}
@@ -328,8 +334,7 @@ struct boss_twin_baseAI : public ScriptedAI
{
if (Creature* pSister = GetSister())
pSister->AI()->DoAction(ACTION_VORTEX);
- DoScriptText(m_uiVortexEmote, me);
- DoScriptText(m_uiVortexSay, me);
+ Talk(m_uiVortexEmote);
DoCastAOE(m_uiVortexSpellId);
m_uiStage = 0;
m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS;
@@ -340,8 +345,8 @@ struct boss_twin_baseAI : public ScriptedAI
case 2: // Shield+Pact
if (m_uiSpecialAbilityTimer <= uiDiff)
{
- DoScriptText(EMOTE_SHIELD, me);
- DoScriptText(SAY_SHIELD, me);
+ Talk(EMOTE_TWINK_PACT);
+ Talk(SAY_TWINK_PACT);
if (Creature* pSister = GetSister())
{
pSister->AI()->DoAction(ACTION_PACT);
@@ -379,7 +384,7 @@ struct boss_twin_baseAI : public ScriptedAI
if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff)
{
DoCast(me, SPELL_BERSERK);
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
m_bIsBerserk = true;
}
else
@@ -418,8 +423,7 @@ public:
m_uiStage = 0;
m_uiWeapon = EQUIP_MAIN_1;
m_uiAuraState = AURA_STATE_UNKNOWN22;
- m_uiVortexEmote = EMOTE_LIGHT_VORTEX;
- m_uiVortexSay = SAY_LIGHT_VORTEX;
+ m_uiVortexEmote = EMOTE_VORTEX;
m_uiSisterNpcId = NPC_DARKBANE;
m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK;
m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER;
@@ -488,8 +492,7 @@ public:
m_uiStage = 1;
m_uiWeapon = EQUIP_MAIN_2;
m_uiAuraState = AURA_STATE_UNKNOWN19;
- m_uiVortexEmote = EMOTE_DARK_VORTEX;
- m_uiVortexSay = SAY_DARK_VORTEX;
+ m_uiVortexEmote = EMOTE_VORTEX;
m_uiSisterNpcId = NPC_LIGHTBANE;
m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT;
m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER;
@@ -759,7 +762,7 @@ class spell_powering_up : public SpellScriptLoader
uint32 spellId;
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Load()
{
spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster());
if (!sSpellMgr->GetSpellInfo(spellId))
@@ -769,7 +772,7 @@ class spell_powering_up : public SpellScriptLoader
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (Unit* target = GetTargetUnit())
+ if (Unit* target = GetExplTargetUnit())
if (urand(0, 99) < 15)
target->CastSpell(target, spellId, true);
}
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 1966e26b128..9767126371b 100755
--- 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
@@ -23,7 +23,8 @@ SDComment: by /dev/rsa
SDCategory: Trial of the Crusader
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "trial_of_the_crusader.h"
class instance_trial_of_the_crusader : public InstanceMapScript
@@ -46,6 +47,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
uint64 BarrentGUID;
uint64 TirionGUID;
+ uint64 TirionFordringGUID;
uint64 FizzlebangGUID;
uint64 GarroshGUID;
uint64 VarianGUID;
@@ -84,6 +86,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
TrialCounter = 50;
EventStage = 0;
+ TirionFordringGUID = 0;
+
TributeChestGUID = 0;
MainGateDoorGUID = 0;
@@ -146,6 +150,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case NPC_TIRION:
TirionGUID = creature->GetGUID();
break;
+ case NPC_TIRION_FORDRING:
+ TirionFordringGUID = creature->GetGUID();
+ break;
case NPC_FIZZLEBANG:
FizzlebangGUID = creature->GetGUID();
break;
@@ -237,10 +244,18 @@ class instance_trial_of_the_crusader : public InstanceMapScript
switch (type)
{
case TYPE_JARAXXUS:
+ // Cleanup Icehowl
+ if (Creature* icehowl = instance->GetCreature(IcehowlGUID))
+ icehowl->DespawnOrUnsummon();
if (data == DONE)
EventStage = 2000;
break;
case TYPE_CRUSADERS:
+ // Cleanup Jaraxxus
+ if (Creature* jaraxxus = instance->GetCreature(JaraxxusGUID))
+ jaraxxus->DespawnOrUnsummon();
+ if (Creature* fizzlebang = instance->GetCreature(FizzlebangGUID))
+ fizzlebang->DespawnOrUnsummon();
switch (data)
{
case IN_PROGRESS:
@@ -260,6 +275,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
break;
case TYPE_VALKIRIES:
+ // Cleanup chest
+ if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID))
+ cache->Delete();
switch (data)
{
case FAIL:
@@ -393,7 +411,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
if (type < MAX_ENCOUNTERS)
{
- sLog->outDetail("[ToCr] EncounterStatus[type %u] %u = data %u;", type, EncounterStatus[type], data);
+ sLog->outInfo(LOG_FILTER_TSCR, "[ToCr] EncounterStatus[type %u] %u = data %u;", type, EncounterStatus[type], data);
if (data == FAIL)
{
--TrialCounter;
@@ -421,6 +439,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
return BarrentGUID;
case NPC_TIRION:
return TirionGUID;
+ case NPC_TIRION_FORDRING:
+ return TirionFordringGUID;
case NPC_FIZZLEBANG:
return FizzlebangGUID;
case NPC_GARROSH:
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 1d4961eb8b4..37d08484f0b 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
@@ -27,50 +27,65 @@ EndScriptData */
// - Need better implementation of Gossip and correct gossip text and option
// - Misses Dalaran Teleport at the end.
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "trial_of_the_crusader.h"
enum eYells
{
- SAY_STAGE_0_01 = -1649070,
- SAY_STAGE_0_02 = -1649071,
- SAY_STAGE_0_03a = -1649072,
- SAY_STAGE_0_03h = -1649073,
- SAY_STAGE_0_04 = -1649074,
- SAY_STAGE_0_05 = -1649075,
- SAY_STAGE_0_06 = -1649076,
- SAY_STAGE_0_WIPE = -1649077,
- SAY_STAGE_1_01 = -1649080,
- SAY_STAGE_1_02 = -1649081,
- SAY_STAGE_1_03 = -1649082,
- SAY_STAGE_1_04 = -1649083,
- SAY_STAGE_1_05 = -1649030, //INTRO Jaraxxus
- SAY_STAGE_1_06 = -1649084,
- SAY_STAGE_1_07 = -1649086,
- SAY_STAGE_1_08 = -1649087,
- SAY_STAGE_1_09 = -1649088,
- SAY_STAGE_1_10 = -1649089,
- SAY_STAGE_1_11 = -1649090,
- SAY_STAGE_2_01 = -1649091,
- SAY_STAGE_2_02a = -1649092,
- SAY_STAGE_2_02h = -1649093,
- SAY_STAGE_2_03 = -1649094,
- SAY_STAGE_2_04a = -1649095,
- SAY_STAGE_2_04h = -1649096,
- SAY_STAGE_2_05a = -1649097,
- SAY_STAGE_2_05h = -1649098,
- SAY_STAGE_2_06 = -1649099,
- SAY_STAGE_3_01 = -1649100,
- SAY_STAGE_3_02 = -1649101,
- SAY_STAGE_3_03a = -1649102,
- SAY_STAGE_3_03h = -1649103,
- SAY_STAGE_4_01 = -1649104,
- SAY_STAGE_4_02 = -1649105,
- SAY_STAGE_4_03 = -1649106,
- SAY_STAGE_4_04 = -1649107,
- SAY_STAGE_4_05 = -1649108,
- SAY_STAGE_4_06 = -1649109,
- SAY_STAGE_4_07 = -1649110,
+ // Highlord Tirion Fordring - 34996
+ SAY_STAGE_0_01 = 0,
+ SAY_STAGE_0_02 = 1,
+ SAY_STAGE_0_04 = 2,
+ SAY_STAGE_0_05 = 3,
+ SAY_STAGE_0_06 = 4,
+ SAY_STAGE_0_WIPE = 5,
+ SAY_STAGE_1_01 = 6,
+ SAY_STAGE_1_07 = 7,
+ SAY_STAGE_1_08 = 8,
+ SAY_STAGE_1_11 = 9,
+ SAY_STAGE_2_01 = 10,
+ SAY_STAGE_2_03 = 11,
+ SAY_STAGE_2_06 = 12,
+ SAY_STAGE_3_01 = 13,
+ SAY_STAGE_3_02 = 14,
+ SAY_STAGE_4_01 = 15,
+ SAY_STAGE_4_03 = 16,
+
+ // Varian Wrynn
+ SAY_STAGE_0_03a = 0,
+ SAY_STAGE_1_10 = 1,
+ SAY_STAGE_2_02a = 2,
+ SAY_STAGE_2_04a = 3,
+ SAY_STAGE_2_05a = 4,
+ SAY_STAGE_3_03a = 5,
+
+ // Garrosh
+ SAY_STAGE_0_03h = 0,
+ SAY_STAGE_1_09 = 1,
+ SAY_STAGE_2_02h = 2,
+ SAY_STAGE_2_04h = 3,
+ SAY_STAGE_2_05h = 4,
+ SAY_STAGE_3_03h = 5,
+
+ // Wilfred Fizzlebang
+ SAY_STAGE_1_02 = 0,
+ SAY_STAGE_1_03 = 1,
+ SAY_STAGE_1_04 = 2,
+ SAY_STAGE_1_06 = 3,
+
+ // Lord Jaraxxus
+ SAY_STAGE_1_05 = 0,
+
+ // The Lich King
+ SAY_STAGE_4_02 = 0,
+ SAY_STAGE_4_05 = 1,
+ SAY_STAGE_4_04 = 2,
+
+ // Highlord Tirion Fordring - 36095
+ SAY_STAGE_4_06 = 0,
+ SAY_STAGE_4_07 = 1,
};
struct _Messages
@@ -287,13 +302,13 @@ class boss_lich_king_toc : public CreatureScript
switch (instance->GetData(TYPE_EVENT))
{
case 5010:
- DoScriptText(SAY_STAGE_4_02, me);
+ Talk(SAY_STAGE_4_02);
m_uiUpdateTimer = 3000;
me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]);
instance->SetData(TYPE_EVENT, 5020);
break;
case 5030:
- DoScriptText(SAY_STAGE_4_04, me);
+ Talk(SAY_STAGE_4_04);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
m_uiUpdateTimer = 10000;
instance->SetData(TYPE_EVENT, 5040);
@@ -310,7 +325,7 @@ class boss_lich_king_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 5060);
break;
case 5060:
- DoScriptText(SAY_STAGE_4_05, me);
+ Talk(SAY_STAGE_4_05);
me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
m_uiUpdateTimer = 2500;
instance->SetData(TYPE_EVENT, 5070);
@@ -369,7 +384,7 @@ class npc_fizzlebang_toc : public CreatureScript
void JustDied(Unit* killer)
{
- DoScriptText(SAY_STAGE_1_06, me, killer);
+ Talk(SAY_STAGE_1_06, killer->GetGUID());
instance->SetData(TYPE_EVENT, 1180);
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
{
@@ -428,18 +443,18 @@ class npc_fizzlebang_toc : public CreatureScript
m_uiUpdateTimer = 4000;
break;
case 1120:
- DoScriptText(SAY_STAGE_1_02, me);
+ Talk(SAY_STAGE_1_02);
instance->SetData(TYPE_EVENT, 1130);
m_uiUpdateTimer = 12000;
break;
case 1130:
me->GetMotionMaster()->MovementExpired();
- DoScriptText(SAY_STAGE_1_03, me);
+ Talk(SAY_STAGE_1_03);
me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI);
if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN))
{
m_uiTriggerGUID = pTrigger->GetGUID();
- pTrigger->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f);
+ pTrigger->SetObjectScale(2.0f);
pTrigger->SetDisplayId(22862);
pTrigger->CastSpell(pTrigger, SPELL_WILFRED_PORTAL, false);
}
@@ -456,7 +471,7 @@ class npc_fizzlebang_toc : public CreatureScript
if (Creature* pPortal = me->SummonCreature(NPC_WILFRED_PORTAL, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.71239f, TEMPSUMMON_MANUAL_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
- pPortal->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f);
+ pPortal->SetObjectScale(2.0f);
pPortal->CastSpell(pPortal, SPELL_WILFRED_PORTAL, false);
m_uiPortalGUID = pPortal->GetGUID();
}
@@ -468,7 +483,7 @@ class npc_fizzlebang_toc : public CreatureScript
m_uiUpdateTimer = 3000;
break;
case 1140:
- DoScriptText(SAY_STAGE_1_04, me);
+ Talk(SAY_STAGE_1_04);
if (Creature* temp = me->SummonCreature(NPC_JARAXXUS, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 5.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME))
{
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -490,7 +505,7 @@ class npc_fizzlebang_toc : public CreatureScript
break;
case 1144:
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
- DoScriptText(SAY_STAGE_1_05, temp);
+ temp->AI()->Talk(SAY_STAGE_1_05);
instance->SetData(TYPE_EVENT, 1150);
m_uiUpdateTimer = 5000;
break;
@@ -553,13 +568,13 @@ class npc_tirion_toc : public CreatureScript
{
case 110:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_01, me);
+ Talk(SAY_STAGE_0_01);
m_uiUpdateTimer = 22000;
instance->SetData(TYPE_EVENT, 120);
break;
case 140:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_02, me);
+ Talk(SAY_STAGE_0_02);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 150);
break;
@@ -585,7 +600,7 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 160);
break;
case 200:
- DoScriptText(SAY_STAGE_0_04, me);
+ Talk(SAY_STAGE_0_04);
m_uiUpdateTimer = 8000;
instance->SetData(TYPE_EVENT, 205);
break;
@@ -617,7 +632,7 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 230);
break;
case 300:
- DoScriptText(SAY_STAGE_0_05, me);
+ Talk(SAY_STAGE_0_05);
m_uiUpdateTimer = 8000;
instance->SetData(TYPE_EVENT, 305);
break;
@@ -644,54 +659,54 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 320);
break;
case 400:
- DoScriptText(SAY_STAGE_0_06, me);
+ Talk(SAY_STAGE_0_06);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 666:
- DoScriptText(SAY_STAGE_0_WIPE, me);
+ Talk(SAY_STAGE_0_WIPE);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 1010:
- DoScriptText(SAY_STAGE_1_01, me);
+ Talk(SAY_STAGE_1_01);
m_uiUpdateTimer = 7000;
instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
instance->SetData(TYPE_EVENT, 0);
break;
case 1180:
- DoScriptText(SAY_STAGE_1_07, me);
+ Talk(SAY_STAGE_1_07);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 0);
break;
case 2000:
- DoScriptText(SAY_STAGE_1_08, me);
+ Talk(SAY_STAGE_1_08);
m_uiUpdateTimer = 18000;
instance->SetData(TYPE_EVENT, 2010);
break;
case 2030:
- DoScriptText(SAY_STAGE_1_11, me);
+ Talk(SAY_STAGE_1_11);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 3000:
- DoScriptText(SAY_STAGE_2_01, me);
+ Talk(SAY_STAGE_2_01);
m_uiUpdateTimer = 12000;
instance->SetData(TYPE_EVENT, 3050);
break;
case 3001:
- DoScriptText(SAY_STAGE_2_01, me);
+ Talk(SAY_STAGE_2_01);
m_uiUpdateTimer = 12000;
instance->SetData(TYPE_EVENT, 3051);
break;
case 3060:
- DoScriptText(SAY_STAGE_2_03, me);
+ Talk(SAY_STAGE_2_03);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 3070);
break;
case 3061:
- DoScriptText(SAY_STAGE_2_03, me);
+ Talk(SAY_STAGE_2_03);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 3071);
break;
@@ -716,17 +731,17 @@ class npc_tirion_toc : public CreatureScript
break;
//Crusaders battle end
case 3100:
- DoScriptText(SAY_STAGE_2_06, me);
+ Talk(SAY_STAGE_2_06);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 4000:
- DoScriptText(SAY_STAGE_3_01, me);
+ Talk(SAY_STAGE_3_01);
m_uiUpdateTimer = 13000;
instance->SetData(TYPE_EVENT, 4010);
break;
case 4010:
- DoScriptText(SAY_STAGE_3_02, me);
+ Talk(SAY_STAGE_3_02);
if (Creature* temp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME))
{
temp->SetVisible(false);
@@ -767,17 +782,17 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 5000);
break;
case 5000:
- DoScriptText(SAY_STAGE_4_01, me);
+ Talk(SAY_STAGE_4_01);
m_uiUpdateTimer = 10000;
instance->SetData(TYPE_EVENT, 5005);
break;
case 5005:
m_uiUpdateTimer = 8000;
instance->SetData(TYPE_EVENT, 5010);
- me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5);
+ me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5);
break;
case 5020:
- DoScriptText(SAY_STAGE_4_03, me);
+ Talk(SAY_STAGE_4_03);
m_uiUpdateTimer = 1000;
instance->SetData(TYPE_EVENT, 0);
break;
@@ -787,14 +802,16 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 6005);
break;
case 6005:
- DoScriptText(SAY_STAGE_4_06, me);
+ if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING)))
+ tirionFordring->AI()->Talk(SAY_STAGE_4_06);
m_uiUpdateTimer = 20000;
instance->SetData(TYPE_EVENT, 6010);
break;
case 6010:
if (IsHeroic())
{
- DoScriptText(SAY_STAGE_4_07, me);
+ if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING)))
+ tirionFordring->AI()->Talk(SAY_STAGE_4_07);
m_uiUpdateTimer = 60000;
instance->SetData(TYPE_ANUBARAK, SPECIAL);
instance->SetData(TYPE_EVENT, 6020);
@@ -852,7 +869,7 @@ class npc_garrosh_toc : public CreatureScript
{
case 130:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_03h, me);
+ Talk(SAY_STAGE_0_03h);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 132);
break;
@@ -862,27 +879,27 @@ class npc_garrosh_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 140);
break;
case 2010:
- DoScriptText(SAY_STAGE_1_09, me);
+ Talk(SAY_STAGE_1_09);
m_uiUpdateTimer = 9000;
instance->SetData(TYPE_EVENT, 2020);
break;
case 3050:
- DoScriptText(SAY_STAGE_2_02h, me);
+ Talk(SAY_STAGE_2_02h);
m_uiUpdateTimer = 15000;
instance->SetData(TYPE_EVENT, 3060);
break;
case 3070:
- DoScriptText(SAY_STAGE_2_04h, me);
+ Talk(SAY_STAGE_2_04h);
m_uiUpdateTimer = 6000;
instance->SetData(TYPE_EVENT, 3080);
break;
case 3081:
- DoScriptText(SAY_STAGE_2_05h, me);
+ Talk(SAY_STAGE_2_05h);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 3091);
break;
case 4030:
- DoScriptText(SAY_STAGE_3_03h, me);
+ Talk(SAY_STAGE_3_03h);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 4040);
break;
@@ -933,7 +950,7 @@ class npc_varian_toc : public CreatureScript
{
case 120:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_03a, me);
+ Talk(SAY_STAGE_0_03a);
m_uiUpdateTimer = 2000;
instance->SetData(TYPE_EVENT, 122);
break;
@@ -943,27 +960,27 @@ class npc_varian_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 130);
break;
case 2020:
- DoScriptText(SAY_STAGE_1_10, me);
+ Talk(SAY_STAGE_1_10);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 2030);
break;
case 3051:
- DoScriptText(SAY_STAGE_2_02a, me);
+ Talk(SAY_STAGE_2_02a);
m_uiUpdateTimer = 10000;
instance->SetData(TYPE_EVENT, 3061);
break;
case 3071:
- DoScriptText(SAY_STAGE_2_04a, me);
+ Talk(SAY_STAGE_2_04a);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 3081);
break;
case 3080:
- DoScriptText(SAY_STAGE_2_05a, me);
+ Talk(SAY_STAGE_2_05a);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 3090);
break;
case 4020:
- DoScriptText(SAY_STAGE_3_03a, me);
+ Talk(SAY_STAGE_3_03a);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 4040);
break;
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 99525b6fb32..ba230551b24 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
@@ -53,8 +53,8 @@ const Position ToCCommonLoc[]=
{563.833008f, 195.244995f, 394.585561f, 0}, // 5 - Center
{573.5f, 180.5f, 395.14f, 0}, // 6 Move 0 Right
{553.5f, 180.5f, 395.14f, 0}, // 7 Move 0 Left
- {585.5f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
- {545.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
+ {573.0f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
+ {555.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
{563.8f, 216.1f, 395.1f, 0}, // 10 Behind the door
{575.042358f, 195.260727f, 395.137146f, 0}, // 5
@@ -162,6 +162,7 @@ enum eCreature
{
NPC_BARRENT = 34816,
NPC_TIRION = 34996,
+ NPC_TIRION_FORDRING = 36095,
NPC_FIZZLEBANG = 35458,
NPC_GARROSH = 34995,
NPC_VARIAN = 34990,
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
index 95acc79231d..8b39fc51766 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
@@ -19,7 +19,8 @@
* Comment: MAYBE need more improve the "Raptor Call".
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
index 9ff8ee9c9ed..5d9acf4fca7 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
index b1d588a0d0d..969ccf4a059 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index 26e4e9db99e..b6a4c40abdd 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -19,7 +19,9 @@
* Comment: TODO: spawn troll waves
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "drak_tharon_keep.h"
enum Spells
diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
index aff3f1b8e36..99401c1d944 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "drak_tharon_keep.h"
#define MAX_ENCOUNTER 4
@@ -69,6 +70,7 @@ public:
void Initialize()
{
+ memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
uiTrollgore = 0;
uiNovos = 0;
uiDred = 0;
@@ -189,16 +191,12 @@ public:
{
OUT_SAVE_INST_DATA;
- std::string str_data;
-
std::ostringstream saveStream;
saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- str_data = saveStream.str();
-
OUT_SAVE_INST_DATA_COMPLETE;
- return str_data;
+ return saveStream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
index 4a28ebe6495..b790ed518d5 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "forge_of_souls.h"
@@ -359,7 +361,7 @@ class DistanceCheck
public:
explicit DistanceCheck(Unit* _caster) : caster(_caster) { }
- bool operator() (Unit* unit)
+ bool operator() (WorldObject* unit) const
{
if (caster->GetExactDist2d(unit) <= 10.0f)
return true;
@@ -378,25 +380,25 @@ class spell_bronjahm_soulstorm_targeting : public SpellScriptLoader
{
PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript);
- void FilterTargetsInitial(std::list<Unit*>& unitList)
+ void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
- unitList.remove_if (DistanceCheck(GetCaster()));
- sharedUnitList = unitList;
+ targets.remove_if(DistanceCheck(GetCaster()));
+ sharedTargets = targets;
}
// use the same target for first and second effect
- void FilterTargetsSubsequent(std::list<Unit*>& unitList)
+ void FilterTargetsSubsequent(std::list<WorldObject*>& targets)
{
- unitList = sharedUnitList;
+ targets = sharedTargets;
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsInitial, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsInitial, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
}
- std::list<Unit*> sharedUnitList;
+ std::list<WorldObject*> sharedTargets;
};
SpellScript* GetSpellScript() const
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index ad49f6cbce8..4fdcf96192b 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "forge_of_souls.h"
/*
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
index 3158d58716f..c23479eea22 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
@@ -15,56 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "forge_of_souls.h"
-enum Spells
-{
- //Spiteful Apparition
- SPELL_SPITE = 68895,
- H_SPELL_SPITE = 70212,
-
- //Spectral Warden
- SPELL_VEIL_OF_SHADOWS = 69633,
- SPELL_WAIL_OF_SOULS = 69148,
- H_SPELL_WAIL_OF_SOULS = 70210,
-
- //Soulguard Watchman
- SPELL_SHROUD_OF_RUNES = 69056,
- SPELL_UNHOLY_RAGE = 69053,
-
- //Soulguard Reaper
- SPELL_FROST_NOVA = 69060,
- H_SPELL_FROST_NOVA = 70209,
- SPELL_SHADOW_LANCE = 69058,
-
- //Soulguard Bonecaster
- SPELL_BONE_VOLLEY = 69080,
- H_SPELL_BONE_VOLLEY = 70206,
- SPELL_RAISE_DEAD = 69562,
- SPELL_SHIELD_OF_BONES = 69069,
- H_SPELL_SHIELD_OF_BONES = 70207,
-
- //Soulguard Animator
- // Raise dead 69562
- SPELL_SHADOW_BOLT = 69068,
- H_SPELL_SHADOW_BOLT = 70208,
- SPELL_SOUL_SICKNESS = 69131,
- SPELL_SOUL_SIPHON = 69128,
-
- //Soulguard Adept
- //Raise dead 69562
- //Shadow Bolt 69068/70208
- SPELL_DRAIN_LIFE = 69066,
- H_SPELL_DRAIN_LIFE = 70213,
- SPELL_SHADOW_MEND = 69564,
- H_SPELL_SHADOW_MEND = 70205,
-
- //Soul Horror
- SPELL_SOUL_STRIKE = 69088,
- H_SPELL_SOUL_STRIKE = 70211,
-};
-
enum Events
{
EVENT_NONE,
@@ -78,38 +33,6 @@ enum Events
EVENT_INTRO_6,
EVENT_INTRO_7,
EVENT_INTRO_8,
-
- //Spiteful Apparition
- EVENT_SPITE,
-
- //Spectral Warden
- EVENT_VEIL_OF_SHADOWS,
- EVENT_WAIL_OF_SOULS,
-
- //Soulguard Watchman
- EVENT_SHROUD_OF_RUNES,
- EVENT_UNHOLY_RAGE,
-
- //Soulguard Reaper
- EVENT_FROST_NOVA,
- EVENT_SHADOW_LANCE,
-
- //Soulguard Bonecaster
- EVENT_BONE_VOLLEY,
- EVENT_RAISE_DEAD,
- EVENT_SHIELD_OF_BONES,
-
- //Soulguard Animator
- EVENT_SHADOW_BOLT,
- EVENT_SOUL_SICKNESS,
- EVENT_SOUL_SIPHON,
-
- //Soulguard Adept
- EVENT_DRAIN_LIFE,
- EVENT_SHADOW_MEND,
-
- //Soul Horror
- EVENT_SOUL_STRIKE,
};
/****************************************SYLVANAS************************************/
@@ -410,508 +333,8 @@ public:
}
};
-class mob_spiteful_apparition : public CreatureScript
-{
-public:
- mob_spiteful_apparition() : CreatureScript("mob_spiteful_apparition") { }
-
- struct mob_spiteful_apparitionAI: public ScriptedAI
- {
- mob_spiteful_apparitionAI(Creature* creature) : ScriptedAI(creature)
- {
- }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_SPITE, 8000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_SPITE:
- DoCastVictim(SPELL_SPITE);
- events.RescheduleEvent(EVENT_SPITE, 8000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_spiteful_apparitionAI(creature);
- }
-};
-
-class mob_spectral_warden : public CreatureScript
-{
-public:
- mob_spectral_warden() : CreatureScript("mob_spectral_warden") { }
-
- struct mob_spectral_wardenAI: public ScriptedAI
- {
- mob_spectral_wardenAI(Creature* creature) : ScriptedAI(creature)
- {
- }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_VEIL_OF_SHADOWS, 5000);
- events.ScheduleEvent(EVENT_WAIL_OF_SOULS, 10000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_VEIL_OF_SHADOWS:
- DoCastVictim(SPELL_VEIL_OF_SHADOWS);
- events.RescheduleEvent(EVENT_VEIL_OF_SHADOWS, 10000);
- return;
- case EVENT_WAIL_OF_SOULS:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_WAIL_OF_SOULS);
- events.RescheduleEvent(EVENT_WAIL_OF_SOULS, 5000);
- return;
- }
- }
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_spectral_wardenAI(creature);
- }
-};
-
-class mob_soulguard_watchman : public CreatureScript
-{
-public:
- mob_soulguard_watchman() : CreatureScript("mob_soulguard_watchman") { }
-
- struct mob_soulguard_watchmanAI: public ScriptedAI
- {
- mob_soulguard_watchmanAI(Creature* creature) : ScriptedAI(creature) { }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_SHROUD_OF_RUNES, 1000);
- events.ScheduleEvent(EVENT_UNHOLY_RAGE, 1000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_SHROUD_OF_RUNES:
- DoCast(me, SPELL_SHROUD_OF_RUNES);
- events.RescheduleEvent(EVENT_SHROUD_OF_RUNES, 5000);
- return;
- case EVENT_UNHOLY_RAGE:
- DoCast(me, SPELL_UNHOLY_RAGE);
- events.RescheduleEvent(EVENT_UNHOLY_RAGE, 99999);
- return;
- }
- }
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_soulguard_watchmanAI(creature);
- }
-};
-
-class mob_soulguard_reaper : public CreatureScript
-{
-public:
- mob_soulguard_reaper() : CreatureScript("mob_soulguard_reaper") { }
-
- struct mob_soulguard_reaperAI: public ScriptedAI
- {
- mob_soulguard_reaperAI(Creature* creature) : ScriptedAI(creature) { }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_FROST_NOVA, 8000);
- events.ScheduleEvent(EVENT_SHADOW_LANCE, 5000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_FROST_NOVA:
- DoCast(me, SPELL_FROST_NOVA);
- events.RescheduleEvent(EVENT_FROST_NOVA, 9600);
- return;
- case EVENT_SHADOW_LANCE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SHADOW_LANCE);
- events.RescheduleEvent(EVENT_SHADOW_LANCE, 8000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_soulguard_reaperAI(creature);
- }
-};
-
-class mob_soulguard_bonecaster : public CreatureScript
-{
-public:
- mob_soulguard_bonecaster() : CreatureScript("mob_soulguard_bonecaster") { }
-
- struct mob_soulguard_bonecasterAI: public ScriptedAI
- {
- mob_soulguard_bonecasterAI(Creature* creature) : ScriptedAI(creature) { }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_BONE_VOLLEY, 6000);
- events.ScheduleEvent(EVENT_RAISE_DEAD, 25000);
- events.ScheduleEvent(EVENT_SHIELD_OF_BONES, 6000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_BONE_VOLLEY:
- DoCastAOE(SPELL_BONE_VOLLEY);
- events.RescheduleEvent(EVENT_BONE_VOLLEY, 7000);
- return;
- case EVENT_RAISE_DEAD:
- DoCast(me, SPELL_RAISE_DEAD);
- events.RescheduleEvent(EVENT_RAISE_DEAD, 25000);
- return;
- case EVENT_SHIELD_OF_BONES:
- DoCast(me, SPELL_SHIELD_OF_BONES);
- events.RescheduleEvent(EVENT_SHIELD_OF_BONES, 8000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_soulguard_bonecasterAI(creature);
- }
-};
-
-class mob_soulguard_animator : public CreatureScript
-{
-public:
- mob_soulguard_animator() : CreatureScript("mob_soulguard_animator") { }
-
- struct mob_soulguard_animatorAI : public ScriptedAI
- {
- mob_soulguard_animatorAI(Creature* creature) : ScriptedAI(creature)
- {
- }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_RAISE_DEAD, 25000);
- events.ScheduleEvent(EVENT_SHADOW_BOLT, 5000);
- events.ScheduleEvent(EVENT_SOUL_SICKNESS, 8000);
- events.ScheduleEvent(EVENT_SOUL_SIPHON, 10000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_RAISE_DEAD:
- DoCast(me, SPELL_RAISE_DEAD);
- events.RescheduleEvent(EVENT_RAISE_DEAD, 25000);
- return;
- case EVENT_SHADOW_BOLT:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SHADOW_BOLT);
- events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000);
- return;
- case EVENT_SOUL_SICKNESS:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SOUL_SICKNESS);
- events.RescheduleEvent(EVENT_SOUL_SICKNESS, 10000);
- return;
- case EVENT_SOUL_SIPHON:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SOUL_SIPHON);
- events.RescheduleEvent(EVENT_SOUL_SIPHON, 8000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_soulguard_animatorAI(creature);
- }
-};
-
-class mob_soulguard_adept : public CreatureScript
-{
-public:
- mob_soulguard_adept() : CreatureScript("mob_soulguard_adept") { }
-
- struct mob_soulguard_adeptAI: public ScriptedAI
- {
- mob_soulguard_adeptAI(Creature* creature) : ScriptedAI(creature)
- {
- }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_RAISE_DEAD, 25000);
- events.ScheduleEvent(EVENT_SHADOW_BOLT, 8000);
- events.ScheduleEvent(EVENT_DRAIN_LIFE, 7000);
- events.ScheduleEvent(EVENT_SHADOW_MEND, 35000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_RAISE_DEAD:
- DoCast(me, SPELL_RAISE_DEAD);
- events.RescheduleEvent(EVENT_RAISE_DEAD, 25000);
- return;
- case EVENT_SHADOW_BOLT:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SHADOW_BOLT);
- events.RescheduleEvent(EVENT_SHADOW_BOLT, 4000);
- return;
- case EVENT_DRAIN_LIFE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_DRAIN_LIFE);
- events.RescheduleEvent(EVENT_DRAIN_LIFE, 9000);
- return;
- case EVENT_SHADOW_MEND:
- DoCast(me, SPELL_SHADOW_MEND);
- events.RescheduleEvent(EVENT_SHADOW_MEND, 20000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_soulguard_adeptAI(creature);
- }
-};
-
-class mob_soul_horror : public CreatureScript
-{
-public:
- mob_soul_horror() : CreatureScript("mob_soul_horror") { }
-
- struct mob_soul_horrorAI : public ScriptedAI
- {
- mob_soul_horrorAI(Creature* creature) : ScriptedAI(creature) { }
-
- EventMap events;
-
- void Reset()
- {
- events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- events.ScheduleEvent(EVENT_SOUL_STRIKE, 6000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_SOUL_STRIKE:
- DoCast(me->getVictim(), SPELL_SOUL_STRIKE);
- events.RescheduleEvent(EVENT_SOUL_STRIKE, 8000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_soul_horrorAI(creature);
- }
-};
-
void AddSC_forge_of_souls()
{
new npc_sylvanas_fos();
new npc_jaina_fos();
- new mob_spiteful_apparition();
- new mob_spectral_warden();
- new mob_soulguard_watchman();
- new mob_soulguard_reaper();
- new mob_soulguard_bonecaster();
- new mob_soulguard_animator();
- new mob_soulguard_adept();
- new mob_soul_horror();
}
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
index bad4b8e38b2..618b2b6a9a6 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "forge_of_souls.h"
#define MAX_ENCOUNTER 2
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
index 9cfcb78f6f1..4df13d32bf8 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_reflection.h"
enum Yells
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
index a9bfb603794..8334a199791 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_reflection.h"
enum Yells
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 2abb60d5de2..26ec9e53213 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "halls_of_reflection.h"
enum Yells
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
index 3c4d05854bb..e3604890e39 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "halls_of_reflection.h"
#define MAX_ENCOUNTER 3
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 64609efd7ff..a12bd96f6df 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -15,19 +15,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuras.h"
#include "pit_of_saron.h"
enum Yells
{
- SAY_AGGRO = -1658001,
- SAY_SLAY_1 = -1658002,
- SAY_SLAY_2 = -1658003,
- SAY_DEATH = -1658004,
- SAY_PHASE2 = -1658005,
- SAY_PHASE3 = -1658006,
-
- SAY_TYRANNUS_DEATH = -1658007,
+ SAY_AGGRO = 0,
+ SAY_PHASE2 = 1,
+ SAY_PHASE3 = 2,
+ SAY_DEATH = 3,
+ SAY_SLAY = 4,
+ SAY_THROW_SARONITE = 5,
+ SAY_CAST_DEEP_FREEZE = 6,
+
+ SAY_TYRANNUS_DEATH = -1658007, // todo
};
enum Spells
@@ -107,8 +111,9 @@ class boss_garfrost : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_PERMAFROST);
+ me->CallForHelp(70.0f);
events.ScheduleEvent(EVENT_THROW_SARONITE, 7000);
instance->SetBossState(DATA_GARFROST, IN_PROGRESS);
@@ -117,12 +122,13 @@ class boss_garfrost : public CreatureScript
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
+
if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS)))
DoScriptText(SAY_TYRANNUS_DEATH, tyrannus);
@@ -134,6 +140,7 @@ class boss_garfrost : public CreatureScript
if (events.GetPhaseMask() & PHASE_ONE_MASK && !HealthAbovePct(66))
{
events.SetPhase(PHASE_TWO);
+ Talk(SAY_PHASE2);
events.DelayEvents(8000);
DoCast(me, SPELL_THUNDERING_STOMP);
events.ScheduleEvent(EVENT_JUMP, 1500);
@@ -143,6 +150,7 @@ class boss_garfrost : public CreatureScript
if (events.GetPhaseMask() & PHASE_TWO_MASK && !HealthAbovePct(33))
{
events.SetPhase(PHASE_THREE);
+ Talk(SAY_PHASE3);
events.DelayEvents(8000);
DoCast(me, SPELL_THUNDERING_STOMP);
events.ScheduleEvent(EVENT_JUMP, 1500);
@@ -152,15 +160,19 @@ class boss_garfrost : public CreatureScript
void MovementInform(uint32 type, uint32 id)
{
- if (type != POINT_MOTION_TYPE || id != POINT_FORGE)
+ if (type != EFFECT_MOTION_TYPE || id != POINT_FORGE)
return;
if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ {
DoCast(me, SPELL_FORGE_BLADE);
+ SetEquipmentSlots(false, EQUIP_ID_SWORD);
+ }
if (events.GetPhaseMask() & PHASE_THREE_MASK)
{
me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE_HELPER);
DoCast(me, SPELL_FORGE_MACE);
+ SetEquipmentSlots(false, EQUIP_ID_MACE);
}
events.ScheduleEvent(EVENT_RESUME_ATTACK, 5000);
}
@@ -172,10 +184,6 @@ class boss_garfrost : public CreatureScript
if (Aura* aura = target->GetAura(SPELL_PERMAFROST_HELPER))
_permafrostStack = std::max<uint32>(_permafrostStack, aura->GetStackAmount());
}
- else if (spell->Id == SPELL_FORGE_BLADE)
- SetEquipmentSlots(false, EQUIP_ID_SWORD);
- else if (spell->Id == SPELL_FORGE_MACE)
- SetEquipmentSlots(false, EQUIP_ID_MACE);
}
uint32 GetData(uint32 /*type*/)
@@ -199,7 +207,10 @@ class boss_garfrost : public CreatureScript
{
case EVENT_THROW_SARONITE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ {
+ Talk(SAY_THROW_SARONITE, target->GetGUID());
DoCast(target, SPELL_THROW_SARONITE);
+ }
events.ScheduleEvent(EVENT_THROW_SARONITE, urand(12500, 20000));
break;
case EVENT_CHILLING_WAVE:
@@ -208,7 +219,10 @@ class boss_garfrost : public CreatureScript
break;
case EVENT_DEEP_FREEZE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ {
+ Talk(SAY_CAST_DEEP_FREEZE, target->GetGUID());
DoCast(target, SPELL_DEEP_FREEZE);
+ }
events.ScheduleEvent(EVENT_DEEP_FREEZE, 35000, 0, PHASE_THREE);
break;
case EVENT_JUMP:
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index fa260cb298d..57d99908bfb 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "pit_of_saron.h"
#include "Vehicle.h"
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 88e9bedcd07..ef4d9182f82 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "pit_of_saron.h"
#include "Vehicle.h"
@@ -387,8 +390,7 @@ class player_overlord_brandAI : public PlayerAI
void SetGUID(uint64 guid, int32 /*type*/)
{
tyrannus = ObjectAccessor::GetCreature(*me, guid);
- if (!tyrannus)
- me->IsAIEnabled = false;
+ me->IsAIEnabled = tyrannus != NULL;
}
void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/)
@@ -423,10 +425,9 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
return;
oldAI = GetTarget()->GetAI();
+ oldAIState = GetTarget()->IsAIEnabled;
GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer()));
GetTarget()->GetAI()->SetGUID(GetCasterGUID());
- oldAIState = GetTarget()->IsAIEnabled;
- GetTarget()->IsAIEnabled = true;
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
index 24529801564..a6537c45d6f 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "pit_of_saron.h"
// positions for Martin Victus (37591) and Gorkun Ironskull (37592)
@@ -23,6 +24,13 @@ Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f};
// position for Jaina and Sylvanas
Position const EventLeaderPos2 = {1054.368f, 107.14620f, 628.4467f, 0.0f};
+DoorData const Doors[] =
+{
+ {GO_ICE_WALL, DATA_GARFROST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE},
+ {GO_ICE_WALL, DATA_ICK, DOOR_TYPE_PASSAGE, BOUNDARY_NONE},
+ {GO_HALLS_OF_REFLECTION_PORTCULLIS, DATA_TYRANNUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE},
+};
+
class instance_pit_of_saron : public InstanceMapScript
{
public:
@@ -33,6 +41,7 @@ class instance_pit_of_saron : public InstanceMapScript
instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map)
{
SetBossNumber(MAX_ENCOUNTER);
+ LoadDoorData(Doors);
_garfrostGUID = 0;
_krickGUID = 0;
_ickGUID = 0;
@@ -154,6 +163,28 @@ class instance_pit_of_saron : public InstanceMapScript
}
}
+ void OnGameObjectCreate(GameObject* go)
+ {
+ switch (go->GetEntry())
+ {
+ case GO_ICE_WALL:
+ case GO_HALLS_OF_REFLECTION_PORTCULLIS:
+ AddDoor(go, true);
+ break;
+ }
+ }
+
+ void OnGameObjectRemove(GameObject* go)
+ {
+ switch (go->GetEntry())
+ {
+ case GO_ICE_WALL:
+ case GO_HALLS_OF_REFLECTION_PORTCULLIS:
+ AddDoor(go, false);
+ break;
+ }
+ }
+
bool SetBossState(uint32 type, EncounterState state)
{
if (!InstanceScript::SetBossState(type, state))
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
index 70d72e52e67..eba19403517 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "pit_of_saron.h"
#include "Vehicle.h"
@@ -25,9 +28,6 @@ enum eSpells
SPELL_HELLFIRE = 69586,
SPELL_TACTICAL_BLINK = 69584,
SPELL_FROST_BREATH = 69527, //Iceborn Proto-Drake
- SPELL_BLINDING_DIRT = 70302, //Wrathbone Laborer
- SPELL_PUNCTURE_WOUND = 70278,
- SPELL_SHOVELLED = 69572,
SPELL_LEAPING_FACE_MAUL = 69504, // Geist Ambusher
};
@@ -36,11 +36,6 @@ enum eEvents
// Ymirjar Flamebearer
EVENT_FIREBALL = 1,
EVENT_TACTICAL_BLINK = 2,
-
- //Wrathbone Laborer
- EVENT_BLINDING_DIRT = 3,
- EVENT_PUNCTURE_WOUND = 4,
- EVENT_SHOVELLED = 5,
};
class mob_ymirjar_flamebearer : public CreatureScript
@@ -157,73 +152,6 @@ class mob_iceborn_protodrake : public CreatureScript
}
};
-class mob_wrathbone_laborer : public CreatureScript
-{
- public:
- mob_wrathbone_laborer() : CreatureScript("mob_wrathbone_laborer") { }
-
- struct mob_wrathbone_laborerAI: public ScriptedAI
- {
- mob_wrathbone_laborerAI(Creature* creature) : ScriptedAI(creature)
- {
- }
-
- void Reset()
- {
- _events.Reset();
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- _events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000);
- _events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000);
- _events.ScheduleEvent(EVENT_SHOVELLED, 5000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- if (!UpdateVictim())
- return;
-
- _events.Update(diff);
-
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
-
- while (uint32 eventId = _events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_BLINDING_DIRT:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true))
- DoCast(target, SPELL_BLINDING_DIRT);
- _events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000);
- return;
- case EVENT_PUNCTURE_WOUND:
- DoCastVictim(SPELL_PUNCTURE_WOUND);
- _events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000);
- return;
- case EVENT_SHOVELLED:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -5.0f))
- DoCast(target, SPELL_SHOVELLED);
- _events.RescheduleEvent(EVENT_SHOVELLED, 7000);
- return;
- }
- }
-
- DoMeleeAttackIfReady();
- }
-
- private:
- EventMap _events;
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_wrathbone_laborerAI(creature);
- }
-};
-
class mob_geist_ambusher : public CreatureScript
{
public:
@@ -310,7 +238,6 @@ class spell_trash_mob_glacial_strike : public SpellScriptLoader
void AddSC_pit_of_saron()
{
new mob_ymirjar_flamebearer();
- new mob_wrathbone_laborer();
new mob_iceborn_protodrake();
new mob_geist_ambusher();
new spell_trash_mob_glacial_strike();
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h
index 728e0ccd955..768c3ba40ec 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h
@@ -90,6 +90,8 @@ enum CreatureIds
enum GameObjectIds
{
GO_SARONITE_ROCK = 196485,
+ GO_ICE_WALL = 201885,
+ GO_HALLS_OF_REFLECTION_PORTCULLIS = 201848,
};
#endif
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index b66c3d795f3..fd1aba79e83 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -19,7 +19,8 @@
* Comment: The event with the Living Mojos is not implemented, just is done that when one of the mojos around the boss take damage will make the boss enter in combat!
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
index 3e803c24d61..b75c5cbc2a9 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
index be9b09a1263..0d89c402054 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
//Spells
diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
index 1085e993322..c1301dbd2d0 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
enum eSpells
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
index b827f43dc99..251c9ec2b83 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "gundrak.h"
//Spells
diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
index c22a0e17cd5..15315c721d7 100644
--- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
+++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "gundrak.h"
#define MAX_ENCOUNTER 5
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index de104a78e43..6e7e3c49ef8 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -103,6 +103,7 @@ enum Spells
SPELL_UNSTABLE = 72059,
SPELL_KINETIC_BOMB_VISUAL = 72054,
SPELL_KINETIC_BOMB_EXPLOSION = 72052,
+ SPELL_KINETIC_BOMB_KNOCKBACK = 72087,
// Shock Vortex
SPELL_SHOCK_VORTEX_PERIODIC = 71945,
@@ -443,20 +444,12 @@ class boss_prince_keleseth_icc : public CreatureScript
{
summons.Summon(summon);
Position pos;
- pos.Relocate(summon);
+ me->GetPosition(&pos);
float maxRange = me->GetDistance2d(summon);
float angle = me->GetAngle(summon);
- // prevent spawning outside of room
- while (!me->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()))
- {
- maxRange -= 5.0f;
- if (maxRange < 5.0f)
- break;
-
- summon->MovePosition(pos, float(rand_norm() * maxRange), angle);
- }
-
+ me->MovePositionToFirstCollision(pos, maxRange, angle);
summon->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
+ summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN);
}
void DamageDealt(Unit* /*target*/, uint32& damage, DamageEffectType damageType)
@@ -894,6 +887,7 @@ class boss_prince_valanar_icc : public CreatureScript
summon->GetPosition(x, y, z);
float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f);
summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z);
+ summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
break;
}
case NPC_SHOCK_VORTEX:
@@ -1073,7 +1067,7 @@ class npc_blood_queen_lana_thel : public CreatureScript
if (_introDone)
return;
- if (!me->IsWithinDistInMap(who, 35.0f))
+ if (!me->IsWithinDistInMap(who, 35.0f, false))
return;
_introDone = true;
@@ -1232,12 +1226,12 @@ class npc_kinetic_bomb : public CreatureScript
void Reset()
{
_events.Reset();
- me->SetDisplayId(DISPLAY_KINETIC_BOMB);
+ me->SetWalk(true);
me->CastSpell(me, SPELL_UNSTABLE, true);
me->CastSpell(me, SPELL_KINETIC_BOMB_VISUAL, true);
me->SetReactState(REACT_PASSIVE);
- me->SetSpeed(MOVE_FLIGHT, IsHeroic() ? 0.3f : 0.15f, true);
me->GetPosition(_x, _y, _groundZ);
+ me->DespawnOrUnsummon(60000);
_groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f);
}
@@ -1247,9 +1241,9 @@ class npc_kinetic_bomb : public CreatureScript
_events.ScheduleEvent(EVENT_BOMB_DESPAWN, 1000);
else if (action == ACTION_KINETIC_BOMB_JUMP)
{
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveJump(_x, _y, me->GetPositionZ() + 7.0f, 1.0f, 7.0f);
- _events.ScheduleEvent(EVENT_CONTINUE_FALLING, 700);
+ if (!me->HasAura(SPELL_KINETIC_BOMB_KNOCKBACK))
+ me->GetMotionMaster()->MoveCharge(_x, _y, me->GetPositionZ() + 100.0f, me->GetSpeed(MOVE_RUN), 0);
+ _events.RescheduleEvent(EVENT_CONTINUE_FALLING, 3000);
}
}
@@ -1263,10 +1257,10 @@ class npc_kinetic_bomb : public CreatureScript
{
case EVENT_BOMB_DESPAWN:
me->SetVisible(false);
+ me->DespawnOrUnsummon(5000);
break;
case EVENT_CONTINUE_FALLING:
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, _x, _y, _groundZ);
+ me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK), POINT_KINETIC_BOMB_IMPACT);
break;
default:
break;
@@ -1302,7 +1296,7 @@ class npc_dark_nucleus : public CreatureScript
void Reset()
{
- me->SetReactState(REACT_PASSIVE);
+ me->SetReactState(REACT_DEFENSIVE);
me->CastSpell(me, SPELL_SHADOW_RESONANCE_AURA, true);
}
@@ -1321,9 +1315,6 @@ class npc_dark_nucleus : public CreatureScript
void MoveInLineOfSight(Unit* who)
{
- if (me->GetDistance(who) >= 15.0f)
- return;
-
ScriptedAI::MoveInLineOfSight(who);
}
@@ -1332,46 +1323,32 @@ class npc_dark_nucleus : public CreatureScript
if (attacker == me)
return;
- if (!_lockedTarget)
- if (me->getVictim() == attacker)
- _lockedTarget = true;
+ me->DeleteThreatList();
+ me->AddThreat(attacker, 500000000.0f);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
- if (!me->isInCombat())
+ if (!UpdateVictim())
return;
if (_targetAuraCheck <= diff)
{
_targetAuraCheck = 1000;
if (Unit* victim = me->getVictim())
+ {
if (me->GetDistance(victim) < 15.0f &&
!victim->HasAura(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID()))
{
DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST);
me->ClearUnitState(UNIT_STATE_CASTING);
}
+ else
+ MoveInLineOfSight(me->getVictim());
+ }
}
else
_targetAuraCheck -= diff;
-
- if (!_lockedTarget)
- {
- if (Unit* victim = me->SelectVictim())
- {
- if (me->getVictim() && me->getVictim() != victim)
- {
- me->getVictim()->RemoveAurasDueToSpell(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID());
- _lockedTarget = true;
- }
-
- _lockedTarget = true;
- AttackStart(victim);
- DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST);
- me->ClearUnitState(UNIT_STATE_CASTING);
- }
- }
}
private:
@@ -1521,10 +1498,11 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
- WorldLocation summonPos = *GetTargetDest();
+ WorldLocation summonPos = *GetExplTargetDest();
Position offset = {0.0f, 0.0f, 20.0f, 0.0f};
summonPos.RelocateOffset(offset);
- SetTargetDest(summonPos);
+ SetExplTargetDest(summonPos);
+ GetHitDest()->RelocateOffset(offset);
}
void Register()
@@ -1586,7 +1564,7 @@ class spell_valanar_kinetic_bomb_knockback : public SpellScriptLoader
void Register()
{
- AfterHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir);
+ BeforeHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir);
}
};
@@ -1663,7 +1641,7 @@ class spell_blood_council_shadow_prison_damage : public SpellScriptLoader
void AddExtraDamage()
{
if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id))
- if (AuraEffect const* eff = aur->GetEffect(1))
+ if (AuraEffect const* eff = aur->GetEffect(EFFECT_1))
SetHitDamage(GetHitDamage() + eff->GetAmount());
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
index b6544fd9a2a..0d092ec86b2 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
@@ -149,7 +149,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30500, EVENT_GROUP_NORMAL);
events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(20000, 25000), EVENT_GROUP_NORMAL);
events.ScheduleEvent(EVENT_AIR_PHASE, 124000 + uint32(Is25ManRaid() ? 3000 : 0));
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY);
+ CleanAuras();
me->SetSpeed(MOVE_FLIGHT, 0.642857f, true);
_offtank = NULL;
_vampires.clear();
@@ -170,6 +170,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
DoZoneInCombat();
Talk(SAY_AGGRO);
instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, IN_PROGRESS);
+ CleanAuras();
DoCast(me, SPELL_SHROUD_OF_SORROW, true);
DoCast(me, SPELL_FRENZIED_BLOODTHIRST_VISUAL, true);
@@ -180,15 +181,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
{
_JustDied();
Talk(SAY_DEATH);
- instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN);
- instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR);
- instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY);
- instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
+ CleanAuras();
// Blah, credit the quest
if (_creditBloodQuickening)
{
@@ -207,6 +200,19 @@ class boss_blood_queen_lana_thel : public CreatureScript
}
}
+ void CleanAuras()
+ {
+ instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN);
+ instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR);
+ instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY);
+ instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
+ }
+
void DoAction(int32 const action)
{
if (action != ACTION_KILL_MINCHAR)
@@ -227,6 +233,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
void EnterEvadeMode()
{
_EnterEvadeMode();
+ CleanAuras();
if (_killMinchar)
{
_killMinchar = false;
@@ -522,7 +529,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
SpellCastResult CheckTarget()
{
- if (IsVampire(GetTargetUnit()))
+ if (IsVampire(GetExplTargetUnit()))
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES);
return SPELL_FAILED_CUSTOM_ERROR;
@@ -624,9 +631,9 @@ class BloodboltHitCheck
public:
explicit BloodboltHitCheck(LanaThelAI* ai) : _ai(ai) {}
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* object) const
{
- return _ai->WasBloodbolted(unit->GetGUID());
+ return _ai->WasBloodbolted(object->GetGUID());
}
private:
@@ -654,13 +661,13 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL;
}
- void FilterTargets(std::list<Unit*>& targets)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
uint32 targetCount = (targets.size() + 2) / 3;
- targets.remove_if (BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
+ targets.remove_if(BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
Trinity::Containers::RandomResizeList(targets, targetCount);
// mark targets now, effect hook has missile travel time delay (might cast next in that time)
- for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
+ for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT);
}
@@ -672,7 +679,7 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -692,19 +699,19 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader
{
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- unitList.remove_if (Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN));
+ targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN));
bool remove = true;
- std::list<Unit*>::const_iterator itrEnd = unitList.end(), itr, itr2;
+ std::list<WorldObject*>::const_iterator itrEnd = targets.end(), itr, itr2;
// we can do this, unitList is MAX 4 in size
- for (itr = unitList.begin(); itr != itrEnd && remove; ++itr)
+ for (itr = targets.begin(); itr != itrEnd && remove; ++itr)
{
if (!GetCaster()->IsWithinDist(*itr, 5.0f, false))
remove = false;
- for (itr2 = unitList.begin(); itr2 != itrEnd && remove; ++itr2)
+ for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2)
if (itr != itr2 && !(*itr2)->IsWithinDist(*itr, 5.0f, false))
remove = false;
}
@@ -714,14 +721,14 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
- unitList.clear();
+ targets.clear();
}
}
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -778,15 +785,15 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScriptLo
{
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN));
+ unitList.remove_if(Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN));
unitList.push_back(GetCaster());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index 249eed01643..5d3a6814eb2 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -39,6 +39,7 @@ enum ScriptTexts
SAY_FRENZY = 11,
SAY_BERSERK = 12,
SAY_DEATH = 13,
+ EMOTE_SCENT_OF_BLOOD = 14,
// High Overlord Saurfang
SAY_INTRO_HORDE_1 = 0,
@@ -145,6 +146,7 @@ enum EventTypes
EVENT_BOILING_BLOOD = 20,
EVENT_BLOOD_NOVA = 21,
EVENT_RUNE_OF_BLOOD = 22,
+ EVENT_SCENT_OF_BLOOD = 52,
EVENT_OUTRO_ALLIANCE_1 = 23,
EVENT_OUTRO_ALLIANCE_2 = 24,
@@ -297,7 +299,7 @@ class boss_deathbringer_saurfang : public CreatureScript
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 30000, 0, PHASE_COMBAT);
- events.ScheduleEvent(EVENT_BERSERK, 480000, 0, PHASE_COMBAT);
+ events.ScheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 480000, 0, PHASE_COMBAT);
events.ScheduleEvent(EVENT_BOILING_BLOOD, 15500, 0, PHASE_COMBAT);
events.ScheduleEvent(EVENT_BLOOD_NOVA, 17000, 0, PHASE_COMBAT);
events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, 20000, 0, PHASE_COMBAT);
@@ -374,16 +376,13 @@ class boss_deathbringer_saurfang : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
summon->AI()->AttackStart(target);
- if (IsHeroic())
- DoCast(summon, SPELL_SCENT_OF_BLOOD);
-
- summon->AI()->DoCast(summon, SPELL_BLOOD_LINK_BEAST, true);
- summon->AI()->DoCast(summon, SPELL_RESISTANT_SKIN, true);
+ summon->CastSpell(summon, SPELL_BLOOD_LINK_BEAST, true);
+ summon->CastSpell(summon, SPELL_RESISTANT_SKIN, true);
summons.Summon(summon);
DoZoneInCombat(summon);
}
- void SummonedCreatureDespawn(Creature* summon)
+ void SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
{
summons.Despawn(summon);
}
@@ -463,18 +462,13 @@ class boss_deathbringer_saurfang : public CreatureScript
DoCast(me, SPELL_SUMMON_BLOOD_BEAST_25_MAN+i25);
Talk(SAY_BLOOD_BEASTS);
events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 40000, 0, PHASE_COMBAT);
+ if (IsHeroic())
+ events.ScheduleEvent(EVENT_SCENT_OF_BLOOD, 10000, 0, PHASE_COMBAT);
break;
case EVENT_BLOOD_NOVA:
- {
- // select at range only
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, -10.0f, true);
- if (!target)
- target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true); // noone? select melee
- if (target)
- DoCast(target, SPELL_BLOOD_NOVA_TRIGGER);
+ DoCastAOE(SPELL_BLOOD_NOVA_TRIGGER);
events.ScheduleEvent(EVENT_BLOOD_NOVA, urand(20000, 25000), 0, PHASE_COMBAT);
break;
- }
case EVENT_RUNE_OF_BLOOD:
DoCastVictim(SPELL_RUNE_OF_BLOOD);
events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, urand(20000, 25000), 0, PHASE_COMBAT);
@@ -487,6 +481,13 @@ class boss_deathbringer_saurfang : public CreatureScript
DoCast(me, SPELL_BERSERK);
Talk(SAY_BERSERK);
break;
+ case EVENT_SCENT_OF_BLOOD:
+ if (!summons.empty())
+ {
+ Talk(EMOTE_SCENT_OF_BLOOD);
+ DoCastAOE(SPELL_SCENT_OF_BLOOD);
+ }
+ break;
default:
break;
}
@@ -630,9 +631,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_HORDE_4, 24000); // cast
_events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 30000); // move
me->SetDisableGravity(false);
- me->SendMovementFlagUpdate();
- me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f);
- me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f);
+ me->GetMotionMaster()->MoveFall();
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
break;
@@ -837,9 +836,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY);
Talk(SAY_OUTRO_ALLIANCE_1);
me->SetDisableGravity(false);
- me->SendMovementFlagUpdate();
- me->Relocate(me->GetPositionX(), me->GetPositionY(), 539.2917f);
- me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 0.0f);
+ me->GetMotionMaster()->MoveFall();
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
@@ -1201,34 +1198,34 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
return true;
}
- void FilterTargetsInitial(std::list<Unit*>& unitList)
+ void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
- if (unitList.empty())
+ if (targets.empty())
return;
// select one random target, with preference of ranged targets
uint32 targetsAtRange = 0;
uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4);
- unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
+ targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
// get target count at range
- for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr, ++targetsAtRange)
+ for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr, ++targetsAtRange)
if ((*itr)->GetDistance(GetCaster()) < 12.0f)
break;
// set the upper cap
if (targetsAtRange < minTargets)
- targetsAtRange = std::min<uint32>(unitList.size() - 1, minTargets);
+ targetsAtRange = std::min<uint32>(targets.size() - 1, minTargets);
- std::list<Unit*>::const_iterator itr = unitList.begin();
+ std::list<WorldObject*>::const_iterator itr = targets.begin();
std::advance(itr, urand(0, targetsAtRange));
target = *itr;
- unitList.clear();
- unitList.push_back(target);
+ targets.clear();
+ targets.push_back(target);
}
// use the same target for first and second effect
- void FilterTargetsSubsequent(std::list<Unit*>& unitList)
+ void FilterTargetsSubsequent(std::list<WorldObject*>& unitList)
{
if (!target)
return;
@@ -1237,13 +1234,19 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
unitList.push_back(target);
}
+ void HandleForceCast(SpellEffIndex /*effIndex*/)
+ {
+ GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), TRIGGERED_FULL_MASK);
+ }
+
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
- Unit* target;
+ WorldObject* target;
};
SpellScript* GetSpellScript() const
@@ -1266,20 +1269,20 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- unitList.remove(GetCaster()->getVictim());
- if (unitList.empty())
+ targets.remove(GetCaster()->getVictim());
+ if (targets.empty())
return;
- Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList);
- unitList.clear();
- unitList.push_back(target);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 1672d8b2d87..0c5cb0aba52 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -416,7 +416,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
{
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript);
- void SelectTarget(std::list<Unit*>& targets)
+ void SelectTarget(std::list<WorldObject*>& targets)
{
targets.clear();
// select any unit but not the tank (by owners threatlist)
@@ -438,7 +438,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index b66632b6eeb..a9ba0baa86f 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -64,6 +64,9 @@ enum Spells
SPELL_MALLEABLE_GOO = 70852,
SPELL_UNSTABLE_EXPERIMENT = 70351,
SPELL_TEAR_GAS = 71617, // phase transition
+ SPELL_TEAR_GAS_CREATURE = 71618,
+ SPELL_TEAR_GAS_CANCEL = 71620,
+ SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170,
SPELL_CREATE_CONCOCTION = 71621,
SPELL_GUZZLE_POTIONS = 71893,
SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank
@@ -86,6 +89,7 @@ enum Spells
SPELL_GASEOUS_BLOAT_PROC = 70215,
SPELL_GASEOUS_BLOAT = 70672,
SPELL_GASEOUS_BLOAT_PROTECTION = 70812,
+ SPELL_EXPUNGED_GAS = 70701,
// Volatile Ooze
SPELL_OOZE_ERUPTION = 70492,
@@ -167,6 +171,33 @@ enum PutricideData
#define EXPERIMENT_STATE_OOZE false
#define EXPERIMENT_STATE_GAS true
+class AbominationDespawner
+{
+ public:
+ explicit AbominationDespawner(Unit* owner) : _owner(owner) { }
+
+ bool operator()(uint64 guid)
+ {
+ if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid))
+ {
+ if (summon->GetEntry() == NPC_MUTATED_ABOMINATION_10 || summon->GetEntry() == NPC_MUTATED_ABOMINATION_25)
+ {
+ if (Vehicle* veh = summon->GetVehicleKit())
+ veh->RemoveAllPassengers(); // also despawns the vehicle
+
+ return true;
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ private:
+ Unit* _owner;
+};
+
class boss_professor_putricide : public CreatureScript
{
public:
@@ -265,6 +296,7 @@ class boss_professor_putricide : public CreatureScript
summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true);
summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false);
+ summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
return;
case NPC_VOLATILE_OOZE:
@@ -272,6 +304,7 @@ class boss_professor_putricide : public CreatureScript
summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true);
summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true);
summon->CastSpell(summon, SPELL_VOLATILE_OOZE_ADHESIVE, false);
+ summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
return;
case NPC_CHOKING_GAS_BOMB:
@@ -477,8 +510,7 @@ class boss_professor_putricide : public CreatureScript
SetPhase(PHASE_COMBAT_3);
events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000);
events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT);
- summons.DespawnEntry(NPC_MUTATED_ABOMINATION_10);
- summons.DespawnEntry(NPC_MUTATED_ABOMINATION_25);
+ summons.remove_if(AbominationDespawner(me));
break;
default:
break;
@@ -514,7 +546,7 @@ class boss_professor_putricide : public CreatureScript
void UpdateAI(uint32 const diff)
{
- if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_MASK_NOT_SELF)) || !CheckInRoom())
+ if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom())
return;
events.Update(diff);
@@ -569,13 +601,15 @@ class boss_professor_putricide : public CreatureScript
break;
case EVENT_TEAR_GAS:
me->GetMotionMaster()->MovePoint(POINT_TABLE, tablePos);
+ DoCast(me, SPELL_TEAR_GAS_PERIODIC_TRIGGER, true);
break;
case EVENT_RESUME_ATTACK:
me->SetReactState(REACT_DEFENSIVE);
AttackStart(me->getVictim());
// remove Tear Gas
+ me->RemoveAurasDueToSpell(SPELL_TEAR_GAS_PERIODIC_TRIGGER);
instance->DoRemoveAurasDueToSpellOnPlayers(71615);
- instance->DoRemoveAurasDueToSpellOnPlayers(71618);
+ DoCastAOE(SPELL_TEAR_GAS_CANCEL);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE);
break;
@@ -673,27 +707,36 @@ class npc_volatile_ooze : public CreatureScript
public:
npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { }
- struct npc_volatile_oozeAI : public ScriptedAI
+ struct npc_putricide_oozeAI : public ScriptedAI
{
- npc_volatile_oozeAI(Creature* creature) : ScriptedAI(creature)
+ npc_putricide_oozeAI(Creature* creature) : ScriptedAI(creature)
{
_newTargetSelectTimer = 0;
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
{
- if (!_newTargetSelectTimer && sSpellMgr->GetSpellDifficultyId(spell->Id) == sSpellMgr->GetSpellDifficultyId(SPELL_OOZE_ERUPTION))
+ if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_OOZE_ERUPTION, me))
+ _newTargetSelectTimer = 1000;
+ }
+
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_TEAR_GAS_CREATURE)
_newTargetSelectTimer = 1000;
}
void UpdateAI(uint32 const diff)
{
- if (!UpdateVictim())
+ if (!UpdateVictim() && !_newTargetSelectTimer)
return;
if (!_newTargetSelectTimer)
return;
+ if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
+ return;
+
if (_newTargetSelectTimer <= diff)
{
_newTargetSelectTimer = 0;
@@ -704,13 +747,68 @@ class npc_volatile_ooze : public CreatureScript
}
private:
- // no need to use EventMap for just one event
uint32 _newTargetSelectTimer;
};
CreatureAI* GetAI(Creature* creature) const
{
- return GetIcecrownCitadelAI<npc_volatile_oozeAI>(creature);
+ return GetIcecrownCitadelAI<npc_putricide_oozeAI>(creature);
+ }
+};
+
+class npc_gas_cloud : public CreatureScript
+{
+ public:
+ npc_gas_cloud() : CreatureScript("npc_gas_cloud") { }
+
+ struct npc_gas_cloudAI : public ScriptedAI
+ {
+ npc_gas_cloudAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _newTargetSelectTimer = 0;
+ }
+
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
+ {
+ if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_EXPUNGED_GAS, me))
+ _newTargetSelectTimer = 1000;
+ }
+
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_TEAR_GAS_CREATURE)
+ _newTargetSelectTimer = 1000;
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim() && !_newTargetSelectTimer)
+ return;
+
+ DoMeleeAttackIfReady();
+
+ if (!_newTargetSelectTimer)
+ return;
+
+ if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
+ return;
+
+ if (_newTargetSelectTimer <= diff)
+ {
+ _newTargetSelectTimer = 0;
+ me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false);
+ }
+ else
+ _newTargetSelectTimer -= diff;
+ }
+
+ private:
+ uint32 _newTargetSelectTimer;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetIcecrownCitadelAI<npc_gas_cloudAI>(creature);
}
};
@@ -729,8 +827,8 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
if (Unit* caster = GetCaster())
{
target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID());
- if (!target->HasAura(GetId())&& caster->GetTypeId() == TYPEID_UNIT)
- caster->ToCreature()->DespawnOrUnsummon();
+ if (!target->HasAura(GetId()))
+ caster->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, caster, false);
}
}
@@ -772,43 +870,56 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
- void SelectTarget(std::list<Unit*>& targetList)
+ void SelectTarget(std::list<WorldObject*>& targets)
{
- if (targetList.empty())
+ if (targets.empty())
{
FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update
return;
}
- Unit* target = Trinity::Containers::SelectRandomContainerElement(targetList);
- targetList.clear();
- targetList.push_back(target);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
_target = target;
}
- void SetTarget(std::list<Unit*>& targetList)
+ void SetTarget(std::list<WorldObject*>& targets)
{
- targetList.clear();
+ targets.clear();
if (_target)
- targetList.push_back(_target);
+ targets.push_back(_target);
}
void StartAttack()
{
GetCaster()->ClearUnitState(UNIT_STATE_CASTING);
+ GetCaster()->DeleteThreatList();
GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit());
+ GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff
+ }
+
+ // temporary, until SelectTarget are not called on empty lists
+ void CheckTarget()
+ {
+ if (_target)
+ return;
+
+ FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
+ GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack);
+ OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget);
}
- Unit* _target;
+ WorldObject* _target;
};
SpellScript* GetSpellScript() const
@@ -822,7 +933,7 @@ class ExactDistanceCheck
public:
ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {}
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* unit) const
{
return _source->GetExactDist2d(unit) > _dist;
}
@@ -841,15 +952,15 @@ class spell_putricide_slime_puddle : public SpellScriptLoader
{
PrepareSpellScript(spell_putricide_slime_puddle_SpellScript);
- void ScaleRange(std::list<Unit*>& targets)
+ void ScaleRange(std::list<WorldObject*>& targets)
{
targets.remove_if(ExactDistanceCheck(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)));
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
}
};
@@ -905,13 +1016,13 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader
uint32 stage = GetCaster()->ToCreature()->AI()->GetData(DATA_EXPERIMENT_STAGE);
Creature* target = NULL;
std::list<Creature*> creList;
- GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 100.0f);
+ GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f);
// 2 of them are spawned at green place - weird trick blizz
for (std::list<Creature*>::iterator itr = creList.begin(); itr != creList.end(); ++itr)
{
target = *itr;
std::list<Creature*> tmp;
- GetCreatureListWithEntryInGrid(tmp, target, NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 1.0f);
+ GetCreatureListWithEntryInGrid(tmp, target, NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 10.0f);
if ((!stage && tmp.size() > 1) || (stage && tmp.size() == 1))
break;
}
@@ -931,42 +1042,6 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader
}
};
-class spell_putricide_ooze_summon : public SpellScriptLoader
-{
- public:
- spell_putricide_ooze_summon() : SpellScriptLoader("spell_putricide_ooze_summon") { }
-
- class spell_putricide_ooze_summon_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_putricide_ooze_summon_AuraScript);
-
- void HandleTriggerSpell(AuraEffect const* aurEff)
- {
- PreventDefaultAction();
- if (Unit* caster = GetCaster())
- {
- uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
- float x, y, z;
- GetTarget()->GetPosition(x, y, z);
- z = GetTarget()->GetMap()->GetHeight(GetTarget()->GetPhaseMask(), x, y, z, true, 25.0f);
- x += 10.0f * cosf(caster->GetOrientation());
- y += 10.0f * sinf(caster->GetOrientation());
- caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID());
- }
- }
-
- void Register()
- {
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_ooze_summon_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
- }
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_putricide_ooze_summon_AuraScript();
- }
-};
-
class spell_putricide_ooze_eruption_searcher : public SpellScriptLoader
{
public:
@@ -1103,13 +1178,13 @@ class spell_putricide_eat_ooze : public SpellScriptLoader
{
PrepareSpellScript(spell_putricide_eat_ooze_SpellScript);
- void SelectTarget(std::list<Unit*>& targets)
+ void SelectTarget(std::list<WorldObject*>& targets)
{
if (targets.empty())
return;
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
- Unit* target = targets.front();
+ WorldObject* target = targets.front();
targets.clear();
targets.push_back(target);
}
@@ -1136,7 +1211,7 @@ class spell_putricide_eat_ooze : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_putricide_eat_ooze_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
}
};
@@ -1207,11 +1282,11 @@ class spell_putricide_mutation_init : public SpellScriptLoader
SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError)
{
- InstanceScript* instance = GetTargetUnit()->GetInstanceScript();
+ InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript();
if (!instance)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
- Creature* professor = ObjectAccessor::GetCreature(*GetTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE));
+ Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE));
if (!professor)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
@@ -1232,17 +1307,17 @@ class spell_putricide_mutation_init : public SpellScriptLoader
SpellCastResult CheckRequirement()
{
- if (!GetTargetUnit())
+ if (!GetExplTargetUnit())
return SPELL_FAILED_BAD_TARGETS;
- if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER)
+ if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_TARGET_NOT_PLAYER;
SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE;
SpellCastResult result = CheckRequirementInternal(extension);
if (result != SPELL_CAST_OK)
{
- Spell::SendCastResult(GetTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension);
+ Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension);
return result;
}
@@ -1383,15 +1458,15 @@ class spell_putricide_mutated_transformation_dmg : public SpellScriptLoader
{
PrepareSpellScript(spell_putricide_mutated_transformation_dmg_SpellScript);
- void FilterTargetsInitial(std::list<Unit*>& unitList)
+ void FilterTargetsInitial(std::list<WorldObject*>& targets)
{
if (Unit* owner = ObjectAccessor::GetUnit(*GetCaster(), GetCaster()->GetCreatorGUID()))
- unitList.remove(owner);
+ targets.remove(owner);
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -1429,14 +1504,15 @@ class spell_putricide_regurgitated_ooze : public SpellScriptLoader
}
};
-class spell_putricide_clear_mutated_plague : public SpellScriptLoader
+// Removes aura with id stored in effect value
+class spell_putricide_clear_aura_effect_value : public SpellScriptLoader
{
public:
- spell_putricide_clear_mutated_plague() : SpellScriptLoader("spell_putricide_clear_mutated_plague") { }
+ spell_putricide_clear_aura_effect_value() : SpellScriptLoader("spell_putricide_clear_aura_effect_value") { }
- class spell_putricide_clear_mutated_plague_SpellScript : public SpellScript
+ class spell_putricide_clear_aura_effect_value_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_putricide_clear_mutated_plague_SpellScript);
+ PrepareSpellScript(spell_putricide_clear_aura_effect_value_SpellScript);
void HandleScript(SpellEffIndex effIndex)
{
@@ -1447,13 +1523,13 @@ class spell_putricide_clear_mutated_plague : public SpellScriptLoader
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_mutated_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_aura_effect_value_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
- return new spell_putricide_clear_mutated_plague_SpellScript();
+ return new spell_putricide_clear_aura_effect_value_SpellScript();
}
};
@@ -1492,12 +1568,12 @@ void AddSC_boss_professor_putricide()
{
new boss_professor_putricide();
new npc_volatile_ooze();
+ new npc_gas_cloud();
new spell_putricide_gaseous_bloat();
new spell_putricide_ooze_channel();
new spell_putricide_slime_puddle();
new spell_putricide_slime_puddle_aura();
new spell_putricide_unstable_experiment();
- new spell_putricide_ooze_summon();
new spell_putricide_ooze_eruption_searcher();
new spell_putricide_choking_gas_bomb();
new spell_putricide_unbound_plague();
@@ -1508,6 +1584,6 @@ void AddSC_boss_professor_putricide()
new spell_putricide_mutated_transformation();
new spell_putricide_mutated_transformation_dmg();
new spell_putricide_regurgitated_ooze();
- new spell_putricide_clear_mutated_plague();
+ new spell_putricide_clear_aura_effect_value();
new spell_stinky_precious_decimate();
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 85de6789784..5a0560293da 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -449,23 +449,23 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0);
}
- void FilterTargets(std::list<Unit*>& targetList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
// get 2 targets except 2 nearest
- targetList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
+ targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
// .resize() runs pop_back();
- if (targetList.size() > 4)
- targetList.resize(4);
+ if (targets.size() > 4)
+ targets.resize(4);
- while (targetList.size() > 2)
- targetList.pop_front();
+ while (targets.size() > 2)
+ targets.pop_front();
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_rotface_ooze_flood_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_ooze_flood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_ooze_flood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
@@ -490,21 +490,21 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
return true;
}
- void FilterTargets(std::list<Unit*>& targets)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
// remove targets with this aura already
// tank is not on this list
- targets.remove_if (Trinity::UnitAuraCheck(true, GetSpellInfo()->Id));
+ targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id));
if (targets.empty())
return;
- Unit* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
_target = target;
}
- void ReplaceTargets(std::list<Unit*>& targets)
+ void ReplaceTargets(std::list<WorldObject*>& targets)
{
targets.clear();
if (_target)
@@ -520,13 +520,13 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets);
}
- Unit* _target;
+ WorldObject* _target;
};
SpellScript* GetSpellScript() const
@@ -716,13 +716,13 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
void CheckTarget(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(EFFECT_0);
- if (!GetTargetDest())
+ if (!GetExplTargetDest())
return;
uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
float x, y, z;
- GetTargetDest()->GetPosition(x, y, z);
+ GetExplTargetDest()->GetPosition(x, y, z);
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE)))
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index ab924d1b543..e3c0f2260df 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -19,6 +19,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
+#include "GridNotifiers.h"
#include "icecrown_citadel.h"
enum Texts
@@ -167,7 +168,7 @@ class FrostwyrmLandEvent : public BasicEvent
bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/)
{
- _owner.GetMotionMaster()->MoveLand(POINT_FROSTWYRM_LAND, _dest, 8.247422f);
+ _owner.GetMotionMaster()->MoveLand(POINT_FROSTWYRM_LAND, _dest);
return true;
}
@@ -183,7 +184,7 @@ class FrostBombExplosion : public BasicEvent
bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/)
{
- _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, true, NULL, NULL, _sindragosaGUID);
+ _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, NULL, NULL, _sindragosaGUID);
_owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL);
return true;
}
@@ -200,7 +201,7 @@ class boss_sindragosa : public CreatureScript
struct boss_sindragosaAI : public BossAI
{
- boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA)
+ boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA), _summoned(false)
{
}
@@ -220,7 +221,7 @@ class boss_sindragosa : public CreatureScript
_isInAirPhase = false;
_isThirdPhase = false;
- if (instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) != 255)
+ if (!_summoned)
{
me->SetCanFly(true);
me->SetDisableGravity(true);
@@ -266,10 +267,13 @@ class boss_sindragosa : public CreatureScript
{
if (action == ACTION_START_FROSTWYRM)
{
+ if (_summoned)
+ return;
+
+ _summoned = true;
if (TempSummon* summon = me->ToTempSummon())
summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN);
- instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 255);
if (me->isDead())
return;
@@ -481,7 +485,7 @@ class boss_sindragosa : public CreatureScript
Position pos;
pos.Relocate(me);
pos.m_positionZ += 17.0f;
- me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos, 8.30078125f);
+ me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos);
events.CancelEventGroup(EVENT_GROUP_LAND_PHASE);
events.ScheduleEvent(EVENT_AIR_PHASE, 110000);
break;
@@ -523,7 +527,7 @@ class boss_sindragosa : public CreatureScript
events.ScheduleEvent(EVENT_FROST_BREATH, urand(10000, 15000), EVENT_GROUP_LAND_PHASE);
events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(12000, 17000), EVENT_GROUP_LAND_PHASE);
events.ScheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE);
- me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos, 0.0f);
+ me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos);
break;
case EVENT_THIRD_PHASE_CHECK:
{
@@ -550,6 +554,7 @@ class boss_sindragosa : public CreatureScript
uint8 _mysticBuffetStack;
bool _isInAirPhase;
bool _isThirdPhase;
+ bool _summoned;
};
CreatureAI* GetAI(Creature* creature) const
@@ -642,7 +647,7 @@ class npc_spinestalker : public CreatureScript
struct npc_spinestalkerAI : public ScriptedAI
{
- npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
+ npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false)
{
}
@@ -651,7 +656,7 @@ class npc_spinestalker : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -664,7 +669,7 @@ class npc_spinestalker : public CreatureScript
_events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(8000, 12000));
me->SetReactState(REACT_DEFENSIVE);
- if (_instance->GetData(DATA_SPINESTALKER) != 255)
+ if (!_summoned)
{
me->SetCanFly(true);
me->SetDisableGravity(true);
@@ -674,20 +679,22 @@ class npc_spinestalker : public CreatureScript
void JustRespawned()
{
ScriptedAI::JustRespawned();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
}
void JustDied(Unit* /*killer*/)
{
_events.Reset();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 0);
}
void DoAction(int32 const action)
{
if (action == ACTION_START_FROSTWYRM)
{
- _instance->SetData(DATA_SPINESTALKER, 255);
+ if (_summoned)
+ return;
+
+ _summoned = true;
if (me->isDead())
return;
@@ -713,6 +720,7 @@ class npc_spinestalker : public CreatureScript
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetHomePosition(SpinestalkerLandPos);
+ me->SetFacingTo(SpinestalkerLandPos.GetOrientation());
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
@@ -753,6 +761,7 @@ class npc_spinestalker : public CreatureScript
private:
EventMap _events;
InstanceScript* _instance;
+ bool _summoned;
};
CreatureAI* GetAI(Creature* creature) const
@@ -768,7 +777,7 @@ class npc_rimefang : public CreatureScript
struct npc_rimefangAI : public ScriptedAI
{
- npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
+ npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false)
{
}
@@ -777,7 +786,7 @@ class npc_rimefang : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -790,7 +799,7 @@ class npc_rimefang : public CreatureScript
me->SetReactState(REACT_DEFENSIVE);
_icyBlastCounter = 0;
- if (_instance->GetData(DATA_RIMEFANG) != 255)
+ if (!_summoned)
{
me->SetCanFly(true);
me->SetDisableGravity(true);
@@ -800,20 +809,22 @@ class npc_rimefang : public CreatureScript
void JustRespawned()
{
ScriptedAI::JustRespawned();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade
+ _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
}
void JustDied(Unit* /*killer*/)
{
_events.Reset();
- _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 0);
}
void DoAction(int32 const action)
{
if (action == ACTION_START_FROSTWYRM)
{
- _instance->SetData(DATA_RIMEFANG, 255);
+ if (_summoned)
+ return;
+
+ _summoned = true;
if (me->isDead())
return;
@@ -839,6 +850,7 @@ class npc_rimefang : public CreatureScript
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetHomePosition(RimefangLandPos);
+ me->SetFacingTo(RimefangLandPos.GetOrientation());
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
@@ -906,6 +918,7 @@ class npc_rimefang : public CreatureScript
EventMap _events;
InstanceScript* _instance;
uint8 _icyBlastCounter;
+ bool _summoned;
};
CreatureAI* GetAI(Creature* creature) const
@@ -932,7 +945,8 @@ class npc_sindragosa_trash : public CreatureScript
// Increase add count
if (!me->isDead())
{
- _instance->SetData(_frostwyrmId, 1); // this cannot be in Reset because reset also happens on evade
+ if (me->GetEntry() == NPC_FROSTWING_WHELP)
+ _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
Reset();
}
}
@@ -954,13 +968,8 @@ class npc_sindragosa_trash : public CreatureScript
ScriptedAI::JustRespawned();
// Increase add count
- _instance->SetData(_frostwyrmId, 1); // this cannot be in Reset because reset also happens on evade
- }
-
- void JustDied(Unit* /*killer*/)
- {
- // Decrease add count
- _instance->SetData(_frostwyrmId, 0);
+ if (me->GetEntry() == NPC_FROSTWING_WHELP)
+ _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade
}
void SetData(uint32 type, uint32 data)
@@ -1033,12 +1042,31 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
bool Load()
{
_targetCount = 0;
- return true;
+
+ // This script should execute only in Icecrown Citadel
+ if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
+ if (instance->GetInstanceScript())
+ if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName))
+ return true;
+
+ return false;
+ }
+
+ void SelectDest()
+ {
+ if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
+ {
+ float destX = float(rand_norm()) * 75.0f + 4350.0f;
+ float destY = float(rand_norm()) * 75.0f + 2450.0f;
+ float destZ = 205.0f; // random number close to ground, get exact in next call
+ GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
+ dest->Relocate(destX, destY, destZ);
+ }
}
- void CountTargets(std::list<Unit*>& unitList)
+ void CountTargets(std::list<WorldObject*>& targets)
{
- _targetCount = unitList.size();
+ _targetCount = targets.size();
}
void HandleDummy(SpellEffIndex effIndex)
@@ -1049,10 +1077,10 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
return;
float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
- uint32 minResistFactor = uint32((resistance / (resistance + 510.0f))* 10.0f) * 2;
- uint32 randomResist = urand(0, (9 - minResistFactor) * 100)/100 + minResistFactor;
+ uint32 minResistFactor = uint32((resistance / (resistance + 510.0f)) * 10.0f) * 2;
+ uint32 randomResist = urand(0, (9 - minResistFactor) * 100) / 100 + minResistFactor;
- uint32 damage = (uint32(GetEffectValue()/_targetCount) * randomResist) / 10;
+ uint32 damage = (uint32(GetEffectValue() / _targetCount) * randomResist) / 10;
SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
damageInfo.damage = damage;
@@ -1062,8 +1090,9 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
void Register()
{
+ BeforeCast += SpellCastFn(spell_sindragosa_s_fury_SpellScript::SelectDest);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
}
uint32 _targetCount;
@@ -1080,9 +1109,11 @@ class UnchainedMagicTargetSelector
public:
UnchainedMagicTargetSelector() { }
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* object) const
{
- return unit->getPowerType() != POWER_MANA;
+ if (Unit* unit = object->ToUnit())
+ return unit->getPowerType() != POWER_MANA;
+ return true;
}
};
@@ -1095,7 +1126,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
{
PrepareSpellScript(spell_sindragosa_unchained_magic_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(UnchainedMagicTargetSelector());
uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 2);
@@ -1105,7 +1136,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -1288,7 +1319,7 @@ class MysticBuffetTargetFilter
public:
explicit MysticBuffetTargetFilter(Unit* caster) : _caster(caster) { }
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* unit) const
{
return !unit->IsWithinLOSInMap(_caster);
}
@@ -1306,14 +1337,14 @@ class spell_sindragosa_mystic_buffet : public SpellScriptLoader
{
PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- unitList.remove_if(MysticBuffetTargetFilter(GetCaster()));
+ targets.remove_if(MysticBuffetTargetFilter(GetCaster()));
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -1342,7 +1373,7 @@ class spell_rimefang_icy_blast : public SpellScriptLoader
void HandleTriggerMissile(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- if (Position const* pos = GetTargetDest())
+ if (Position const* pos = GetExplTargetDest())
if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000))
summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true);
}
@@ -1391,22 +1422,15 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
return true;
}
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
- {
- if ((*itr)->GetTypeId() != TYPEID_PLAYER)
- unitList.erase(itr++);
- else
- ++itr;
- }
-
- if (unitList.empty())
+ targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false));
+ if (targets.empty())
return;
- Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList);
- unitList.clear();
- unitList.push_back(target);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
}
void HandleForcedCast(SpellEffIndex effIndex)
@@ -1427,7 +1451,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp_SpellScript::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -1507,7 +1531,7 @@ class at_sindragosa_lair : public AreaTriggerScript
if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG)))
rimefang->AI()->DoAction(ACTION_START_FROSTWYRM);
- if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && instance->GetBossState(DATA_SINDRAGOSA) != DONE)
+ if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE)
{
if (player->GetMap()->IsHeroic() && !instance->GetData(DATA_HEROIC_ATTEMPTS))
return true;
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 2eb894a5153..a8657925131 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -138,7 +138,7 @@ enum Spells
SPELL_IN_FROSTMOURNE_ROOM = 74276,
SPELL_KILL_FROSTMOURNE_PLAYERS = 75127,
SPELL_HARVESTED_SOUL = 72679,
- SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582,
+ SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, // TODO: Cast every 3 seconds during Frostmourne phase, targets a Wicked Spirit amd activates it
// Frostmourne
SPELL_LIGHTS_FAVOR = 69382,
@@ -152,6 +152,7 @@ enum Spells
SPELL_SUMMON_SPIRIT_BOMB_1 = 73581, // (Heroic)
SPELL_SUMMON_SPIRIT_BOMB_2 = 74299, // (Heroic)
SPELL_EXPLOSION = 73576, // Spirit Bomb (Heroic)
+ SPELL_HARVEST_SOUL_DAMAGE_AURA = 73655,
// Outro
SPELL_FURY_OF_FROSTMOURNE = 72350,
@@ -221,7 +222,7 @@ enum Events
EVENT_QUAKE_2 = 27,
EVENT_VILE_SPIRITS = 28,
EVENT_HARVEST_SOULS = 29, // heroic only
- EVENT_WICKED_SPIRITS = 30,
+ EVENT_BERSERK = 30,
EVENT_SOUL_RIP = 31,
EVENT_DESTROY_SOUL = 32,
EVENT_FROSTMOURNE_TALK_1 = 33,
@@ -249,19 +250,18 @@ enum Events
EVENT_OUTRO_TERENAS_TALK_2 = 55,
EVENT_OUTRO_TALK_7 = 56,
EVENT_OUTRO_TALK_8 = 57,
- EVENT_BERSERK = 58,
// Shambling Horror
- EVENT_SHOCKWAVE = 59,
- EVENT_ENRAGE = 60,
+ EVENT_SHOCKWAVE = 58,
+ EVENT_ENRAGE = 59,
// Raging Spirit
- EVENT_SOUL_SHRIEK = 61,
+ EVENT_SOUL_SHRIEK = 60,
// Strangulate Vehicle (Harvest Soul)
- EVENT_TELEPORT = 62,
- EVENT_MOVE_TO_LICH_KING = 63,
- EVENT_DESPAWN_SELF = 64,
+ EVENT_TELEPORT = 61,
+ EVENT_MOVE_TO_LICH_KING = 62,
+ EVENT_DESPAWN_SELF = 63,
};
enum EventGroups
@@ -391,7 +391,7 @@ class HeightDifferenceCheck
{
}
- bool operator()(Unit* unit) const
+ bool operator()(WorldObject* unit) const
{
return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
}
@@ -475,6 +475,32 @@ class VileSpiritActivateEvent : public BasicEvent
Creature* _owner;
};
+class TriggerWickedSpirit : public BasicEvent
+{
+ public:
+ explicit TriggerWickedSpirit(Creature* owner)
+ : _owner(owner), _counter(13)
+ {
+ }
+
+ bool Execute(uint64 /*time*/, uint32 /*diff*/)
+ {
+ _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true);
+
+ if (--_counter)
+ {
+ _owner->m_Events.AddEvent(this, _owner->m_Events.CalculateTime(3000));
+ return false;
+ }
+
+ return true;
+ }
+
+ private:
+ Creature* _owner;
+ uint32 _counter;
+};
+
class boss_the_lich_king : public CreatureScript
{
public:
@@ -503,6 +529,8 @@ class boss_the_lich_king : public CreatureScript
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->GetMotionMaster()->MoveFall();
+ if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f))
+ frostmourne->DespawnOrUnsummon();
}
void EnterCombat(Unit* target)
@@ -601,8 +629,6 @@ class boss_the_lich_king : public CreatureScript
summons.DoAction(ACTION_TELEPORT_BACK, pred);
if (!IsHeroic())
Talk(SAY_LK_FROSTMOURNE_ESCAPE);
- else
- DoCastAOE(SPELL_TRIGGER_VILE_SPIRIT_HEROIC);
break;
}
default:
@@ -645,6 +671,8 @@ class boss_the_lich_king : public CreatureScript
if (events.GetPhaseMask() & PHASE_MASK_ONE && !HealthAbovePct(70))
{
events.SetPhase(PHASE_TRANSITION);
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
me->GetMotionMaster()->MovePoint(POINT_CENTER_1, CenterPosition);
return;
}
@@ -652,6 +680,8 @@ class boss_the_lich_king : public CreatureScript
if (events.GetPhaseMask() & PHASE_MASK_TWO && !HealthAbovePct(40))
{
events.SetPhase(PHASE_TRANSITION);
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
me->GetMotionMaster()->MovePoint(POINT_CENTER_2, CenterPosition);
return;
}
@@ -664,7 +694,8 @@ class boss_the_lich_king : public CreatureScript
events.SetPhase(PHASE_OUTRO);
summons.DespawnAll();
SendMusicToPlayers(MUSIC_FURY_OF_FROSTMOURNE);
- DoCastAOE(SPELL_FURY_OF_FROSTMOURNE);
+ me->InterruptNonMeleeSpells(true);
+ me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, TRIGGERED_NONE);
me->SetWalk(true);
events.ScheduleEvent(EVENT_OUTRO_TALK_1, 2600, 0, PHASE_OUTRO);
events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 6600, 0, PHASE_OUTRO);
@@ -712,7 +743,6 @@ class boss_the_lich_king : public CreatureScript
break;
case NPC_FROSTMOURNE_TRIGGER:
{
- summons.Summon(summon);
summon->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true);
SendLightOverride(LIGHT_SOULSTORM, 10000);
@@ -724,16 +754,11 @@ class boss_the_lich_king : public CreatureScript
case NPC_VILE_SPIRIT:
{
summons.Summon(summon);
- if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE)
- {
- TeleportSpirit(summon);
- return;
- }
-
summon->SetReactState(REACT_PASSIVE);
summon->SetSpeed(MOVE_FLIGHT, 0.5f);
summon->GetMotionMaster()->MoveRandom(10.0f);
- summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000));
+ if (!(events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE))
+ summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000));
return;
}
case NPC_STRANGULATE_VEHICLE:
@@ -756,7 +781,6 @@ class boss_the_lich_king : public CreatureScript
case NPC_VALKYR_SHADOWGUARD:
case NPC_RAGING_SPIRIT:
case NPC_VILE_SPIRIT:
- case NPC_WICKED_SPIRIT:
summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN);
break;
default:
@@ -802,8 +826,6 @@ class boss_the_lich_king : public CreatureScript
me->SetFacingTo(0.0f);
Talk(SAY_LK_REMORSELESS_WINTER);
SendMusicToPlayers(MUSIC_SPECIAL);
- me->SetReactState(REACT_PASSIVE);
- me->AttackStop();
DoCast(me, SPELL_REMORSELESS_WINTER_1);
events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions
events.ScheduleEvent(EVENT_QUAKE, 62500, 0, PHASE_TRANSITION);
@@ -819,8 +841,6 @@ class boss_the_lich_king : public CreatureScript
me->SetFacingTo(0.0f);
Talk(SAY_LK_REMORSELESS_WINTER);
SendMusicToPlayers(MUSIC_SPECIAL);
- me->SetReactState(REACT_PASSIVE);
- me->AttackStop();
DoCast(me, SPELL_REMORSELESS_WINTER_2);
summons.DespawnEntry(NPC_VALKYR_SHADOWGUARD);
events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions
@@ -992,10 +1012,6 @@ class boss_the_lich_king : public CreatureScript
DoCastAOE(SPELL_VILE_SPIRITS);
events.ScheduleEvent(EVENT_VILE_SPIRITS, urand(35000, 40000), EVENT_GROUP_VILE_SPIRITS, PHASE_THREE);
break;
- case EVENT_WICKED_SPIRITS:
- DoCastAOE(SPELL_VILE_SPIRITS);
- events.ScheduleEvent(EVENT_WICKED_SPIRITS, urand(35000, 40000), 0, PHASE_FROSTMOURNE);
- break;
case EVENT_HARVEST_SOULS:
Talk(SAY_LK_HARVEST_SOUL);
DoCastAOE(SPELL_HARVEST_SOULS);
@@ -1003,7 +1019,6 @@ class boss_the_lich_king : public CreatureScript
events.SetPhase(PHASE_FROSTMOURNE); // will stop running UpdateVictim (no evading)
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
- events.ScheduleEvent(EVENT_WICKED_SPIRITS, events.GetNextEventTime(EVENT_VILE_SPIRITS) - events.GetTimer(), 0, PHASE_FROSTMOURNE);
events.DelayEvents(50000, EVENT_GROUP_VILE_SPIRITS);
events.RescheduleEvent(EVENT_DEFILE, 50000, 0, PHASE_THREE);
events.RescheduleEvent(EVENT_SOUL_REAPER, urand(57000, 62000), 0, PHASE_THREE);
@@ -1019,16 +1034,22 @@ class boss_the_lich_king : public CreatureScript
if (!triggers.empty())
{
triggers.sort(Trinity::ObjectDistanceOrderPred(terenas, true));
- Unit* spawner = triggers.front();
+ Creature* spawner = triggers.front();
spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly
spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players
+ spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000));
}
for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i)
{
Creature* summon = ObjectAccessor::GetCreature(*me, *i);
if (summon && summon->GetEntry() == NPC_VILE_SPIRIT)
- TeleportSpirit(summon);
+ {
+ summon->m_Events.KillAllEvents(true);
+ summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(50000));
+ summon->GetMotionMaster()->MoveRandom(10.0f);
+ summon->SetReactState(REACT_PASSIVE);
+ }
}
}
break;
@@ -1099,22 +1120,6 @@ class boss_the_lich_king : public CreatureScript
}
private:
-
- void TeleportSpirit(Creature* summon)
- {
- float dist = me->GetObjectSize() + (15.0f - me->GetObjectSize()) * float(rand_norm());
- float angle = float(rand_norm()) * float(2.0f * M_PI);
- Position dest = TerenasSpawnHeroic;
- me->MovePosition(dest, dist, angle);
- dest.m_positionZ += 15.0f;
- summon->UpdateEntry(NPC_WICKED_SPIRIT);
- summon->SetReactState(REACT_PASSIVE);
- summon->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation());
- summon->SetSpeed(MOVE_FLIGHT, 0.5f);
- summon->m_Events.KillAllEvents(true);
- summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(1000));
- }
-
void SendMusicToPlayers(uint32 musicId) const
{
WorldPacket data(SMSG_PLAY_MUSIC, 4);
@@ -1635,8 +1640,13 @@ class npc_strangulate_vehicle : public CreatureScript
return;
if (TempSummon* summ = me->ToTempSummon())
+ {
if (Unit* summoner = summ->GetSummoner())
+ {
DoCast(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK);
+ summoner->RemoveAurasDueToSpell(SPELL_HARVEST_SOUL_DAMAGE_AURA);
+ }
+ }
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)))
lichKing->AI()->SummonedCreatureDespawn(me);
@@ -1993,6 +2003,10 @@ class npc_broken_frostmourne : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000, 0, PHASE_OUTRO);
}
+ void EnterEvadeMode()
+ {
+ }
+
void UpdateAI(uint32 const diff)
{
UpdateVictim();
@@ -2274,7 +2288,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader
{
PrepareSpellScript(spell_the_lich_king_shadow_trap_periodic_SpellScript);
- void CheckTargetCount(std::list<Unit*>& targets)
+ void CheckTargetCount(std::list<WorldObject*>& targets)
{
if (targets.empty())
return;
@@ -2284,7 +2298,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -2308,10 +2322,10 @@ class spell_the_lich_king_quake : public SpellScriptLoader
return GetCaster()->GetInstanceScript() != NULL;
}
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM)))
- unitList.remove_if(HeightDifferenceCheck(platform, 5.0f, false));
+ targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false));
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)
@@ -2322,7 +2336,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHit += SpellEffectFn(spell_the_lich_king_quake_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT);
}
};
@@ -2349,7 +2363,7 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader
return true;
}
- void CheckTargetCount(std::list<Unit*>& unitList)
+ void CheckTargetCount(std::list<WorldObject*>& unitList)
{
if (unitList.empty())
return;
@@ -2357,12 +2371,16 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader
// if there is at least one affected target cast the explosion
GetCaster()->CastSpell(GetCaster(), SPELL_ICE_BURST, true);
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
+ {
+ GetCaster()->ToCreature()->SetReactState(REACT_PASSIVE);
+ GetCaster()->AttackStop();
GetCaster()->ToCreature()->DespawnOrUnsummon(500);
+ }
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -2411,7 +2429,7 @@ class ExactDistanceCheck
public:
ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {}
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* unit)
{
return _source->GetExactDist2d(unit) > _dist;
}
@@ -2430,7 +2448,7 @@ class spell_the_lich_king_defile : public SpellScriptLoader
{
PrepareSpellScript(spell_the_lich_king_defile_SpellScript);
- void CorrectRange(std::list<Unit*>& targets)
+ void CorrectRange(std::list<WorldObject*>& targets)
{
targets.remove_if(ExactDistanceCheck(GetCaster(), 10.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)));
}
@@ -2446,8 +2464,8 @@ class spell_the_lich_king_defile : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnHit += SpellHitFn(spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow);
}
};
@@ -2470,16 +2488,20 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader
void ModDestHeight(SpellEffIndex effIndex)
{
static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f};
- WorldLocation* dest = const_cast<WorldLocation*>(GetTargetDest());
+ WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest());
dest->RelocateOffset(offset);
+ GetHitDest()->RelocateOffset(offset);
// spirit bombs get higher
if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB)
+ {
dest->RelocateOffset(offset);
+ GetHitDest()->RelocateOffset(offset);
+ }
}
void Register()
{
- OnEffectLaunch += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON);
+ OnEffectHit += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
@@ -2545,26 +2567,26 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
return true;
}
- void SelectTarget(std::list<Unit*>& unitList)
+ void SelectTarget(std::list<WorldObject*>& targets)
{
- if (unitList.empty())
+ if (targets.empty())
return;
- unitList.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id));
- if (unitList.empty())
+ targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id));
+ if (targets.empty())
return;
- _target = Trinity::Containers::SelectRandomContainerElement(unitList);
- unitList.clear();
- unitList.push_back(_target);
+ _target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(_target);
GetCaster()->GetAI()->SetGUID(_target->GetGUID());
}
- void ReplaceTarget(std::list<Unit*>& unitList)
+ void ReplaceTarget(std::list<WorldObject*>& targets)
{
- unitList.clear();
+ targets.clear();
if (_target)
- unitList.push_back(_target);
+ targets.push_back(_target);
}
void HandleScript(SpellEffIndex effIndex)
@@ -2575,12 +2597,12 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
- Unit* _target;
+ WorldObject* _target;
};
SpellScript* GetSpellScript() const
@@ -2727,7 +2749,7 @@ class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader
void ModDestHeight(SpellEffIndex /*effIndex*/)
{
Position offset = {0.0f, 0.0f, 15.0f, 0.0f};
- const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset);
+ const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
}
void Register()
@@ -2757,7 +2779,7 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
- void SelectTarget(std::list<Unit*>& targets)
+ void SelectTarget(std::list<WorldObject*>& targets)
{
if (targets.empty())
return;
@@ -2778,11 +2800,11 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
- Unit* _target;
+ WorldObject* _target;
};
SpellScript* GetSpellScript() const
@@ -2805,7 +2827,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
- void CheckTargetCount(std::list<Unit*>& targets)
+ void CheckTargetCount(std::list<WorldObject*>& targets)
{
if (targets.empty())
return;
@@ -2822,7 +2844,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
Unit* _target;
@@ -2954,6 +2976,15 @@ class spell_the_lich_king_restore_soul : public SpellScriptLoader
lichKing->AI()->DoAction(ACTION_TELEPORT_BACK);
if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f))
spawner->RemoveAllAuras();
+
+ std::list<Creature*> spirits;
+ GetCaster()->GetCreatureListWithEntryInGrid(spirits, NPC_WICKED_SPIRIT, 200.0f);
+ for (std::list<Creature*>::iterator itr = spirits.begin(); itr != spirits.end(); ++itr)
+ {
+ (*itr)->m_Events.KillAllEvents(true);
+ (*itr)->SetReactState(REACT_PASSIVE);
+ (*itr)->AI()->EnterEvadeMode();
+ }
}
void RemoveAura()
@@ -3046,23 +3077,18 @@ class spell_the_lich_king_trigger_vile_spirit : public SpellScriptLoader
{
PrepareSpellScript(spell_the_lich_king_trigger_vile_spirit_SpellScript);
- void TeleportOutside()
+ void ActivateSpirit()
{
Creature* target = GetHitCreature();
if (!target)
return;
- Position dest;
- Position offset;
- TerenasSpawnHeroic.GetPositionOffsetTo(*target, offset);
- GetCaster()->GetPosition(&dest);
- dest.RelocateOffset(offset);
- target->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation());
+ VileSpiritActivateEvent(target).Execute(0, 0);
}
void Register()
{
- OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::TeleportOutside);
+ OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index ed1ca4d20fb..826c62a4390 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -262,7 +262,7 @@ class ValithriaDespawner : public BasicEvent
if (CreatureData const* data = creature->GetCreatureData())
creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
- creature->ForcedDespawn();
+ creature->DespawnOrUnsummon();
creature->SetCorpseDelay(corpseDelay);
creature->SetRespawnDelay(respawnDelay);
@@ -1013,11 +1013,8 @@ class npc_dream_portal : public CreatureScript
{
}
- void DoAction(int32 const action)
+ void OnSpellClick(Unit* /*clicker*/)
{
- if (action != EVENT_SPELLCLICK)
- return;
-
_used = true;
me->DespawnOrUnsummon();
}
@@ -1087,7 +1084,7 @@ class npc_dream_cloud : public CreatureScript
me->GetMotionMaster()->MoveIdle();
// must use originalCaster the same for all clouds to allow stacking
me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER));
- me->ForcedDespawn(100);
+ me->DespawnOrUnsummon(100);
break;
default:
break;
@@ -1190,13 +1187,13 @@ class spell_dreamwalker_summoner : public SpellScriptLoader
return true;
}
- void FilterTargets(std::list<Unit*>& targets)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- targets.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
+ targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
if (targets.empty())
return;
- Unit* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
@@ -1212,7 +1209,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
}
};
@@ -1241,7 +1238,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader
std::list<Creature*> summoners;
GetCreatureListWithEntryInGrid(summoners, caster, NPC_WORLD_TRIGGER, 100.0f);
- summoners.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
+ summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
Trinity::Containers::RandomResizeList(summoners, 2);
if (summoners.empty())
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index c99fde1739c..17e33912a86 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -19,6 +19,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "PassiveAI.h"
#include "Cell.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
@@ -158,6 +159,9 @@ enum Spells
SPELL_FEL_IRON_BOMB_UNDEAD = 71787,
SPELL_MACHINE_GUN_UNDEAD = 71788,
SPELL_ROCKET_LAUNCH_UNDEAD = 71786,
+
+ // Invisible Stalker (Float, Uninteractible, LargeAOI)
+ SPELL_SOUL_MISSILE = 72585,
};
// Helper defines
@@ -248,6 +252,9 @@ enum EventTypes
EVENT_RUPERT_FEL_IRON_BOMB = 52,
EVENT_RUPERT_MACHINE_GUN = 53,
EVENT_RUPERT_ROCKET_LAUNCH = 54,
+
+ // Invisible Stalker (Float, Uninteractible, LargeAOI)
+ EVENT_SOUL_MISSILE = 55,
};
enum DataTypesICC
@@ -346,7 +353,7 @@ class FrostwingGauntletRespawner
if (CreatureData const* data = creature->GetCreatureData())
creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
- creature->ForcedDespawn();
+ creature->DespawnOrUnsummon();
creature->SetCorpseDelay(corpseDelay);
creature->SetRespawnDelay(respawnDelay);
@@ -796,7 +803,8 @@ class boss_sister_svalna : public CreatureScript
{
_JustReachedHome();
me->SetReactState(REACT_PASSIVE);
- me->SetCanFly(false);
+ me->SetDisableGravity(false);
+ me->SetHover(false);
}
void DoAction(int32 const action)
@@ -838,13 +846,14 @@ class boss_sister_svalna : public CreatureScript
void MovementInform(uint32 type, uint32 id)
{
- if (type != POINT_MOTION_TYPE || id != POINT_LAND)
+ if (type != EFFECT_MOTION_TYPE || id != POINT_LAND)
return;
_isEventInProgress = false;
me->setActive(false);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- me->SetCanFly(false);
+ me->SetDisableGravity(false);
+ me->SetHover(false);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell)
@@ -1288,7 +1297,7 @@ struct npc_argent_captainAI : public ScriptedAI
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
{
IsUndead = true;
- me->setDeathState(JUST_ALIVED);
+ me->setDeathState(JUST_RESPAWNED);
uint32 newEntry = 0;
switch (me->GetEntry())
{
@@ -1666,6 +1675,56 @@ class npc_impaling_spear : public CreatureScript
}
};
+class npc_arthas_teleport_visual : public CreatureScript
+{
+ public:
+ npc_arthas_teleport_visual() : CreatureScript("npc_arthas_teleport_visual") { }
+
+ struct npc_arthas_teleport_visualAI : public NullCreatureAI
+ {
+ npc_arthas_teleport_visualAI(Creature* creature) : NullCreatureAI(creature), _instance(creature->GetInstanceScript())
+ {
+ }
+
+ void Reset()
+ {
+ _events.Reset();
+ if (_instance->GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE &&
+ _instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE &&
+ _instance->GetBossState(DATA_SINDRAGOSA) == DONE)
+ _events.ScheduleEvent(EVENT_SOUL_MISSILE, urand(1000, 6000));
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ if (_events.ExecuteEvent() == EVENT_SOUL_MISSILE)
+ {
+ DoCastAOE(SPELL_SOUL_MISSILE);
+ _events.ScheduleEvent(EVENT_SOUL_MISSILE, urand(5000, 7000));
+ }
+ }
+
+ private:
+ InstanceScript* _instance;
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ // Distance from the center of the spire
+ if (creature->GetExactDist2d(4357.052f, 2769.421f) < 100.0f && creature->GetHomePosition().GetPositionZ() < 315.0f)
+ return GetIcecrownCitadelAI<npc_arthas_teleport_visualAI>(creature);
+
+ // Default to no script
+ return NULL;
+ }
+};
+
class spell_icc_stoneform : public SpellScriptLoader
{
public:
@@ -1775,15 +1834,15 @@ class DeathPlagueTargetSelector
public:
explicit DeathPlagueTargetSelector(Unit* caster) : _caster(caster) {}
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* object) const
{
- if (unit == _caster)
+ if (object == _caster)
return true;
- if (unit->GetTypeId() != TYPEID_PLAYER)
+ if (object->GetTypeId() != TYPEID_PLAYER)
return true;
- if (unit->HasAura(SPELL_RECENTLY_INFECTED) || unit->HasAura(SPELL_DEATH_PLAGUE_AURA))
+ if (object->ToUnit()->HasAura(SPELL_RECENTLY_INFECTED) || object->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA))
return true;
return false;
@@ -1809,25 +1868,25 @@ class spell_frost_giant_death_plague : public SpellScriptLoader
}
// First effect
- void CountTargets(std::list<Unit*>& unitList)
+ void CountTargets(std::list<WorldObject*>& targets)
{
- unitList.remove(GetCaster());
- _failed = unitList.empty();
+ targets.remove(GetCaster());
+ _failed = targets.empty();
}
// Second effect
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
// Select valid targets for jump
- unitList.remove_if (DeathPlagueTargetSelector(GetCaster()));
- if (!unitList.empty())
+ targets.remove_if(DeathPlagueTargetSelector(GetCaster()));
+ if (!targets.empty())
{
- Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList);
- unitList.clear();
- unitList.push_back(target);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
}
- unitList.push_back(GetCaster());
+ targets.push_back(GetCaster());
}
void HandleScript(SpellEffIndex effIndex)
@@ -1841,8 +1900,8 @@ class spell_frost_giant_death_plague : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_frost_giant_death_plague_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
OnEffectHitTarget += SpellEffectFn(spell_frost_giant_death_plague_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
@@ -1891,9 +1950,11 @@ class spell_icc_harvest_blight_specimen : public SpellScriptLoader
class AliveCheck
{
public:
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* object) const
{
- return unit->isAlive();
+ if (Unit* unit = object->ToUnit())
+ return unit->isAlive();
+ return true;
}
};
@@ -1906,10 +1967,10 @@ class spell_svalna_revive_champion : public SpellScriptLoader
{
PrepareSpellScript(spell_svalna_revive_champion_SpellScript);
- void RemoveAliveTarget(std::list<Unit*>& unitList)
+ void RemoveAliveTarget(std::list<WorldObject*>& targets)
{
- unitList.remove_if(AliveCheck());
- Trinity::Containers::RandomResizeList(unitList, 2);
+ targets.remove_if(AliveCheck());
+ Trinity::Containers::RandomResizeList(targets, 2);
}
void Land(SpellEffIndex /*effIndex*/)
@@ -1921,15 +1982,15 @@ class spell_svalna_revive_champion : public SpellScriptLoader
Position pos;
caster->GetPosition(&pos);
caster->GetNearPosition(pos, 5.0f, 0.0f);
- pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f);
- pos.m_positionZ += 0.05f;
+ //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
+ //pos.m_positionZ += 0.05f;
caster->SetHomePosition(pos);
- caster->GetMotionMaster()->MovePoint(POINT_LAND, pos);
+ caster->GetMotionMaster()->MoveLand(POINT_LAND, pos);
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
OnEffectHit += SpellEffectFn(spell_svalna_revive_champion_SpellScript::Land, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -1972,6 +2033,33 @@ class spell_svalna_remove_spear : public SpellScriptLoader
}
};
+class spell_icc_soul_missile : public SpellScriptLoader
+{
+ public:
+ spell_icc_soul_missile() : SpellScriptLoader("spell_icc_soul_missile") { }
+
+ class spell_icc_soul_missile_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_icc_soul_missile_SpellScript);
+
+ void RelocateDest()
+ {
+ static Position const offset = {0.0f, 0.0f, 200.0f, 0.0f};
+ const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
+ }
+
+ void Register()
+ {
+ OnCast += SpellCastFn(spell_icc_soul_missile_SpellScript::RelocateDest);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_icc_soul_missile_SpellScript();
+ }
+};
+
class at_icc_saurfang_portal : public AreaTriggerScript
{
public:
@@ -2061,6 +2149,7 @@ void AddSC_icecrown_citadel()
new npc_captain_rupert();
new npc_frostwing_vrykul();
new npc_impaling_spear();
+ new npc_arthas_teleport_visual();
new spell_icc_stoneform();
new spell_icc_sprit_alarm();
new spell_frost_giant_death_plague();
@@ -2068,6 +2157,7 @@ void AddSC_icecrown_citadel()
new spell_trigger_spell_from_caster("spell_svalna_caress_of_death", SPELL_IMPALING_SPEAR_KILL);
new spell_svalna_revive_champion();
new spell_svalna_remove_spear();
+ new spell_icc_soul_missile();
new at_icc_saurfang_portal();
new at_icc_shutdown_traps();
new at_icc_start_blood_quickening();
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
index 224777c3db7..31639a698ef 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -51,6 +51,7 @@ enum SharedSpells
SPELL_GREEN_BLIGHT_RESIDUE = 72145,
// The Lich King
+ SPELL_ARTHAS_TELEPORTER_CEREMONY = 72915,
SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078,
};
@@ -275,6 +276,9 @@ enum CreaturesIds
NPC_WORLD_TRIGGER_INFINITE_AOI = 36171,
NPC_SPIRIT_BOMB = 39189,
NPC_FROSTMOURNE_TRIGGER = 38584,
+
+ // Generic
+ NPC_INVISIBLE_STALKER = 30298,
};
enum GameObjectsIds
@@ -345,6 +349,7 @@ enum GameObjectsIds
GO_SIGIL_OF_THE_FROSTWING = 202181,
// The Lich King
+ GO_SCOURGE_TRANSPORTER_LK = 202223,
GO_ARTHAS_PLATFORM = 202161,
GO_ARTHAS_PRECIPICE = 202078,
GO_DOODAD_ICECROWN_THRONEFROSTYWIND01 = 202188,
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index cb83efc748f..650f426d29c 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -130,6 +130,7 @@ class instance_icecrown_citadel : public InstanceMapScript
SindragosaGUID = 0;
SpinestalkerGUID = 0;
RimefangGUID = 0;
+ TheLichKingTeleportGUID = 0;
TheLichKingGUID = 0;
HighlordTirionFordringGUID = 0;
TerenasMenethilGUID = 0;
@@ -138,9 +139,6 @@ class instance_icecrown_citadel : public InstanceMapScript
FrozenThroneEdgeGUID = 0;
FrozenThroneWindGUID = 0;
FrozenThroneWarningGUID = 0;
- FrostwyrmCount = 0;
- SpinestalkerTrashCount = 0;
- RimefangTrashCount = 0;
IsBonedEligible = true;
IsOozeDanceEligible = true;
IsNauseaEligible = true;
@@ -283,6 +281,11 @@ class instance_icecrown_citadel : public InstanceMapScript
case NPC_RIMEFANG:
RimefangGUID = creature->GetGUID();
break;
+ case NPC_INVISIBLE_STALKER:
+ // Teleporter visual at center
+ if (creature->GetExactDist2d(4357.052f, 2769.421f) < 10.0f)
+ creature->CastSpell(creature, SPELL_ARTHAS_TELEPORTER_CEREMONY, false);
+ break;
case NPC_THE_LICH_KING:
TheLichKingGUID = creature->GetGUID();
break;
@@ -293,11 +296,22 @@ class instance_icecrown_citadel : public InstanceMapScript
case NPC_TERENAS_MENETHIL_FROSTMOURNE_H:
TerenasMenethilGUID = creature->GetGUID();
break;
+ case NPC_WICKED_SPIRIT:
+ // Remove corpse as soon as it dies (and respawn 10 seconds later)
+ creature->SetCorpseDelay(0);
+ creature->SetReactState(REACT_PASSIVE);
+ break;
default:
break;
}
}
+ void OnCreatureRemove(Creature* creature)
+ {
+ if (creature->GetEntry() == NPC_SINDRAGOSA)
+ SindragosaGUID = 0;
+ }
+
// Weekly quest spawn prevention
uint32 GetCreatureEntry(uint32 /*guidLow*/, CreatureData const* data)
{
@@ -347,6 +361,43 @@ class instance_icecrown_citadel : public InstanceMapScript
if (Creature* crok = instance->GetCreature(CrokScourgebaneGUID))
crok->AI()->SetGUID(creature->GetGUID(), ACTION_VRYKUL_DEATH);
break;
+ case NPC_FROSTWING_WHELP:
+ if (FrostwyrmGUIDs.empty())
+ return;
+
+ if (creature->AI()->GetData(1/*DATA_FROSTWYRM_OWNER*/) == DATA_SPINESTALKER)
+ {
+ SpinestalkerTrash.erase(creature->GetDBTableGUIDLow());
+ if (SpinestalkerTrash.empty())
+ if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID))
+ spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM);
+ }
+ else
+ {
+ RimefangTrash.erase(creature->GetDBTableGUIDLow());
+ if (RimefangTrash.empty())
+ if (Creature* spinestalk = instance->GetCreature(RimefangGUID))
+ spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM);
+ }
+ break;
+ case NPC_RIMEFANG:
+ case NPC_SPINESTALKER:
+ {
+ if (instance->IsHeroic() && !HeroicAttempts)
+ return;
+
+ if (GetBossState(DATA_SINDRAGOSA) == DONE)
+ return;
+
+ FrostwyrmGUIDs.erase(creature->GetDBTableGUIDLow());
+ if (FrostwyrmGUIDs.empty())
+ {
+ instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY());
+ if (Creature* boss = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos))
+ boss->AI()->DoAction(ACTION_START_FROSTWYRM);
+ }
+ break;
+ }
default:
break;
}
@@ -460,6 +511,11 @@ class instance_icecrown_citadel : public InstanceMapScript
go->SetLootRecipient(valithria->GetLootRecipient());
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN);
break;
+ case GO_SCOURGE_TRANSPORTER_LK:
+ TheLichKingTeleportGUID = go->GetGUID();
+ if (GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && GetBossState(DATA_SINDRAGOSA) == DONE)
+ go->SetGoState(GO_STATE_ACTIVE);
+ break;
case GO_ARTHAS_PLATFORM:
// this enables movement at The Frozen Throne, when printed this value is 0.000000f
// however, when represented as integer client will accept only this value
@@ -538,11 +594,11 @@ class instance_icecrown_citadel : public InstanceMapScript
switch (type)
{
case DATA_SINDRAGOSA_FROSTWYRMS:
- return FrostwyrmCount;
+ return FrostwyrmGUIDs.size();
case DATA_SPINESTALKER:
- return SpinestalkerTrashCount;
+ return SpinestalkerTrash.size();
case DATA_RIMEFANG:
- return RimefangTrashCount;
+ return RimefangTrash.size();
case DATA_COLDFLAME_JETS:
return ColdflameJetsState;
case DATA_TEAM_IN_INSTANCE:
@@ -698,6 +754,8 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
case DATA_PROFESSOR_PUTRICIDE:
HandleGameObject(PlagueSigilGUID, state != DONE);
+ if (state == DONE)
+ CheckLichKingAvailability();
if (instance->IsHeroic())
{
if (state == FAIL && HeroicAttempts)
@@ -712,6 +770,8 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
case DATA_BLOOD_QUEEN_LANA_THEL:
HandleGameObject(BloodwingSigilGUID, state != DONE);
+ if (state == DONE)
+ CheckLichKingAvailability();
if (instance->IsHeroic())
{
if (state == FAIL && HeroicAttempts)
@@ -730,6 +790,8 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
case DATA_SINDRAGOSA:
HandleGameObject(FrostwingSigilGUID, state != DONE);
+ if (state == DONE)
+ CheckLichKingAvailability();
if (instance->IsHeroic())
{
if (state == FAIL && HeroicAttempts)
@@ -798,89 +860,14 @@ class instance_icecrown_citadel : public InstanceMapScript
IsOrbWhispererEligible = data ? true : false;
break;
case DATA_SINDRAGOSA_FROSTWYRMS:
- {
- if (FrostwyrmCount == 255)
- return;
-
- if (instance->IsHeroic() && !HeroicAttempts)
- return;
-
- if (GetBossState(DATA_SINDRAGOSA) == DONE)
- return;
-
- switch (data)
- {
- case 0:
- if (FrostwyrmCount)
- {
- --FrostwyrmCount;
- if (!FrostwyrmCount)
- {
- instance->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY());
- if (Creature* boss = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos))
- boss->AI()->DoAction(ACTION_START_FROSTWYRM);
- }
- }
- break;
- case 1:
- ++FrostwyrmCount;
- break;
- default:
- FrostwyrmCount = data;
- break;
- }
+ FrostwyrmGUIDs.insert(data);
break;
- }
case DATA_SPINESTALKER:
- {
- if (SpinestalkerTrashCount == 255)
- return;
-
- switch (data)
- {
- case 0:
- if (SpinestalkerTrashCount)
- {
- --SpinestalkerTrashCount;
- if (!SpinestalkerTrashCount)
- if (Creature* spinestalk = instance->GetCreature(SpinestalkerGUID))
- spinestalk->AI()->DoAction(ACTION_START_FROSTWYRM);
- }
- break;
- case 1:
- ++SpinestalkerTrashCount;
- break;
- default:
- SpinestalkerTrashCount = data;
- break;
- }
+ SpinestalkerTrash.insert(data);
break;
- }
case DATA_RIMEFANG:
- {
- if (RimefangTrashCount == 255)
- return;
-
- switch (data)
- {
- case 0:
- if (RimefangTrashCount)
- {
- --RimefangTrashCount;
- if (!RimefangTrashCount)
- if (Creature* rime = instance->GetCreature(RimefangGUID))
- rime->AI()->DoAction(ACTION_START_FROSTWYRM);
- }
- break;
- case 1:
- ++RimefangTrashCount;
- break;
- default:
- RimefangTrashCount = data;
- break;
- }
+ RimefangTrash.insert(data);
break;
- }
case DATA_COLDFLAME_JETS:
ColdflameJetsState = data;
if (ColdflameJetsState == DONE)
@@ -1095,6 +1082,28 @@ class instance_icecrown_citadel : public InstanceMapScript
return true;
}
+ void CheckLichKingAvailability()
+ {
+ if (GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && GetBossState(DATA_SINDRAGOSA) == DONE)
+ {
+ if (GameObject* teleporter = instance->GetGameObject(TheLichKingTeleportGUID))
+ {
+ teleporter->SetGoState(GO_STATE_ACTIVE);
+
+ std::list<Creature*> stalkers;
+ GetCreatureListWithEntryInGrid(stalkers, teleporter, NPC_INVISIBLE_STALKER, 100.0f);
+ if (stalkers.empty())
+ return;
+
+ stalkers.sort(Trinity::ObjectDistanceOrderPred(teleporter));
+ stalkers.front()->CastSpell((Unit*)NULL, SPELL_ARTHAS_TELEPORTER_CEREMONY, false);
+ stalkers.pop_front();
+ for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
+ (*itr)->AI()->Reset();
+ }
+ }
+ }
+
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
@@ -1276,6 +1285,7 @@ class instance_icecrown_citadel : public InstanceMapScript
uint64 SindragosaGUID;
uint64 SpinestalkerGUID;
uint64 RimefangGUID;
+ uint64 TheLichKingTeleportGUID;
uint64 TheLichKingGUID;
uint64 HighlordTirionFordringGUID;
uint64 TerenasMenethilGUID;
@@ -1289,9 +1299,9 @@ class instance_icecrown_citadel : public InstanceMapScript
uint64 PillarsUnchainedGUID;
uint32 TeamInInstance;
uint32 ColdflameJetsState;
- uint32 FrostwyrmCount;
- uint32 SpinestalkerTrashCount;
- uint32 RimefangTrashCount;
+ std::set<uint32> FrostwyrmGUIDs;
+ std::set<uint32> SpinestalkerTrash;
+ std::set<uint32> RimefangTrash;
uint32 BloodQuickeningState;
uint32 HeroicAttempts;
uint16 BloodQuickeningMinutes;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
index 1671eab0b32..8901a61e79d 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
#define SAY_GREET RAND(-1533000, -1533004, -1533005, -1533006, -1533007)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index 058c5b35e3a..636f2318712 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
enum Yells
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index 17ed6a79c76..29a0a11af9b 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "naxxramas.h"
enum Horsemen
@@ -26,6 +29,11 @@ enum Horsemen
HORSEMEN_SIR,
};
+enum Spells
+{
+ SPELL_MARK_DAMAGE = 28836
+};
+
enum Events
{
EVENT_NONE,
@@ -96,6 +104,7 @@ public:
if (me->GetEntry() == MOB_HORSEMEN[i])
id = Horsemen(i);
caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR);
+ encounterActionReset = false;
}
Horsemen id;
@@ -395,7 +404,63 @@ public:
};
+class spell_four_horsemen_mark : public SpellScriptLoader
+{
+ public:
+ spell_four_horsemen_mark() : SpellScriptLoader("spell_four_horsemen_mark") { }
+
+ class spell_four_horsemen_mark_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_four_horsemen_mark_AuraScript);
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ {
+ int32 damage;
+ switch (GetStackAmount())
+ {
+ case 1:
+ damage = 0;
+ break;
+ case 2:
+ damage = 500;
+ break;
+ case 3:
+ damage = 1000;
+ break;
+ case 4:
+ damage = 1500;
+ break;
+ case 5:
+ damage = 4000;
+ break;
+ case 6:
+ damage = 12000;
+ break;
+ default:
+ damage = 20000 + 1000 * (GetStackAmount() - 7);
+ break;
+ }
+ if (damage)
+ caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget());
+ }
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_four_horsemen_mark_AuraScript();
+ }
+};
+
void AddSC_boss_four_horsemen()
{
new boss_four_horsemen();
+ new spell_four_horsemen_mark();
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index 47dfaa7f772..69443b2824e 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
#define SPELL_MORTAL_WOUND 25646
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 8d23de5427c..2ea234775c0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -15,7 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "GridNotifiers.h"
+#include "CombatAI.h"
#include "naxxramas.h"
enum Yells
@@ -25,6 +29,7 @@ enum Yells
SAY_DEATH = -1533042,
SAY_TELEPORT = -1533043
};
+
//Gothik
enum Spells
{
@@ -36,8 +41,11 @@ enum Spells
SPELL_INFORM_LIVE_RIDER = 27935,
SPELL_INFORM_DEAD_TRAINEE = 27915,
SPELL_INFORM_DEAD_KNIGHT = 27931,
- SPELL_INFORM_DEAD_RIDER = 27937
+ SPELL_INFORM_DEAD_RIDER = 27937,
+
+ SPELL_SHADOW_MARK = 27825
};
+
enum Creatures
{
MOB_LIVE_TRAINEE = 16124,
@@ -192,7 +200,7 @@ class boss_gothik : public CreatureScript
if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
{
- sLog->outError("Script Gothik: cannot summon triggers!");
+ sLog->outError(LOG_FILTER_TSCR, "Script Gothik: cannot summon triggers!");
EnterEvadeMode();
return;
}
@@ -585,8 +593,35 @@ class mob_gothik_minion : public CreatureScript
}
};
+class spell_gothik_shadow_bolt_volley : public SpellScriptLoader
+{
+ public:
+ spell_gothik_shadow_bolt_volley() : SpellScriptLoader("spell_gothik_shadow_bolt_volley") { }
+
+ class spell_gothik_shadow_bolt_volley_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK));
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gothik_shadow_bolt_volley_SpellScript();
+ }
+};
+
void AddSC_boss_gothik()
{
new boss_gothik();
new mob_gothik_minion();
+ new spell_gothik_shadow_bolt_volley();
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
index 039b9b1e007..5a55a4f1c4b 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
#define SPELL_BOMBARD_SLIME 28280
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index d84cfb8949e..93eab5df237 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "naxxramas.h"
#define SAY_AGGRO RAND(-1533109, -1533110, -1533111)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 4d6bfc578ff..10b40b490c4 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -23,7 +23,10 @@ SDComment: VERIFY SCRIPT
SDCategory: Naxxramas
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "naxxramas.h"
enum Yells
@@ -86,6 +89,7 @@ enum Spells
SPELL_SHADOW_FISURE = 27810,
SPELL_VOID_BLAST = 27812,
SPELL_MANA_DETONATION = 27819,
+ SPELL_MANA_DETONATION_DAMAGE = 27820,
SPELL_FROST_BLAST = 27808,
SPELL_CHAINS_OF_KELTHUZAD = 28410, //28408 script effect
SPELL_KELTHUZAD_CHANNEL = 29423,
@@ -299,7 +303,7 @@ public:
for (itr = chained.begin(); itr != chained.end(); ++itr)
{
if (Player* charmed = Unit::GetPlayer(*me, (*itr).first))
- charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second);
+ charmed->SetObjectScale((*itr).second);
}
chained.clear();
@@ -347,7 +351,7 @@ public:
for (itr = chained.begin(); itr != chained.end(); ++itr)
{
if (Player* player = Unit::GetPlayer(*me, (*itr).first))
- player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second);
+ player->SetObjectScale((*itr).second);
}
chained.clear();
}
@@ -512,7 +516,7 @@ public:
DoCast(target, SPELL_CHAINS_OF_KELTHUZAD);
float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X);
chained.insert(std::make_pair(target->GetGUID(), scale));
- target->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2);
+ target->SetObjectScale(scale * 2);
events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm
}
}
@@ -530,7 +534,7 @@ public:
{
if (!player->isCharmed())
{
- player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second);
+ player->SetObjectScale((*itr).second);
std::map<uint64, float>::iterator next = itr;
++next;
chained.erase(itr);
@@ -773,6 +777,46 @@ class npc_kelthuzad_abomination : public CreatureScript
}
};
+class spell_kelthuzad_detonate_mana : public SpellScriptLoader
+{
+ public:
+ spell_kelthuzad_detonate_mana() : SpellScriptLoader("spell_kelthuzad_detonate_mana") { }
+
+ class spell_kelthuzad_detonate_mana_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_kelthuzad_detonate_mana_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MANA_DETONATION_DAMAGE))
+ return false;
+ return true;
+ }
+
+ void HandleScript(AuraEffect const* aurEff)
+ {
+ PreventDefaultAction();
+
+ Unit* target = GetTarget();
+ if (int32 mana = int32(target->GetMaxPower(POWER_MANA) / 10))
+ {
+ mana = target->ModifyPower(POWER_MANA, -mana);
+ target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, NULL, aurEff);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_AuraScript::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_kelthuzad_detonate_mana_AuraScript();
+ }
+};
+
class achievement_just_cant_get_enough : public AchievementCriteriaScript
{
public:
@@ -796,5 +840,6 @@ void AddSC_boss_kelthuzad()
new boss_kelthuzad();
new at_kelthuzad_center();
new npc_kelthuzad_abomination();
+ new spell_kelthuzad_detonate_mana();
new achievement_just_cant_get_enough();
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
index 58d3a4240b2..71623cb1959 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "naxxramas.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 3c258f08030..8ec9bac7e86 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#include "naxxramas.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
index 75be596fd77..d106b99ace0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
#define SAY_AGGRO RAND(-1533075, -1533076, -1533077)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index b826a530719..b1b57836a89 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
index e06aa6b03c5..d733cac001c 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
//Razuvious - NO TEXT sound only
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index 37fb5f3f4a9..a2acf8a64da 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
#define EMOTE_BREATH -1533082
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index ccc8e9a5663..e45700ebd72 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -456,10 +456,10 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
- void HandleTargets(std::list<Unit*>& targetList)
+ void HandleTargets(std::list<WorldObject*>& targets)
{
uint8 count = 0;
- for (std::list<Unit*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
+ for (std::list<WorldObject*>::iterator ihit = targets.begin(); ihit != targets.end(); ++ihit)
if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
if (Player* target = (*ihit)->ToPlayer())
if (target->HasAura(GetTriggeringSpell()->Id))
@@ -498,7 +498,7 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
index 50eb52cc4c2..e806b60c848 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "naxxramas.h"
const DoorData doorData[] =
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index ac5520b025a..9f5eb8d879a 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -27,7 +27,11 @@ Script Data End */
// Remove hack that re-adds targets to the aggro list after they enter to a vehicle when it works as expected
// Improve whatever can be improved :)
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "PassiveAI.h"
#include "eye_of_eternity.h"
#include "ScriptedEscortAI.h"
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index fcb54985357..f6a12eee519 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "eye_of_eternity.h"
class instance_eye_of_eternity : public InstanceMapScript
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index 7552ba4f389..5e6dcbcd66e 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "nexus.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
index 5c1dee1d4e4..9e6930118f7 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
@@ -16,7 +16,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "nexus.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
index ad188738c12..9602d1bc876 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "nexus.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
index c70db7d4ebc..9f9223f0161 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "nexus.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp
index 5ea3eb32c1d..5463f6c9045 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp
@@ -23,7 +23,8 @@ SDComment: Only Alliance Heroic
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_BATTLE_SHOUT 31403
#define SPELL_CHARGE 60067
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp
index da4b49740c1..38808bc718d 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp
@@ -23,7 +23,8 @@ SDComment: Only Horde Heroic
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_BATTLE_SHOUT 31403
#define SPELL_CHARGE 60067
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index 5af982bb694..5d430ae048d 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "nexus.h"
#define NUMBER_OF_ENCOUNTERS 4
@@ -57,6 +58,9 @@ public:
Anomalus = 0;
Keristrasza = 0;
+ AnomalusContainmentSphere = 0;
+ OrmoroksContainmentSphere = 0;
+ TelestrasContainmentSphere = 0;
}
void OnCreatureCreate(Creature* creature)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
index bb75b789fff..035e1a9a6df 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "oculus.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index ab814a2ca22..708ed600933 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "oculus.h"
//Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index b96d7c4aa84..791bc0180e5 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -22,7 +22,8 @@ SDComment: Is not working SPELL_ARCANE_SHIELD. SPELL_FROSTBOMB has some issues,
SDCategory: Instance Script
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "oculus.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index 19a84fdae84..6d9450daf21 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "oculus.h"
#include "MapManager.h"
@@ -297,7 +300,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
{
PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript)
- void FilterTargets(std::list<Unit*>& targetList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
Creature* varos = GetCaster()->ToCreature();
if (!varos)
@@ -308,7 +311,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
- for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
+ for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
Position pos;
(*itr)->GetPosition(&pos);
@@ -317,7 +320,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
float diff = fabs(orientation - angle);
if (diff > 1.0f)
- itr = targetList.erase(itr);
+ itr = targets.erase(itr);
else
++itr;
}
@@ -325,7 +328,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_varos_energize_core_area_enemySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_varos_energize_core_area_enemySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -344,7 +347,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
{
PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript)
- void FilterTargets(std::list<Unit*>& targetList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
Creature* varos = GetCaster()->ToCreature();
if (!varos)
@@ -355,7 +358,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
- for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
+ for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
Position pos;
(*itr)->GetPosition(&pos);
@@ -364,7 +367,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
float diff = fabs(orientation - angle);
if (diff > 1.0f)
- itr = targetList.erase(itr);
+ itr = targets.erase(itr);
else
++itr;
}
@@ -372,7 +375,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_varos_energize_core_area_entrySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_varos_energize_core_area_entrySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index 46498a69c6f..ca4ae883747 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "oculus.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
index 23f55a3033b..1d8b5b986f6 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
@@ -15,7 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "oculus.h"
#define GOSSIP_ITEM_DRAKES "So where do we go from here?"
@@ -47,7 +51,9 @@ enum Drakes
NPC_VERDISA = 27657,
NPC_BELGARISTRASZ = 27658,
- NPC_ETERNOS = 27659
+ NPC_ETERNOS = 27659,
+
+ SPELL_SHOCK_CHARGE = 49836,
};
enum Says
@@ -210,8 +216,40 @@ public:
}
};
+class spell_gen_stop_time : public SpellScriptLoader
+{
+public:
+ spell_gen_stop_time() : SpellScriptLoader("spell_gen_stop_time") { }
+
+ class spell_gen_stop_time_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_stop_time_AuraScript);
+
+ void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster)
+ return;
+ Unit* target = GetTarget();
+ for (uint32 i = 0; i < 5; ++i)
+ caster->CastSpell(target, SPELL_SHOCK_CHARGE, false);
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_stop_time_AuraScript();
+ }
+};
+
void AddSC_oculus()
{
new npc_oculus_drake();
new npc_image_belgaristrasz();
+ new spell_gen_stop_time();
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 9f39cecbb23..72ab5259693 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -23,7 +23,8 @@ SDComment: Waypoint needed, we expect boss to always have 2x Stormforged Lieuten
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
enum eEnums
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index abdf5ecb1e1..d964f619a6e 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -20,7 +20,8 @@
* Comment: Timer check pending
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
index 2e2744baa3c..f42fd87c643 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
@@ -19,11 +19,13 @@
/* ScriptData
SDName: Boss Loken
SD%Complete: 60%
-SDComment: Missing intro. Remove hack of Pulsing Shockwave when core supports. Aura is not working (59414)
+SDComment: Missing intro.
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "halls_of_lightning.h"
enum eEnums
@@ -73,23 +75,17 @@ public:
InstanceScript* instance;
- bool m_bIsAura;
-
uint32 m_uiArcLightning_Timer;
uint32 m_uiLightningNova_Timer;
- uint32 m_uiPulsingShockwave_Timer;
uint32 m_uiResumePulsingShockwave_Timer;
uint32 m_uiHealthAmountModifier;
void Reset()
{
- m_bIsAura = false;
-
m_uiArcLightning_Timer = 15000;
m_uiLightningNova_Timer = 20000;
- m_uiPulsingShockwave_Timer = 2000;
- m_uiResumePulsingShockwave_Timer = 15000;
+ m_uiResumePulsingShockwave_Timer = 1000;
m_uiHealthAmountModifier = 1;
@@ -116,7 +112,10 @@ public:
Talk(SAY_DEATH);
if (instance)
+ {
instance->SetData(TYPE_LOKEN, DONE);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA);
+ }
}
void KilledUnit(Unit* /*victim*/)
@@ -130,44 +129,13 @@ public:
if (!UpdateVictim())
return;
- if (m_bIsAura)
- {
- // workaround for PULSING_SHOCKWAVE
- if (m_uiPulsingShockwave_Timer <= uiDiff)
- {
- Map* map = me->GetMap();
- if (map->IsDungeon())
- {
- Map::PlayerList const &PlayerList = map->GetPlayers();
-
- if (PlayerList.isEmpty())
- return;
-
- for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
- if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack())
- {
- int32 dmg;
- float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ());
-
- dmg = DUNGEON_MODE(100, 150); // need to correct damage
- if (m_fDist > 1.0f) // Further from 1 yard
- dmg = int32(dmg*m_fDist);
-
- me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false);
- }
- }
- m_uiPulsingShockwave_Timer = 2000;
- } else m_uiPulsingShockwave_Timer -= uiDiff;
- }
- else
+ if (m_uiResumePulsingShockwave_Timer)
{
if (m_uiResumePulsingShockwave_Timer <= uiDiff)
{
- //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement?
DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true);
- DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support
- m_bIsAura = true;
+ DoCast(me, SPELL_PULSING_SHOCKWAVE_N, true);
m_uiResumePulsingShockwave_Timer = 0;
}
else
@@ -190,7 +158,7 @@ public:
Talk(EMOTE_NOVA);
DoCast(me, SPELL_LIGHTNING_NOVA_N);
- m_bIsAura = false;
+ me->RemoveAurasDueToSpell(DUNGEON_MODE<uint32>(SPELL_PULSING_SHOCKWAVE_N, SPELL_PULSING_SHOCKWAVE_H));
m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura
m_uiLightningNova_Timer = urand(20000, 21000);
}
@@ -216,7 +184,39 @@ public:
};
+class spell_loken_pulsing_shockwave : public SpellScriptLoader
+{
+ public:
+ spell_loken_pulsing_shockwave() : SpellScriptLoader("spell_loken_pulsing_shockwave") { }
+
+ class spell_loken_pulsing_shockwave_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_loken_pulsing_shockwave_SpellScript);
+
+ void CalculateDamage(SpellEffIndex /*effIndex*/)
+ {
+ if (!GetHitUnit())
+ return;
+
+ float distance = GetCaster()->GetDistance2d(GetHitUnit());
+ if (distance > 1.0f)
+ SetHitDamage(int32(GetHitDamage() * distance));
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_loken_pulsing_shockwave_SpellScript::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_loken_pulsing_shockwave_SpellScript();
+ }
+};
+
void AddSC_boss_loken()
{
new boss_loken();
+ new spell_loken_pulsing_shockwave();
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 5c7bf0d1c1e..fe41e7a12dc 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -23,7 +23,8 @@ SDComment: Event should be pretty close minus a few visual flaws
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
enum eEnums
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
index f25be6dae0d..93b246e9ddc 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
@@ -23,7 +23,8 @@ SDComment: All ready.
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "halls_of_lightning.h"
/* Halls of Lightning encounters:
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index bc57ce21a4d..93bea92503c 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "halls_of_stone.h"
enum Spells
@@ -157,17 +159,12 @@ public:
DoScriptText(SAY_KILL, me);
}
- void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
+ void SpellHitTarget(Unit* /*target*/, const SpellInfo* pSpell)
{
//this part should be in the core
if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER)
{
- //this spell must have custom handling in the core, dealing damage based on distance
- target->CastSpell(target, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true);
-
- if (target->HasAura(SPELL_STONED))
- target->RemoveAurasDueToSpell(SPELL_STONED);
-
+ // todo: we need eventmap to kill this stuff
//clear this, if we are still performing
if (bIsSlam)
{
@@ -186,7 +183,74 @@ public:
};
+class spell_krystallus_shatter : public SpellScriptLoader
+{
+ public:
+ spell_krystallus_shatter() : SpellScriptLoader("spell_krystallus_shatter") { }
+
+ class spell_krystallus_shatter_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_krystallus_shatter_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ target->RemoveAurasDueToSpell(SPELL_STONED);
+ target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_krystallus_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_krystallus_shatter_SpellScript();
+ }
+};
+
+class spell_krystallus_shatter_effect : public SpellScriptLoader
+{
+ public:
+ spell_krystallus_shatter_effect() : SpellScriptLoader("spell_krystallus_shatter_effect") { }
+
+ class spell_krystallus_shatter_effect_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_krystallus_shatter_effect_SpellScript);
+
+ void CalculateDamage()
+ {
+ if (!GetHitUnit())
+ return;
+
+ float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
+ if (!radius)
+ return;
+
+ float distance = GetCaster()->GetDistance2d(GetHitUnit());
+ if (distance > 1.0f)
+ SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_krystallus_shatter_effect_SpellScript::CalculateDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_krystallus_shatter_effect_SpellScript();
+ }
+};
+
void AddSC_boss_krystallus()
{
new boss_krystallus();
+ new spell_krystallus_shatter();
+ new spell_krystallus_shatter_effect();
}
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 65711643827..8d113bce226 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
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_stone.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
index c2a8e905950..28052a57576 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_stone.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
index a608de5fcf3..a90c346e470 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "halls_of_stone.h"
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
index ee5cb87dd85..869cf46e74d 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "halls_of_stone.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp
deleted file mode 100644
index 2dd13e7ce07..00000000000
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright (C) 2008-2012 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 "ScriptedCreature.h"
-#include "ulduar.h"
-
-#define GAMEOBJECT_GIVE_OF_THE_OBSERVER 194821
-
-enum Spells
-{
- SPELL_ASCEND = 64487,
- SPELL_BERSERK = 47008,
- SPELL_BIG_BANG = 64443,
- H_SPELL_BIG_BANG = 64584,
- SPELL_COSMIC_SMASH = 62301,
- H_SPELL_COSMIC_SMASH = 64598,
- SPELL_PHASE_PUNCH = 64412,
- SPELL_QUANTUM_STRIKE = 64395,
- H_SPELL_QUANTUM_STRIKE = 64592,
- SPELL_BLACK_HOLE_EXPLOSION = 64122,
- SPELL_ARCANE_BARAGE = 64599,
- H_SPELL_ARCANE_BARAGE = 64607
-};
-
-enum Creatures
-{
- CREATURE_COLLAPSING_STAR = 32955,
- CREATURE_BLACK_HOLE = 32953,
- CREATURE_LIVING_CONSTELLATION = 33052,
- CREATURE_DARK_MATTER = 33089
-};
-
-enum Yells
-{
- SAY_AGGRO = -1603000,
- SAY_SLAY_1 = -1603001,
- SAY_SLAY_2 = -1603002,
- SAY_ENGADED_FOR_FIRTS_TIME = -1603003,
- SAY_PHASE_2 = -1603004,
- SAY_SUMMON_COLLAPSING_STAR = -1603005,
- SAY_DEATH_1 = -1603006,
- SAY_DEATH_2 = -1603007,
- SAY_DEATH_3 = -1603008,
- SAY_DEATH_4 = -1603009,
- SAY_DEATH_5 = -1603010,
- SAY_BERSERK = -1603011,
- SAY_BIG_BANG_1 = -1603012,
- SAY_BIG_BANG_2 = -1603013,
- SAY_TIMER_1 = -1603014,
- SAY_TIMER_2 = -1603015,
- SAY_TIMER_3 = -1603016,
- SAY_SUMMON_1 = -1603017,
- SAY_SUMMON_2 = -1603018,
- SAY_SUMMON_3 = -1603019,
-};
-
-class boss_algalon : public CreatureScript
-{
-public:
- boss_algalon() : CreatureScript("boss_algalon") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return GetUlduarAI<boss_algalonAI>(creature);
- }
-
- struct boss_algalonAI : public ScriptedAI
- {
- boss_algalonAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- Summon = false; // not in reset. intro speech done only once.
- }
-
- InstanceScript* instance;
-
- std::list<uint64> m_lCollapsingStarGUIDList;
-
- uint32 Phase;
- uint32 Ascend_Timer;
- uint32 Berserk_Timer;
- uint32 BigBang_Timer;
- uint32 CosmicSmash_Timer;
- uint32 PhasePunch_Timer;
- uint32 QuantumStrike_Timer;
- uint32 CollapsingStar_Timer;
- uint32 uiPhase_timer;
- uint32 uiStep;
-
- uint64 BlackHoleGUID;
-
- bool Enrage;
- bool Summon;
-
- void EnterCombat(Unit* who)
- {
- if (Summon)
- {
- DoScriptText(SAY_AGGRO, me);
- me->InterruptSpell(CURRENT_CHANNELED_SPELL);
- DoZoneInCombat(who->ToCreature());
- }
- else
- {
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->SetReactState(REACT_PASSIVE);
- uiStep = 1;
- }
-
- if (instance)
- instance->SetData(BOSS_ALGALON, IN_PROGRESS);
- }
-
- void KilledUnit(Unit* /*victim*/)
- {
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
- }
-
- void Reset()
- {
- Phase = 1;
-
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (instance)
- instance->SetData(BOSS_ALGALON, NOT_STARTED);
-
- BlackHoleGUID = 0;
-
- uiPhase_timer = 0;
- Ascend_Timer = 480000; //8 minutes
- QuantumStrike_Timer = urand(4000, 14000);
- Berserk_Timer = 360000; //6 minutes
- CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds
- BigBang_Timer = 90000;
- PhasePunch_Timer = 8000;
- CosmicSmash_Timer = urand(30000, 60000);
- Enrage = false;
- }
-
- void JumpToNextStep(uint32 uiTimer)
- {
- uiPhase_timer = uiTimer;
- ++uiStep;
- }
-
- void DespawnCollapsingStar()
- {
- if (m_lCollapsingStarGUIDList.empty())
- return;
-
- for (std::list<uint64>::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr)
- {
- if (Creature* temp = Unit::GetCreature(*me, *itr))
- {
- if (temp->isAlive())
- temp->DespawnOrUnsummon();
- }
- }
- m_lCollapsingStarGUIDList.clear();
- }
-
- void JustSummoned(Creature* summoned)
- {
- if (summoned->GetEntry() == CREATURE_COLLAPSING_STAR)
- {
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (me->getVictim())
- summoned->AI()->AttackStart(target ? target : me->getVictim());
- m_lCollapsingStarGUIDList.push_back(summoned->GetGUID());
- }
- }
-
- void SummonCollapsingStar(Unit* target)
- {
- DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me);
- me->SummonCreature(CREATURE_COLLAPSING_STAR, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100000);
- me->SummonCreature(CREATURE_BLACK_HOLE, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 27000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- if (Phase == 1 && HealthBelowPct(20))
- {
- Phase = 2;
- DoScriptText(SAY_PHASE_2, me);
- }
-
- if (HealthBelowPct(2))
- {
- me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667f, -295.101166f, 417.321381f, 0, 0, 0, 0, 0, 0);
-
- // All of them. or random?
- DoScriptText(SAY_DEATH_1, me);
- DoScriptText(SAY_DEATH_2, me);
- DoScriptText(SAY_DEATH_3, me);
- DoScriptText(SAY_DEATH_4, me);
- DoScriptText(SAY_DEATH_5, me);
-
- me->DisappearAndDie();
-
- if (instance)
- instance->SetData(BOSS_ALGALON, DONE);
-
- return;
- }
-
- if (Phase == 1)
- {
- if (!Summon)
- {
- if (uiPhase_timer <= diff)
- {
- switch (uiStep)
- {
- case 1:
- DoScriptText(SAY_SUMMON_1, me);
- JumpToNextStep(3000);
- break;
- case 2:
- DoScriptText(SAY_SUMMON_2, me);
- JumpToNextStep(3000);
- break;
- case 3:
- DoScriptText(SAY_SUMMON_3, me);
- JumpToNextStep(3000);
- break;
- case 4:
- DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me);
- JumpToNextStep(3000);
- break;
- case 5:
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->SetReactState(REACT_AGGRESSIVE);
- Summon = true;
- break;
- }
- } else uiPhase_timer -= diff;
-
- return;
- }
-
- if (QuantumStrike_Timer <= diff)
- {
- DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE, H_SPELL_QUANTUM_STRIKE), true);
-
- QuantumStrike_Timer = urand(4000, 14000);
- } else QuantumStrike_Timer -= diff;
-
- if (BigBang_Timer <= diff)
- {
- DoScriptText(RAND(SAY_BIG_BANG_1, SAY_BIG_BANG_2), me);
- DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG, H_SPELL_BIG_BANG), true);
-
- BigBang_Timer = 90000;
- } else BigBang_Timer -= diff;
-
- if (Ascend_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_ASCEND, true);
-
- Ascend_Timer = 480000;
- } else Ascend_Timer -= diff;
-
- if (PhasePunch_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_PHASE_PUNCH, true);
-
- PhasePunch_Timer = 8000;
- } else PhasePunch_Timer -= diff;
-
- if (CosmicSmash_Timer <= diff)
- {
- DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH, H_SPELL_COSMIC_SMASH), true);
-
- CosmicSmash_Timer = urand(30000, 60000);
- } else CosmicSmash_Timer -= diff;
-
- if (Berserk_Timer <= diff)
- {
- DoScriptText(SAY_BERSERK, me);
- DoCast(me->getVictim(), SPELL_BERSERK, true);
-
- Berserk_Timer = 360000;
- } else Berserk_Timer -= diff;
-
- DoMeleeAttackIfReady();
-
- EnterEvadeIfOutOfCombatArea(diff);
- }
-
- if (Phase == 2)
- {
- if (Enrage)
- {
- if (Ascend_Timer <= diff)
- {
- DoCast(me, SPELL_ASCEND);
- DoScriptText(SAY_BERSERK, me);
- Ascend_Timer = urand(360000, 365000);
- Enrage = false;
- } else Ascend_Timer -= diff;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
-};
-
-//Collapsing Star
-class mob_collapsing_star : public CreatureScript
-{
-public:
- mob_collapsing_star() : CreatureScript("mob_collapsing_star") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_collapsing_starAI(creature);
- }
-
- struct mob_collapsing_starAI : public ScriptedAI
- {
- mob_collapsing_starAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- }
-
- InstanceScript* instance;
-
- uint32 BlackHoleExplosion_Timer;
-
- void Reset()
- {
- BlackHoleExplosion_Timer = 0;
- }
-
- void UpdateAI(const uint32 diff)
- {
- if (!UpdateVictim())
- return;
-
- if (BlackHoleExplosion_Timer <= diff)
- {
- me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false);
- BlackHoleExplosion_Timer = 0;
- } else BlackHoleExplosion_Timer -= diff;
- }
- };
-
-};
-
-void AddSC_boss_Algalon()
-{
- new boss_algalon();
- new mob_collapsing_star();
-}
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
new file mode 100644
index 00000000000..7ee67060f97
--- /dev/null
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -0,0 +1,1374 @@
+/*
+ * Copyright (C) 2008-2012 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 "ObjectMgr.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "PassiveAI.h"
+#include "GameObjectAI.h"
+#include "MapManager.h"
+#include "MoveSplineInit.h"
+#include "ulduar.h"
+
+enum Texts
+{
+ SAY_BRANN_ALGALON_INTRO_1 = 0,
+ SAY_BRANN_ALGALON_INTRO_2 = 1,
+ SAY_BRANN_ALGALON_OUTRO = 2,
+
+ SAY_ALGALON_INTRO_1 = 0,
+ SAY_ALGALON_INTRO_2 = 1,
+ SAY_ALGALON_INTRO_3 = 2,
+ SAY_ALGALON_START_TIMER = 3,
+ SAY_ALGALON_AGGRO = 4,
+ SAY_ALGALON_COLLAPSING_STAR = 5,
+ EMOTE_ALGALON_COLLAPSING_STAR = 6,
+ SAY_ALGALON_BIG_BANG = 7,
+ EMOTE_ALGALON_BIG_BANG = 8,
+ SAY_ALGALON_ASCEND = 9,
+ EMOTE_ALGALON_COSMIC_SMASH = 10,
+ SAY_ALGALON_PHASE_TWO = 11,
+ SAY_ALGALON_OUTRO_1 = 12,
+ SAY_ALGALON_OUTRO_2 = 13,
+ SAY_ALGALON_OUTRO_3 = 14,
+ SAY_ALGALON_OUTRO_4 = 15,
+ SAY_ALGALON_OUTRO_5 = 16,
+ SAY_ALGALON_DESPAWN_1 = 17,
+ SAY_ALGALON_DESPAWN_2 = 18,
+ SAY_ALGALON_DESPAWN_3 = 19,
+ SAY_ALGALON_KILL = 20,
+};
+
+enum Spells
+{
+ // Algalon the Observer
+ SPELL_ARRIVAL = 64997,
+ SPELL_RIDE_THE_LIGHTNING = 64986,
+ SPELL_SUMMON_AZEROTH = 64994,
+ SPELL_REORIGINATION = 64996,
+ SPELL_SUPERMASSIVE_FAIL = 65311,
+ SPELL_QUANTUM_STRIKE = 64395,
+ SPELL_PHASE_PUNCH = 64412,
+ SPELL_BIG_BANG = 64443,
+ SPELL_ASCEND_TO_THE_HEAVENS = 64487,
+ SPELL_COSMIC_SMASH = 62301,
+ SPELL_COSMIC_SMASH_TRIGGERED = 62304,
+ SPELL_COSMIC_SMASH_VISUAL_STATE = 62300,
+ SPELL_SELF_STUN = 65256,
+ SPELL_KILL_CREDIT = 65184,
+ SPELL_TELEPORT = 62940,
+
+ // Algalon Stalker
+ SPELL_TRIGGER_3_ADDS = 62266, // Triggers Living Constellation
+
+ // Living Constellation
+ SPELL_ARCANE_BARRAGE = 64599,
+
+ // Collapsing Star
+ SPELL_COLLAPSE = 62018,
+ SPELL_BLACK_HOLE_SPAWN_VISUAL = 62003,
+ SPELL_SUMMON_BLACK_HOLE = 62189,
+
+ // Black Hole
+ SPELL_BLACK_HOLE_TRIGGER = 62185,
+ SPELL_CONSTELLATION_PHASE_TRIGGER = 65508,
+ SPELL_CONSTELLATION_PHASE_EFFECT = 65509,
+ SPELL_BLACK_HOLE_EXPLOSION = 64122,
+ SPELL_SUMMON_VOID_ZONE_VISUAL = 64470,
+ SPELL_VOID_ZONE_VISUAL = 64469,
+ SPELL_BLACK_HOLE_CREDIT = 65312,
+
+ // Worm Hole
+ SPELL_WORM_HOLE_TRIGGER = 65251,
+ SPELL_SUMMON_UNLEASHED_DARK_MATTER = 64450,
+};
+
+uint32 const PhasePunchAlphaId[5] = {64435, 64434, 64428, 64421, 64417};
+
+enum Events
+{
+ // Celestial Planetarium Access
+ EVENT_DESPAWN_CONSOLE = 1,
+
+ // Brann Bronzebeard
+ EVENT_BRANN_MOVE_INTRO = 2,
+ EVENT_SUMMON_ALGALON = 3,
+ EVENT_BRANN_OUTRO_1 = 4,
+ EVENT_BRANN_OUTRO_2 = 5,
+
+ // Algalon the Observer
+ EVENT_INTRO_1 = 6,
+ EVENT_INTRO_2 = 7,
+ EVENT_INTRO_3 = 8,
+ EVENT_INTRO_FINISH = 9,
+ EVENT_START_COMBAT = 10,
+ EVENT_INTRO_TIMER_DONE = 11,
+ EVENT_QUANTUM_STRIKE = 12,
+ EVENT_PHASE_PUNCH = 13,
+ EVENT_SUMMON_COLLAPSING_STAR = 14,
+ EVENT_BIG_BANG = 15,
+ EVENT_RESUME_UPDATING = 16,
+ EVENT_ASCEND_TO_THE_HEAVENS = 17,
+ EVENT_EVADE = 18,
+ EVENT_COSMIC_SMASH = 19,
+ EVENT_UNLOCK_YELL = 20,
+ EVENT_OUTRO_START = 21,
+ EVENT_OUTRO_1 = 22,
+ EVENT_OUTRO_2 = 23,
+ EVENT_OUTRO_3 = 24,
+ EVENT_OUTRO_4 = 25,
+ EVENT_OUTRO_5 = 26,
+ EVENT_OUTRO_6 = 27,
+ EVENT_OUTRO_7 = 28,
+ EVENT_OUTRO_8 = 29,
+ EVENT_OUTRO_9 = 30,
+ EVENT_OUTRO_10 = 31,
+ EVENT_OUTRO_11 = 32,
+ EVENT_OUTRO_12 = 33,
+ EVENT_OUTRO_13 = 34,
+ EVENT_OUTRO_14 = 35,
+ EVENT_DESPAWN_ALGALON_1 = 36,
+ EVENT_DESPAWN_ALGALON_2 = 37,
+ EVENT_DESPAWN_ALGALON_3 = 38,
+
+ // Living Constellation
+ EVENT_ARCANE_BARRAGE = 39,
+};
+
+enum Actions
+{
+ ACTION_START_INTRO = 0,
+ ACTION_FINISH_INTRO = 1,
+ ACTION_ACTIVATE_STAR = 2,
+ ACTION_BIG_BANG = 3,
+ ACTION_ASCEND = 4,
+ ACTION_OUTRO = 5,
+};
+
+enum Points
+{
+ POINT_BRANN_INTRO = 0,
+ MAX_BRANN_WAYPOINTS_INTRO = 10,
+ POINT_BRANN_OUTRO = 10,
+ POINT_BRANN_OUTRO_END = 11,
+
+ POINT_ALGALON_LAND = 1,
+ POINT_ALGALON_OUTRO = 2,
+};
+
+enum EncounterPhases
+{
+ PHASE_NORMAL = 0,
+ PHASE_ROLE_PLAY = 1,
+ PHASE_BIG_BANG = 2,
+
+ PHASE_MASK_NO_UPDATE = (1 << PHASE_ROLE_PLAY) | (1 << PHASE_BIG_BANG),
+ PHASE_MASK_NO_CAST_CHECK = 1 << PHASE_ROLE_PLAY,
+};
+
+enum AchievmentInfo
+{
+ EVENT_ID_SUPERMASSIVE_START = 21697,
+ DATA_HAS_FED_ON_TEARS = 30043005,
+};
+
+
+Position const BrannIntroSpawnPos = {1676.277f, -162.5308f, 427.3326f, 3.235537f};
+Position const BrannIntroWaypoint[MAX_BRANN_WAYPOINTS_INTRO] =
+{
+ {1642.482f, -164.0812f, 427.2602f, 0.0f},
+ {1635.000f, -169.5145f, 427.2523f, 0.0f},
+ {1632.814f, -173.9334f, 427.2621f, 0.0f},
+ {1632.676f, -190.5927f, 425.8831f, 0.0f},
+ {1631.497f, -214.2221f, 418.1152f, 0.0f},
+ {1624.717f, -224.6876f, 418.1152f, 0.0f},
+ {1631.497f, -214.2221f, 418.1152f, 0.0f},
+ {1632.676f, -190.5927f, 425.8831f, 0.0f},
+ {1632.814f, -173.9334f, 427.2621f, 0.0f},
+ {1635.000f, -169.5145f, 427.2523f, 0.0f},
+};
+Position const AlgalonSummonPos = {1632.531f, -304.8516f, 450.1123f, 1.530165f};
+Position const AlgalonLandPos = {1632.668f, -302.7656f, 417.3211f, 1.530165f};
+
+#define LIVING_CONSTELLATION_COUNT 11
+Position const ConstellationPos[LIVING_CONSTELLATION_COUNT] =
+{
+ {1625.208f, -267.2771f, 446.4296f, 5.044002f},
+ {1658.279f, -262.5490f, 441.9073f, 4.188790f},
+ {1678.677f, -276.3280f, 427.7531f, 3.979351f},
+ {1593.389f, -299.4325f, 432.4636f, 6.073746f},
+ {1685.613f, -300.1219f, 443.2366f, 3.385939f},
+ {1591.706f, -263.8201f, 441.4153f, 5.253441f},
+ {1668.317f, -324.7676f, 457.9394f, 3.211406f},
+ {1592.242f, -325.5323f, 446.9508f, 0.226893f},
+ {1635.821f, -363.3442f, 424.3459f, 1.466077f},
+ {1672.188f, -357.2484f, 436.7337f, 2.338741f},
+ {1615.800f, -348.0065f, 442.9586f, 1.134464f},
+};
+
+#define COLLAPSING_STAR_COUNT 4
+Position const CollapsingStarPos[COLLAPSING_STAR_COUNT] =
+{
+ {1649.438f, -319.8127f, 418.3941f, 1.082104f},
+ {1647.005f, -288.6790f, 417.3955f, 3.490659f},
+ {1622.451f, -321.1563f, 417.6188f, 4.677482f},
+ {1615.060f, -291.6816f, 417.7796f, 3.490659f},
+};
+Position const AlgalonOutroPos = {1633.64f, -317.78f, 417.3211f, 0.0f};
+Position const BrannOutroPos[3] =
+{
+ {1632.023f, -243.7434f, 417.9118f, 0.0f},
+ {1631.986f, -297.7831f, 417.3210f, 0.0f},
+ {1633.832f, -216.2948f, 417.0463f, 0.0f},
+};
+
+class ActivateLivingConstellation : public BasicEvent
+{
+ public:
+ ActivateLivingConstellation(Unit* owner) : _owner(owner), _instance(owner->GetInstanceScript())
+ {
+ }
+
+ bool Execute(uint64 execTime, uint32 /*diff*/)
+ {
+ if (!_instance || _instance->GetBossState(BOSS_ALGALON) != IN_PROGRESS)
+ return true; // delete event
+
+ _owner->CastSpell((Unit*)NULL, SPELL_TRIGGER_3_ADDS, TRIGGERED_FULL_MASK);
+ _owner->m_Events.AddEvent(this, execTime + urand(45000, 50000));
+ return false;
+ }
+
+ private:
+ Unit* _owner;
+ InstanceScript* _instance;
+};
+
+class CosmicSmashDamageEvent : public BasicEvent
+{
+ public:
+ CosmicSmashDamageEvent(Unit* caster) : _caster(caster)
+ {
+ }
+
+ bool Execute(uint64 /*execTime*/, uint32 /*diff*/)
+ {
+ _caster->CastSpell((Unit*)NULL, SPELL_COSMIC_SMASH_TRIGGERED, TRIGGERED_FULL_MASK);
+ return true;
+ }
+
+ private:
+ Unit* _caster;
+};
+
+class SummonUnleashedDarkMatter : public BasicEvent
+{
+ public:
+ SummonUnleashedDarkMatter(Unit* caster) : _caster(caster)
+ {
+ }
+
+ bool Execute(uint64 execTime, uint32 /*diff*/)
+ {
+ _caster->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, TRIGGERED_FULL_MASK);
+ _caster->m_Events.AddEvent(this, execTime + 30000);
+ return false;
+ }
+
+ private:
+ Unit* _caster;
+};
+
+class boss_algalon_the_observer : public CreatureScript
+{
+ public:
+ boss_algalon_the_observer() : CreatureScript("boss_algalon_the_observer") {}
+
+ struct boss_algalon_the_observerAI : public BossAI
+ {
+ boss_algalon_the_observerAI(Creature* creature) : BossAI(creature, BOSS_ALGALON)
+ {
+ _firstPull = true;
+ _fedOnTears = false;
+ }
+
+ void Reset()
+ {
+ _Reset();
+ me->SetReactState(REACT_PASSIVE);
+ _phaseTwo = false;
+ _fightWon = false;
+ _hasYelled = false;
+ }
+
+ void KilledUnit(Unit* victim)
+ {
+ if (victim->GetTypeId() == TYPEID_UNIT)
+ {
+ _fedOnTears = true;
+ if (!_hasYelled)
+ {
+ _hasYelled = true;
+ events.ScheduleEvent(EVENT_UNLOCK_YELL, 1000);
+ Talk(SAY_ALGALON_KILL);
+ }
+ }
+ }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_START_INTRO:
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS_2, 0x20);
+ me->SetDisableGravity(true);
+ DoCast(me, SPELL_ARRIVAL, true);
+ DoCast(me, SPELL_RIDE_THE_LIGHTNING, true);
+ me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos);
+ me->SetHomePosition(AlgalonLandPos);
+ Movement::MoveSplineInit init(*me);
+ init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ());
+ init.SetOrientationFixed(true);
+ init.Launch();
+ events.Reset();
+ events.SetPhase(PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_1, 5000, 0, PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_2, 15000, 0, PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_3, 23000, 0, PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_FINISH, 36000, 0, PHASE_ROLE_PLAY);
+ break;
+ }
+ case ACTION_ASCEND:
+ events.SetPhase(PHASE_BIG_BANG);
+ events.CancelEvent(EVENT_RESUME_UPDATING);
+ events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1500);
+ break;
+ case EVENT_DESPAWN_ALGALON:
+ events.Reset();
+ events.SetPhase(PHASE_ROLE_PLAY);
+ if (me->isInCombat())
+ events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1);
+ events.ScheduleEvent(EVENT_DESPAWN_ALGALON_1, 5000);
+ events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000);
+ events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000);
+ me->DespawnOrUnsummon(34000);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
+ break;
+ case ACTION_INIT_ALGALON:
+ _firstPull = false;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ break;;
+ }
+ }
+
+ uint32 GetData(uint32 type)
+ {
+ return type == DATA_HAS_FED_ON_TEARS ? _fedOnTears : 1;
+ }
+
+ void EnterCombat(Unit* /*target*/)
+ {
+ uint32 introDelay = 0;
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
+ events.Reset();
+ events.SetPhase(PHASE_ROLE_PLAY);
+
+ if (!_firstPull)
+ {
+ Talk(SAY_ALGALON_AGGRO);
+ _EnterCombat();
+ introDelay = 8000;
+ }
+ else
+ {
+ _firstPull = false;
+ Talk(SAY_ALGALON_START_TIMER);
+ if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_BRONZEBEARD_ALG)))
+ brann->AI()->DoAction(ACTION_FINISH_INTRO);
+
+ me->setActive(true);
+ DoZoneInCombat();
+ introDelay = 26000;
+ summons.DespawnEntry(NPC_AZEROTH);
+ instance->SetData(EVENT_DESPAWN_ALGALON, 0);
+ events.ScheduleEvent(EVENT_START_COMBAT, 18000);
+ }
+
+ events.ScheduleEvent(EVENT_INTRO_TIMER_DONE, introDelay);
+ events.ScheduleEvent(EVENT_QUANTUM_STRIKE, 3500 + introDelay);
+ events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500 + introDelay);
+ events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 18000 + introDelay);
+ events.ScheduleEvent(EVENT_BIG_BANG, 90000 + introDelay);
+ events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 360000 + introDelay);
+ events.ScheduleEvent(EVENT_COSMIC_SMASH, 25000 + introDelay);
+
+ std::list<Creature*> stalkers;
+ me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f);
+ for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
+ (*itr)->m_Events.KillAllEvents(true);
+ }
+
+ void MovementInform(uint32 movementType, uint32 pointId)
+ {
+ if (movementType != POINT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ALGALON_LAND)
+ me->SetDisableGravity(false);
+ else if (pointId == POINT_ALGALON_OUTRO)
+ {
+ me->SetFacingTo(1.605703f);
+ events.ScheduleEvent(EVENT_OUTRO_3, 1200);
+ events.ScheduleEvent(EVENT_OUTRO_4, 2400);
+ events.ScheduleEvent(EVENT_OUTRO_5, 8500);
+ events.ScheduleEvent(EVENT_OUTRO_6, 15500);
+ events.ScheduleEvent(EVENT_OUTRO_7, 55500);
+ events.ScheduleEvent(EVENT_OUTRO_8, 73500);
+ events.ScheduleEvent(EVENT_OUTRO_9, 85500);
+ events.ScheduleEvent(EVENT_OUTRO_10, 108500);
+ events.ScheduleEvent(EVENT_OUTRO_11, 123500);
+ }
+ }
+
+ void JustSummoned(Creature* summon)
+ {
+ summons.Summon(summon);
+ switch (summon->GetEntry())
+ {
+ case NPC_AZEROTH:
+ DoCastAOE(SPELL_REORIGINATION, true);
+ break;
+ case NPC_COLLAPSING_STAR:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->GetMotionMaster()->MoveRandom(20.0f);
+ summon->CastSpell(summon, SPELL_COLLAPSE, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_BLACK_HOLE:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell(summon, SPELL_CONSTELLATION_PHASE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_EXPLOSION);
+ summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER:
+ summon->CastSpell(summon, SPELL_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_01:
+ summon->CastSpell(summon, SPELL_COSMIC_SMASH_VISUAL_STATE, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_02:
+ summon->m_Events.AddEvent(new CosmicSmashDamageEvent(summon), summon->m_Events.CalculateTime(3250));
+ break;
+ case NPC_WORM_HOLE:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->CastSpell(summon, SPELL_WORM_HOLE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_UNLEASHED_DARK_MATTER:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ if (summon->Attack(target, true))
+ summon->GetMotionMaster()->MoveChase(target);
+ break;
+ }
+ }
+
+ void EnterEvadeMode()
+ {
+ instance->SetBossState(BOSS_ALGALON, FAIL);
+ BossAI::EnterEvadeMode();
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetSheath(SHEATH_STATE_UNARMED);
+ }
+
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (_fightWon)
+ {
+ damage = 0;
+ return;
+ }
+
+ if (!_phaseTwo && me->HealthBelowPctDamaged(20, damage))
+ {
+ _phaseTwo = true;
+ Talk(SAY_ALGALON_PHASE_TWO);
+ summons.DespawnEntry(NPC_LIVING_CONSTELLATION);
+ summons.DespawnEntry(NPC_COLLAPSING_STAR);
+ summons.DespawnEntry(NPC_BLACK_HOLE);
+ summons.DespawnEntry(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER);
+ events.CancelEvent(EVENT_SUMMON_COLLAPSING_STAR);
+ std::list<Creature*> stalkers;
+ me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f);
+ for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
+ (*itr)->m_Events.KillAllEvents(true);
+ for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i)
+ if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN))
+ wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000));
+ }
+ else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
+ {
+ _fightWon = true;
+ damage = 0;
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
+ me->setFaction(35);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_SELF_STUN);
+ events.Reset();
+ summons.DespawnAll();
+ events.SetPhase(PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_OUTRO_START, 1500);
+ events.ScheduleEvent(EVENT_OUTRO_1, 7200);
+ events.ScheduleEvent(EVENT_OUTRO_2, 8700);
+ }
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if ((!(events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) || !CheckInRoom())
+ return;
+
+ events.Update(diff);
+
+ if (!(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK))
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_INTRO_1:
+ me->RemoveAurasDueToSpell(SPELL_RIDE_THE_LIGHTNING);
+ Talk(SAY_ALGALON_INTRO_1);
+ break;
+ case EVENT_INTRO_2:
+ DoCastAOE(SPELL_SUMMON_AZEROTH, true);
+ Talk(SAY_ALGALON_INTRO_2);
+ break;
+ case EVENT_INTRO_3:
+ Talk(SAY_ALGALON_INTRO_3);
+ break;
+ case EVENT_INTRO_FINISH:
+ events.Reset();
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ break;
+ case EVENT_START_COMBAT:
+ instance->SetBossState(BOSS_ALGALON, IN_PROGRESS);
+ break;
+ case EVENT_INTRO_TIMER_DONE:
+ {
+ events.SetPhase(PHASE_NORMAL);
+ me->SetSheath(SHEATH_STATE_MELEE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
+ me->SetReactState(REACT_DEFENSIVE);
+ DoCastAOE(SPELL_SUPERMASSIVE_FAIL, true);
+ //! Workaround for Creature::_IsTargetAcceptable returning false
+ //! for creatures that start combat in REACT_PASSIVE and UNIT_FLAG_NOT_SELECTABLE
+ //! causing them to immediately evade
+ if (!me->getThreatManager().isThreatListEmpty())
+ AttackStart(me->getThreatManager().getHostilTarget());
+ for (uint32 i = 0; i < LIVING_CONSTELLATION_COUNT; ++i)
+ if (Creature* summon = DoSummon(NPC_LIVING_CONSTELLATION, ConstellationPos[i], 0, TEMPSUMMON_DEAD_DESPAWN))
+ summon->SetReactState(REACT_PASSIVE);
+
+ std::list<Creature*> stalkers;
+ me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f);
+ if (!stalkers.empty())
+ {
+ Unit* stalker = Trinity::Containers::SelectRandomContainerElement(stalkers);
+ stalker->m_Events.AddEvent(new ActivateLivingConstellation(stalker), stalker->m_Events.CalculateTime(urand(45000, 50000)));
+ }
+ break;
+ }
+ case EVENT_QUANTUM_STRIKE:
+ DoCastVictim(SPELL_QUANTUM_STRIKE);
+ events.ScheduleEvent(EVENT_QUANTUM_STRIKE, urand(3000, 5000));
+ break;
+ case EVENT_PHASE_PUNCH:
+ DoCastVictim(SPELL_PHASE_PUNCH);
+ events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500);
+ break;
+ case EVENT_SUMMON_COLLAPSING_STAR:
+ Talk(SAY_ALGALON_COLLAPSING_STAR);
+ Talk(EMOTE_ALGALON_COLLAPSING_STAR);
+ for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i)
+ me->SummonCreature(NPC_COLLAPSING_STAR, CollapsingStarPos[i], TEMPSUMMON_CORPSE_DESPAWN);
+ events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 60000);
+ break;
+ case EVENT_BIG_BANG:
+ {
+ Talk(SAY_ALGALON_BIG_BANG);
+ Talk(EMOTE_ALGALON_BIG_BANG);
+ events.SetPhase(PHASE_BIG_BANG);
+ std::list<Creature*> constellations;
+ me->GetCreatureListWithEntryInGrid(constellations, NPC_LIVING_CONSTELLATION, 200.0f);
+ for (std::list<Creature*>::iterator itr = constellations.begin(); itr != constellations.end(); ++itr)
+ (*itr)->AI()->DoAction(ACTION_BIG_BANG);
+ DoCastAOE(SPELL_BIG_BANG);
+ events.ScheduleEvent(EVENT_BIG_BANG, 90500);
+ events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500);
+ break;
+ }
+ case EVENT_RESUME_UPDATING:
+ events.SetPhase(0);
+ break;
+ case EVENT_ASCEND_TO_THE_HEAVENS:
+ Talk(SAY_ALGALON_ASCEND);
+ DoCastAOE(SPELL_ASCEND_TO_THE_HEAVENS);
+ events.ScheduleEvent(EVENT_EVADE, 2500);
+ break;
+ case EVENT_EVADE:
+ EnterEvadeMode();
+ break;
+ case EVENT_COSMIC_SMASH:
+ Talk(EMOTE_ALGALON_COSMIC_SMASH);
+ DoCastAOE(SPELL_COSMIC_SMASH);
+ events.ScheduleEvent(EVENT_COSMIC_SMASH, 25500);
+ break;
+ case EVENT_UNLOCK_YELL:
+ _hasYelled = false;
+ break;
+ case EVENT_OUTRO_START:
+ instance->SetBossState(BOSS_ALGALON, DONE);
+ break;
+ case EVENT_OUTRO_1:
+ me->RemoveAllAuras();
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME);
+ break;
+ case EVENT_OUTRO_2:
+ _EnterEvadeMode();
+ me->AddUnitState(UNIT_STATE_EVADE);
+ me->GetMotionMaster()->MovePoint(POINT_ALGALON_OUTRO, AlgalonOutroPos);
+ break;
+ case EVENT_OUTRO_3:
+ DoCastAOE(SPELL_KILL_CREDIT);
+ break;
+ case EVENT_OUTRO_4:
+ DoCastAOE(SPELL_SUPERMASSIVE_FAIL);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ break;
+ case EVENT_OUTRO_5:
+ if (Creature* brann = DoSummon(NPC_BRANN_BRONZBEARD_ALG, BrannOutroPos[0], 131500, TEMPSUMMON_TIMED_DESPAWN))
+ brann->AI()->DoAction(ACTION_OUTRO);
+ break;
+ case EVENT_OUTRO_6:
+ Talk(SAY_ALGALON_OUTRO_1);
+ me->SetStandState(UNIT_STAND_STATE_KNEEL);
+ break;
+ case EVENT_OUTRO_7:
+ Talk(SAY_ALGALON_OUTRO_2);
+ break;
+ case EVENT_OUTRO_8:
+ Talk(SAY_ALGALON_OUTRO_3);
+ break;
+ case EVENT_OUTRO_9:
+ Talk(SAY_ALGALON_OUTRO_4);
+ break;
+ case EVENT_OUTRO_10:
+ Talk(SAY_ALGALON_OUTRO_5);
+ break;
+ case EVENT_OUTRO_11:
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ DoCast(me, SPELL_TELEPORT);
+ me->DespawnOrUnsummon(1500);
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ bool _firstPull;
+ bool _fedOnTears;
+ bool _phaseTwo;
+ bool _fightWon;
+ bool _hasYelled;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<boss_algalon_the_observerAI>(creature);
+ }
+};
+
+class npc_living_constellation : public CreatureScript
+{
+ public:
+ npc_living_constellation() : CreatureScript("npc_living_constellation") { }
+
+ struct npc_living_constellationAI : public CreatureAI
+ {
+ npc_living_constellationAI(Creature* creature) : CreatureAI(creature)
+ {
+ }
+
+ void Reset()
+ {
+ _events.Reset();
+ _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500);
+ _isActive = false;
+ }
+
+ uint32 GetData(uint32 /*type*/)
+ {
+ return _isActive ? 1 : 0;
+ }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_ACTIVATE_STAR:
+ if (Creature* algalon = me->FindNearestCreature(NPC_ALGALON, 200.0f))
+ {
+ if (Unit* target = algalon->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(algalon)))
+ {
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ AttackStart(target);
+ DoZoneInCombat();
+ _isActive = true;
+ }
+ }
+ break;
+ case ACTION_BIG_BANG:
+ _events.SetPhase(PHASE_BIG_BANG);
+ _events.DelayEvents(9500);
+ _events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500);
+ break;
+ }
+ }
+
+ void SpellHit(Unit* caster, SpellInfo const* spell)
+ {
+ if (spell->Id != SPELL_CONSTELLATION_PHASE_EFFECT || caster->GetTypeId() != TYPEID_UNIT)
+ return;
+
+ me->DespawnOrUnsummon(1);
+ if (InstanceScript* instance = me->GetInstanceScript())
+ instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_ID_SUPERMASSIVE_START);
+ caster->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK);
+ caster->ToCreature()->DespawnOrUnsummon(1);
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!(_events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_ARCANE_BARRAGE:
+ DoCastAOE(SPELL_ARCANE_BARRAGE);
+ _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500);
+ break;
+ case EVENT_RESUME_UPDATING:
+ _events.SetPhase(0);
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ bool _isActive;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<npc_living_constellationAI>(creature);
+ }
+};
+
+class npc_collapsing_star : public CreatureScript
+{
+ public:
+ npc_collapsing_star() : CreatureScript("npc_collapsing_star") { }
+
+ struct npc_collapsing_starAI : public PassiveAI
+ {
+ npc_collapsing_starAI(Creature* creature) : PassiveAI(creature)
+ {
+ _dying = false;
+ }
+
+ void JustSummoned(Creature* summon)
+ {
+ if (summon->GetEntry() != NPC_BLACK_HOLE)
+ return;
+
+ if (TempSummon* summ = me->ToTempSummon())
+ if (Creature* algalon = ObjectAccessor::GetCreature(*me, summ->GetSummonerGUID()))
+ algalon->AI()->JustSummoned(summon);
+
+ me->DespawnOrUnsummon(1);
+ }
+
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (_dying)
+ {
+ damage = 0;
+ return;
+ }
+
+ if (damage >= me->GetHealth())
+ {
+ _dying = true;
+ damage = 0;
+ DoCast(me, SPELL_BLACK_HOLE_SPAWN_VISUAL, true);
+ DoCast(me, SPELL_SUMMON_BLACK_HOLE, true);
+ }
+ }
+
+ bool _dying;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<npc_collapsing_starAI>(creature);
+ }
+};
+
+class npc_brann_bronzebeard_algalon : public CreatureScript
+{
+ public:
+ npc_brann_bronzebeard_algalon() : CreatureScript("npc_brann_bronzebeard_algalon") { }
+
+ struct npc_brann_bronzebeard_algalonAI : public CreatureAI
+ {
+ npc_brann_bronzebeard_algalonAI(Creature* creature) : CreatureAI(creature)
+ {
+ }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_START_INTRO:
+ _currentPoint = 0;
+ _events.Reset();
+ me->SetWalk(false);
+ _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
+ break;
+ case ACTION_FINISH_INTRO:
+ Talk(SAY_BRANN_ALGALON_INTRO_2);
+ _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
+ break;
+ case ACTION_OUTRO:
+ me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO, BrannOutroPos[1]);
+ _events.ScheduleEvent(EVENT_BRANN_OUTRO_1, 89500);
+ _events.ScheduleEvent(EVENT_BRANN_OUTRO_2, 116500);
+ break;
+ }
+ }
+
+ void MovementInform(uint32 movementType, uint32 pointId)
+ {
+ if (movementType != POINT_MOTION_TYPE)
+ return;
+
+ uint32 delay = 1;
+ _currentPoint = pointId + 1;
+ switch (pointId)
+ {
+ case 2:
+ delay = 8000;
+ me->SetWalk(true);
+ break;
+ case 5:
+ me->SetWalk(false);
+ Talk(SAY_BRANN_ALGALON_INTRO_1);
+ _events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500);
+ return;
+ case 9:
+ me->DespawnOrUnsummon(1);
+ return;
+ case POINT_BRANN_OUTRO:
+ case POINT_BRANN_OUTRO_END:
+ return;
+ }
+
+ _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay);
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ UpdateVictim();
+
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_BRANN_MOVE_INTRO:
+ if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO)
+ me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]);
+ break;
+ case EVENT_SUMMON_ALGALON:
+ if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos))
+ algalon->AI()->DoAction(ACTION_START_INTRO);
+ break;
+ case EVENT_BRANN_OUTRO_1:
+ Talk(SAY_BRANN_ALGALON_OUTRO);
+ break;
+ case EVENT_BRANN_OUTRO_2:
+ me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO_END, BrannOutroPos[2]);
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ uint32 _currentPoint;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<npc_brann_bronzebeard_algalonAI>(creature);
+ }
+};
+
+class go_celestial_planetarium_access : public GameObjectScript
+{
+ public:
+ go_celestial_planetarium_access() : GameObjectScript("go_celestial_planetarium_access") {}
+
+ struct go_celestial_planetarium_accessAI : public GameObjectAI
+ {
+ go_celestial_planetarium_accessAI(GameObject* go) : GameObjectAI(go)
+ {
+ }
+
+ bool GossipHello(Player* player)
+ {
+ bool hasKey = true;
+ if (LockEntry const* lock = sLockStore.LookupEntry(go->GetGOInfo()->goober.lockId))
+ {
+ hasKey = false;
+ for (uint32 i = 0; i < MAX_LOCK_CASE; ++i)
+ {
+ if (!lock->Index[i])
+ continue;
+
+ if (player->HasItemCount(lock->Index[i], 1))
+ {
+ hasKey = true;
+ break;
+ }
+ }
+ }
+
+ if (!hasKey)
+ return false;
+
+ // Start Algalon event
+ go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ _events.ScheduleEvent(EVENT_DESPAWN_CONSOLE, 5000);
+ if (Creature* brann = go->SummonCreature(NPC_BRANN_BRONZBEARD_ALG, BrannIntroSpawnPos))
+ brann->AI()->DoAction(ACTION_START_INTRO);
+
+ if (InstanceScript* instance = go->GetInstanceScript())
+ {
+ instance->SetData(DATA_ALGALON_SUMMON_STATE, 1);
+ if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_01)))
+ sigil->SetGoState(GO_STATE_ACTIVE);
+
+ if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_02)))
+ sigil->SetGoState(GO_STATE_ACTIVE);
+ }
+
+ return false;
+ }
+
+ void UpdateAI(uint32 diff)
+ {
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_DESPAWN_CONSOLE:
+ go->Delete();
+ break;
+ }
+ }
+ }
+
+ EventMap _events;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const
+ {
+ return GetUlduarAI<go_celestial_planetarium_accessAI>(go);
+ }
+};
+
+class spell_algalon_phase_punch : public SpellScriptLoader
+{
+ public:
+ spell_algalon_phase_punch() : SpellScriptLoader("spell_algalon_phase_punch") { }
+
+ class spell_algalon_phase_punch_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_algalon_phase_punch_AuraScript);
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ PreventDefaultAction();
+ if (GetStackAmount() != 1)
+ GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]);
+ GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK);
+ if (GetStackAmount() == 5)
+ Remove(AURA_REMOVE_BY_DEFAULT);
+ }
+
+ void OnRemove(AuraEffect const*, AuraEffectHandleModes)
+ {
+ if (GetStackAmount() != 5)
+ GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 1]);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_phase_punch_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ OnEffectRemove += AuraEffectRemoveFn(spell_algalon_phase_punch_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_algalon_phase_punch_AuraScript();
+ }
+};
+
+class NotVictimFilter
+{
+ public:
+ NotVictimFilter(Unit* caster) : _victim(caster->getVictim())
+ {
+ }
+
+ bool operator()(WorldObject* target)
+ {
+ return target != _victim;
+ }
+
+ private:
+ Unit* _victim;
+};
+
+class spell_algalon_arcane_barrage : public SpellScriptLoader
+{
+ public:
+ spell_algalon_arcane_barrage() : SpellScriptLoader("spell_algalon_arcane_barrage") { }
+
+ class spell_algalon_arcane_barrage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_arcane_barrage_SpellScript);
+
+ void SelectTarget(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(NotVictimFilter(GetCaster()));
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_arcane_barrage_SpellScript();
+ }
+};
+
+class ActiveConstellationFilter
+{
+ public:
+ bool operator()(WorldObject* target) const
+ {
+ return target->ToUnit() && target->ToUnit()->GetAI() && target->ToUnit()->GetAI()->GetData(0);
+ }
+};
+
+class spell_algalon_trigger_3_adds : public SpellScriptLoader
+{
+ public:
+ spell_algalon_trigger_3_adds() : SpellScriptLoader("spell_algalon_trigger_3_adds") { }
+
+ class spell_algalon_trigger_3_adds_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript);
+
+ void SelectTarget(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(ActiveConstellationFilter());
+ }
+
+ void HandleDummy(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ Creature* target = GetHitCreature();
+ if (!target)
+ return;
+
+ target->AI()->DoAction(ACTION_ACTIVATE_STAR);
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_trigger_3_adds_SpellScript();
+ }
+};
+
+class spell_algalon_collapse : public SpellScriptLoader
+{
+ public:
+ spell_algalon_collapse() : SpellScriptLoader("spell_algalon_collapse") { }
+
+ class spell_algalon_collapse_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_algalon_collapse_AuraScript);
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ PreventDefaultAction();
+ GetTarget()->DealDamage(GetTarget(), GetTarget()->CountPctFromMaxHealth(1), NULL, NODAMAGE);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_collapse_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_algalon_collapse_AuraScript();
+ }
+};
+
+class spell_algalon_big_bang : public SpellScriptLoader
+{
+ public:
+ spell_algalon_big_bang() : SpellScriptLoader("spell_algalon_big_bang") { }
+
+ class spell_algalon_big_bang_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_big_bang_SpellScript);
+
+ bool Load()
+ {
+ _targetCount = 0;
+ return true;
+ }
+
+ void CountTargets(std::list<WorldObject*>& targets)
+ {
+ _targetCount = targets.size();
+ }
+
+ void CheckTargets()
+ {
+ if (!_targetCount)
+ GetCaster()->GetAI()->DoAction(ACTION_ASCEND);
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets);
+ }
+
+ uint32 _targetCount;
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_big_bang_SpellScript();
+ }
+};
+
+class spell_algalon_remove_phase : public SpellScriptLoader
+{
+ public:
+ spell_algalon_remove_phase() : SpellScriptLoader("spell_algalon_remove_phase") { }
+
+ class spell_algalon_remove_phase_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_algalon_remove_phase_AuraScript);
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ PreventDefaultAction();
+ GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_remove_phase_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_algalon_remove_phase_AuraScript();
+ }
+};
+
+class spell_algalon_cosmic_smash : public SpellScriptLoader
+{
+ public:
+ spell_algalon_cosmic_smash() : SpellScriptLoader("spell_algalon_cosmic_smash") { }
+
+ class spell_algalon_cosmic_smash_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_cosmic_smash_SpellScript);
+
+ void ModDestHeight(SpellEffIndex /*effIndex*/)
+ {
+ Position offset = {0.0f, 0.0f, 65.0f, 0.0f};
+ const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
+ GetHitDest()->RelocateOffset(offset);
+ }
+
+ void Register()
+ {
+ OnEffectLaunch += SpellEffectFn(spell_algalon_cosmic_smash_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_cosmic_smash_SpellScript();
+ }
+};
+
+class spell_algalon_cosmic_smash_damage : public SpellScriptLoader
+{
+ public:
+ spell_algalon_cosmic_smash_damage() : SpellScriptLoader("spell_algalon_cosmic_smash_damage") { }
+
+ class spell_algalon_cosmic_smash_damage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_cosmic_smash_damage_SpellScript);
+
+ void RecalculateDamage()
+ {
+ if (!GetExplTargetDest() || !GetHitUnit())
+ return;
+
+ float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY());
+ if (distance > 6.0f)
+ SetHitDamage(int32(float(GetHitDamage()) / distance) * 2);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_algalon_cosmic_smash_damage_SpellScript::RecalculateDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_cosmic_smash_damage_SpellScript();
+ }
+};
+
+class spell_algalon_supermassive_fail : public SpellScriptLoader
+{
+ public:
+ spell_algalon_supermassive_fail() : SpellScriptLoader("spell_algalon_supermassive_fail") { }
+
+ class spell_algalon_supermassive_fail_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_supermassive_fail_SpellScript);
+
+ void RecalculateDamage()
+ {
+ if (!GetHitPlayer())
+ return;
+
+ GetHitPlayer()->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_algalon_supermassive_fail_SpellScript::RecalculateDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_supermassive_fail_SpellScript();
+ }
+};
+
+class achievement_he_feeds_on_your_tears : public AchievementCriteriaScript
+{
+ public:
+ achievement_he_feeds_on_your_tears() : AchievementCriteriaScript("achievement_he_feeds_on_your_tears") { }
+
+ bool OnCheck(Player* /*source*/, Unit* target)
+ {
+ return !target->GetAI()->GetData(DATA_HAS_FED_ON_TEARS);
+ }
+};
+
+void AddSC_boss_algalon_the_observer()
+{
+ new boss_algalon_the_observer();
+ new npc_living_constellation();
+ new npc_collapsing_star();
+ new npc_brann_bronzebeard_algalon();
+ new go_celestial_planetarium_access();
+ new spell_algalon_phase_punch();
+ new spell_algalon_arcane_barrage();
+ new spell_algalon_trigger_3_adds();
+ new spell_algalon_collapse();
+ new spell_algalon_big_bang();
+ new spell_algalon_remove_phase();
+ new spell_algalon_cosmic_smash();
+ new spell_algalon_cosmic_smash_damage();
+ new spell_algalon_supermassive_fail();
+ new achievement_he_feeds_on_your_tears();
+}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index 6c2c08f07a0..ec3125f7c0a 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
@@ -298,14 +298,14 @@ class npc_auriaya_seeping_trigger : public CreatureScript
void Reset()
{
- me->ForcedDespawn(600000);
+ me->DespawnOrUnsummon(600000);
DoCast(me, SPELL_SEEPING_ESSENCE);
}
void UpdateAI(uint32 const /*diff*/)
{
if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS)
- me->ForcedDespawn();
+ me->DespawnOrUnsummon();
}
private:
@@ -472,9 +472,9 @@ class npc_feral_defender : public CreatureScript
class SanctumSentryCheck
{
public:
- bool operator() (Unit* unit)
+ bool operator()(WorldObject* object) const
{
- if (unit->GetEntry() == NPC_SANCTUM_SENTRY)
+ if (object->GetEntry() == NPC_SANCTUM_SENTRY)
return false;
return true;
@@ -490,14 +490,14 @@ class spell_auriaya_strenght_of_the_pack : public SpellScriptLoader
{
PrepareSpellScript(spell_auriaya_strenght_of_the_pack_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (SanctumSentryCheck());
+ unitList.remove_if(SanctumSentryCheck());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_strenght_of_the_pack_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_strenght_of_the_pack_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -516,15 +516,15 @@ class spell_auriaya_sentinel_blast : public SpellScriptLoader
{
PrepareSpellScript(spell_auriaya_sentinel_blast_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (PlayerOrPetCheck());
+ unitList.remove_if(PlayerOrPetCheck());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index 33415cda157..9d5adf39817 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -720,20 +720,18 @@ class boss_flame_leviathan_overload_device : public CreatureScript
{
}
- void DoAction(const int32 param)
+ void OnSpellClick(Unit* /*clicker*/)
{
- if (param == EVENT_SPELLCLICK)
+ if (me->GetVehicle())
{
- if (me->GetVehicle())
+ me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+
+ if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER))
{
- me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER))
- {
- me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true);
- player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30);
- player->ExitVehicle();
- }
+ me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true);
+ player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30);
+ player->ExitVehicle();
}
}
}
@@ -1232,7 +1230,7 @@ public:
//bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
//{
// player->PlayerTalkClass->ClearMenus();
- // switch(action)
+ // switch (action)
// {
// case GOSSIP_ACTION_INFO_DEF+1:
// if (player)
@@ -1273,7 +1271,7 @@ class go_ulduar_tower : public GameObjectScript
public:
go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { }
- void OnDestroyed(GameObject* go, Player* /*player*/, uint32 /*value*/)
+ void OnDestroyed(GameObject* go, Player* /*player*/)
{
InstanceScript* instance = go->GetInstanceScript();
if (!instance)
@@ -1619,7 +1617,7 @@ class FlameLeviathanPursuedTargetSelector
public:
explicit FlameLeviathanPursuedTargetSelector(Unit* unit) : _me(unit) {};
- bool operator()(Unit* target) const
+ bool operator()(WorldObject* target) const
{
//! No players, only vehicles (todo: check if blizzlike)
Creature* creatureTarget = target->ToCreature();
@@ -1667,7 +1665,7 @@ class spell_pursue : public SpellScriptLoader
return true;
}
- void FilterTargets(std::list<Unit*>& targets)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(FlameLeviathanPursuedTargetSelector(GetCaster()));
if (targets.empty())
@@ -1683,7 +1681,7 @@ class spell_pursue : public SpellScriptLoader
}
}
- void FilterTargetsSubsequently(std::list<Unit*>& targets)
+ void FilterTargetsSubsequently(std::list<WorldObject*>& targets)
{
targets.clear();
if (_target)
@@ -1710,12 +1708,12 @@ class spell_pursue : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_pursue_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
- Unit* _target;
+ WorldObject* _target;
};
SpellScript* GetSpellScript() const
@@ -1743,7 +1741,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader
{
// use 99 because it is 3d search
std::list<WorldObject*> targetList;
- Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL);
+ Trinity::WorldObjectSpellAreaTargetCheck check(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check);
GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher);
float minDist = 99 * 99;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 4ea38a7642d..a3c9cb847e5 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -507,7 +507,7 @@ class boss_freya : public CreatureScript
for (uint8 n = 0; n < 3; ++n)
{
summons.remove(Elemental[n][i]->GetGUID());
- Elemental[n][i]->ForcedDespawn(5000);
+ Elemental[n][i]->DespawnOrUnsummon(5000);
trioDefeated[i] = true;
Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true);
}
@@ -664,12 +664,12 @@ class boss_freya : public CreatureScript
case NPC_DETONATING_LASHER:
summoned->CastSpell(me, SPELL_REMOVE_2STACK, true);
summoned->CastSpell(who, SPELL_DETONATE, true);
- summoned->ForcedDespawn(5000);
+ summoned->DespawnOrUnsummon(5000);
summons.remove(summoned->GetGUID());
break;
case NPC_ANCIENT_CONSERVATOR:
summoned->CastSpell(me, SPELL_REMOVE_25STACK, true);
- summoned->ForcedDespawn(5000);
+ summoned->DespawnOrUnsummon(5000);
summons.remove(summoned->GetGUID());
break;
}
@@ -1385,7 +1385,7 @@ class npc_healthy_spore : public CreatureScript
if (lifeTimer <= diff)
{
me->RemoveAurasDueToSpell(SPELL_GROW);
- me->ForcedDespawn(2200);
+ me->DespawnOrUnsummon(2200);
lifeTimer = urand(22000, 30000);
}
else
@@ -1423,7 +1423,7 @@ class npc_eonars_gift : public CreatureScript
{
me->RemoveAurasDueToSpell(SPELL_GROW);
DoCast(SPELL_LIFEBINDERS_GIFT);
- me->ForcedDespawn(2500);
+ me->DespawnOrUnsummon(2500);
lifeBindersGiftTimer = 12000;
}
else
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 3556bf188de..8090b9e8a3e 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -51,6 +51,8 @@ enum VezaxSpells
SPELL_SHADOW_CRASH_HIT = 62659,
SPELL_SURGE_OF_DARKNESS = 62662,
SPELL_SARONITE_VAPORS = 63323,
+ SPELL_SARONITE_VAPORS_ENERGIZE = 63337,
+ SPELL_SARONITE_VAPORS_DAMAGE = 63338,
SPELL_SUMMON_SARONITE_VAPORS = 63081,
SPELL_BERSERK = 26662,
@@ -463,6 +465,45 @@ class spell_mark_of_the_faceless : public SpellScriptLoader
}
};
+class spell_general_vezax_saronite_vapors : public SpellScriptLoader
+{
+ public:
+ spell_general_vezax_saronite_vapors() : SpellScriptLoader("spell_general_vezax_saronite_vapors") { }
+
+ class spell_general_vezax_saronite_vapors_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_general_vezax_saronite_vapors_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_SARONITE_VAPORS_DAMAGE))
+ return false;
+ return true;
+ }
+
+ void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ {
+ int32 mana = int32(aurEff->GetAmount() * pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount
+ int32 damage = mana * 2;
+ caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true);
+ caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, NULL, NULL, true);
+ }
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_general_vezax_saronite_vapors_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_general_vezax_saronite_vapors_AuraScript();
+ }
+};
+
class achievement_shadowdodger : public AchievementCriteriaScript
{
public:
@@ -509,6 +550,7 @@ void AddSC_boss_general_vezax()
new boss_saronite_animus();
new npc_saronite_vapors();
new spell_mark_of_the_faceless();
+ new spell_general_vezax_saronite_vapors();
new achievement_shadowdodger();
new achievement_smell_saronite();
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index d89d640b083..24a9171e29f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -354,7 +354,7 @@ class StoneGripTargetSelector : public std::unary_function<Unit*, bool>
public:
StoneGripTargetSelector(Creature* me, Unit const* victim) : _me(me), _victim(victim) {}
- bool operator() (Unit* target)
+ bool operator()(WorldObject* target)
{
if (target == _victim && _me->getThreatManager().getThreatList().size() > 1)
return true;
@@ -385,10 +385,10 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
return true;
}
- void FilterTargetsInitial(std::list<Unit*>& unitList)
+ void FilterTargetsInitial(std::list<WorldObject*>& unitList)
{
// Remove "main tank" and non-player targets
- unitList.remove_if (StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->getVictim()));
+ unitList.remove_if(StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->getVictim()));
// Maximum affected targets per difficulty mode
uint32 maxTargets = 1;
if (GetSpellInfo()->Id == 63981)
@@ -397,7 +397,7 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
// Return a random amount of targets based on maxTargets
while (maxTargets < unitList.size())
{
- std::list<Unit*>::iterator itr = unitList.begin();
+ std::list<WorldObject*>::iterator itr = unitList.begin();
advance(itr, urand(0, unitList.size()-1));
unitList.erase(itr);
}
@@ -406,20 +406,20 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
m_unitList = unitList;
}
- void FillTargetsSubsequential(std::list<Unit*>& unitList)
+ void FillTargetsSubsequential(std::list<WorldObject*>& unitList)
{
unitList = m_unitList;
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
}
// Shared between effects
- std::list<Unit*> m_unitList;
+ std::list<WorldObject*> m_unitList;
};
SpellScript* GetSpellScript() const
@@ -598,14 +598,14 @@ class spell_kologarn_stone_shout : public SpellScriptLoader
{
PrepareSpellScript(spell_kologarn_stone_shout_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (PlayerOrPetCheck());
+ unitList.remove_if(PlayerOrPetCheck());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index a1323b07899..e8e938dc06b 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -1006,7 +1006,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
- WorldLocation const* summonLocation = GetTargetDest();
+ WorldLocation const* summonLocation = GetExplTargetDest();
if (!caster || !summonLocation)
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index 727f40aef81..7ada42144a8 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -170,7 +170,11 @@ enum AchievementCredits
ACHIEV_MUST_DECONSTRUCT_FASTER = 21027,
};
-#define HEART_VEHICLE_SEAT 0
+enum VehicleSeats
+{
+ HEART_VEHICLE_SEAT_NORMAL = 0,
+ HEART_VEHICLE_SEAT_EXPOSED = 1,
+};
/*-------------------------------------------------------
*
@@ -198,6 +202,8 @@ class boss_xt002 : public CreatureScript
_Reset();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->SetReactState(REACT_AGGRESSIVE);
+ DoCast(me, SPELL_STAND);
_healthRecovered = false;
_gravityBombCasualty = false;
@@ -356,15 +362,16 @@ class boss_xt002 : public CreatureScript
me->AttackStop();
me->SetReactState(REACT_PASSIVE);
- Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL;
+ Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT_NORMAL) : NULL;
if (heart)
{
heart->CastSpell(heart, SPELL_HEART_OVERLOAD, false);
heart->CastSpell(me, SPELL_HEART_LIGHTNING_TETHER, false);
heart->CastSpell(heart, SPELL_HEART_HEAL_TO_FULL, true);
heart->CastSpell(heart, SPELL_EXPOSED_HEART, false); // Channeled
-
- heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ heart->ChangeSeat(HEART_VEHICLE_SEAT_EXPOSED, true);
+ heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29);
}
events.CancelEvent(EVENT_SEARING_LIGHT);
@@ -392,11 +399,13 @@ class boss_xt002 : public CreatureScript
events.RescheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB);
events.RescheduleEvent(EVENT_TYMPANIC_TANTRUM, urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX));
- Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL;
+ Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT_EXPOSED) : NULL;
if (!heart)
return;
- heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ heart->ChangeSeat(HEART_VEHICLE_SEAT_NORMAL, false);
+ heart->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ heart->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29);
heart->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART);
if (!_hardMode)
@@ -425,43 +434,39 @@ class boss_xt002 : public CreatureScript
* XT-002 HEART
*
*///----------------------------------------------------
+
class mob_xt002_heart : public CreatureScript
{
public:
mob_xt002_heart() : CreatureScript("mob_xt002_heart") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_xt002_heartAI(creature);
- }
-
- struct mob_xt002_heartAI : public ScriptedAI
+ struct mob_xt002_heartAI : public Scripted_NoMovementAI
{
- mob_xt002_heartAI(Creature* creature) : ScriptedAI(creature)
+ mob_xt002_heartAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ _instance(creature->GetInstanceScript())
{
- _instance = creature->GetInstanceScript();
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetReactState(REACT_PASSIVE);
}
- void DamageTaken(Unit* /*pDone*/, uint32 &damage)
+ void UpdateAI(uint32 const /*diff*/) { }
+
+ void JustDied(Unit* /*killer*/)
{
- Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002));
+ Creature* xt002 = _instance ? me->GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL;
if (!xt002 || !xt002->AI())
return;
- if (damage >= me->GetHealth())
- {
- xt002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetMaxHealth());
- xt002->AI()->DoAction(ACTION_ENTER_HARD_MODE);
- damage = 0;
- }
+ xt002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetHealth());
+ xt002->AI()->DoAction(ACTION_ENTER_HARD_MODE);
}
- private:
- InstanceScript* _instance;
- uint32 _damageTaken;
+ private:
+ InstanceScript* _instance;
};
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_xt002_heartAI(creature);
+ }
};
/*-------------------------------------------------------
@@ -915,7 +920,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
{
uint8 a = urand(0, 4);
uint32 spellId = spells[a];
- toyPile->CastSpell(toyPile, spellId, true);
+ toyPile->CastSpell(toyPile, spellId, true, NULL, NULL, instance->GetData64(BOSS_XT002));
}
}
}
@@ -945,15 +950,21 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader
{
PrepareSpellScript(spell_xt002_tympanic_tantrum_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(PlayerOrPetCheck());
+ }
+
+ void RecalculateDamage()
{
- unitList.remove_if (PlayerOrPetCheck());
+ SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage()));
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
index 3f01f21b189..58ba125b994 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
@@ -18,18 +18,27 @@
#include "ScriptMgr.h"
#include "ulduar.h"
-enum Sara_Yells
+enum Sara
{
- SAY_SARA_PREFIGHT_1 = -1603310,
- SAY_SARA_PREFIGHT_2 = -1603311,
- SAY_SARA_AGGRO_1 = -1603312,
- SAY_SARA_AGGRO_2 = -1603313,
- SAY_SARA_AGGRO_3 = -1603314,
- SAY_SARA_SLAY_1 = -1603315,
- SAY_SARA_SLAY_2 = -1603316,
- WHISP_SARA_INSANITY = -1603317,
- SAY_SARA_PHASE2_1 = -1603318,
- SAY_SARA_PHASE2_2 = -1603319,
+ // text
+ YELL_SARA_PREFIGHT = 0,
+ YELL_COMBAT_PHASE_1 = 1,
+ YELL_COMBAT_PHASE_2 = 2,
+ YELL_SLAY = 3,
+
+ // Phase 1 spells
+ SPELL_SARAS_ANGER_1 = 63147, // Target Entry 33136
+ SPELL_SARAS_ANGER_2 = 63744, // Target Entry 33136
+ SPELL_SARAS_FEVOR_1 = 63138, // Target Player
+ SPELL_SARAS_FEVOR_2 = 63747, // Target Player
+ SPELL_SARAS_BLESSING_1 = 63134, // Target Player
+ SPELL_SARAS_BLESSING_2 = 63745, // Target Self
+
+ // Phase 2 spells
+ SPELL_PHYCHOSIS = 63795, // Target Self
+ SPELL_MALADY_OF_THE_MIND = 63830, // Target Self
+ SPELL_DEATH_RAY = 63891, // Target Self
+ SPELL_BRAIN_LINK = 63802, // Target Self
};
enum YoggSaron_Yells
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index e12393f047f..2f37fb06f24 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -22,9 +22,14 @@
static DoorData const doorData[] =
{
- { GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S },
- { GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S },
- { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE },
+ {GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S },
+ {GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S },
+ {GO_DOODAD_UL_SIGILDOOR_03, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_W },
+ {GO_DOODAD_UL_UNIVERSEFLOOR_01, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_NONE },
+ {GO_DOODAD_UL_UNIVERSEFLOOR_02, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE },
+ {GO_DOODAD_UL_UNIVERSEGLOBE01, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE },
+ {GO_DOODAD_UL_ULDUAR_TRAPDOOR_03, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE },
+ {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE },
};
class instance_ulduar : public InstanceMapScript
@@ -36,7 +41,6 @@ class instance_ulduar : public InstanceMapScript
{
instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { }
- uint32 Encounter[MAX_ENCOUNTER];
std::string m_strInstData;
// Creatures
@@ -72,6 +76,12 @@ class instance_ulduar : public InstanceMapScript
uint64 HodirDoorGUID;
uint64 HodirIceDoorGUID;
uint64 ArchivumDoorGUID;
+ uint64 AlgalonSigilDoorGUID[3];
+ uint64 AlgalonFloorGUID[2];
+ uint64 AlgalonUniverseGUID;
+ uint64 AlgalonTrapdoorGUID;
+ uint64 BrannBronzebeardAlgGUID;
+ uint64 GiftOfTheObserverGUID;
// Miscellaneous
uint32 TeamInInstance;
@@ -111,35 +121,50 @@ class instance_ulduar : public InstanceMapScript
HodirDoorGUID = 0;
HodirIceDoorGUID = 0;
ArchivumDoorGUID = 0;
+ AlgalonUniverseGUID = 0;
+ AlgalonTrapdoorGUID = 0;
+ BrannBronzebeardAlgGUID = 0;
+ GiftOfTheObserverGUID = 0;
+ _algalonTimer = 61;
+ _maxArmorItemLevel = 0;
+ _maxWeaponItemLevel = 0;
TeamInInstance = 0;
HodirRareCacheData = 0;
ColossusData = 0;
elderCount = 0;
conSpeedAtory = false;
Unbroken = true;
+ _algalonSummoned = false;
+ _summonAlgalon = false;
- memset(Encounter, 0, sizeof(Encounter));
+ memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID));
+ memset(AlgalonFloorGUID, 0, sizeof(AlgalonFloorGUID));
memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs));
memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs));
memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs));
memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs));
}
- bool IsEncounterInProgress() const
+ void FillInitialWorldStates(WorldPacket& packet)
{
- for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- {
- if (Encounter[i] == IN_PROGRESS)
- return true;
- }
-
- return false;
+ packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(_algalonTimer && _algalonTimer <= 60);
+ packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min<uint32>(_algalonTimer, 60));
}
void OnPlayerEnter(Player* player)
{
if (!TeamInInstance)
TeamInInstance = player->GetTeam();
+
+ if (_summonAlgalon)
+ {
+ _summonAlgalon = false;
+ TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
+ if (_algalonTimer && _algalonTimer <= 60)
+ algalon->AI()->DoAction(ACTION_INIT_ALGALON);
+ else
+ algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ }
}
void OnCreatureCreate(Creature* creature)
@@ -234,7 +259,6 @@ class instance_ulduar : public InstanceMapScript
case NPC_ALGALON:
AlgalonGUID = creature->GetGUID();
break;
-
// Hodir's Helper NPCs
case NPC_EIVI_NIGHTFEATHER:
if (TeamInInstance == HORDE)
@@ -268,9 +292,32 @@ class instance_ulduar : public InstanceMapScript
if (TeamInInstance == HORDE)
creature->UpdateEntry(NPC_BATTLE_PRIEST_GINA, HORDE);
break;
+ case NPC_BRANN_BRONZBEARD_ALG:
+ BrannBronzebeardAlgGUID = creature->GetGUID();
+ break;
+ //! These creatures are summoned by something else than Algalon
+ //! but need to be controlled/despawned by him - so they need to be
+ //! registered in his summon list
+ case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER:
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_01:
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_02:
+ case NPC_UNLEASHED_DARK_MATTER:
+ if (Creature* algalon = instance->GetCreature(AlgalonGUID))
+ algalon->AI()->JustSummoned(creature);
+ break;
}
+ }
- }
+ void OnCreatureRemove(Creature* creature)
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_BRANN_BRONZBEARD_ALG:
+ if (BrannBronzebeardAlgGUID == creature->GetGUID())
+ BrannBronzebeardAlgGUID = 0;
+ break;
+ }
+ }
void OnGameObjectCreate(GameObject* gameObject)
{
@@ -341,6 +388,45 @@ class instance_ulduar : public InstanceMapScript
if (GetBossState(BOSS_ASSEMBLY_OF_IRON) != DONE)
HandleGameObject(ArchivumDoorGUID, false);
break;
+ case GO_CELESTIAL_PLANETARIUM_ACCESS_10:
+ case GO_CELESTIAL_PLANETARIUM_ACCESS_25:
+ if (_algalonSummoned)
+ gameObject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ break;
+ case GO_DOODAD_UL_SIGILDOOR_01:
+ AlgalonSigilDoorGUID[0] = gameObject->GetGUID();
+ if (_algalonSummoned)
+ gameObject->SetGoState(GO_STATE_ACTIVE);
+ break;
+ case GO_DOODAD_UL_SIGILDOOR_02:
+ AlgalonSigilDoorGUID[1] = gameObject->GetGUID();
+ if (_algalonSummoned)
+ gameObject->SetGoState(GO_STATE_ACTIVE);
+ break;
+ case GO_DOODAD_UL_SIGILDOOR_03:
+ AlgalonSigilDoorGUID[2] = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_UNIVERSEFLOOR_01:
+ AlgalonFloorGUID[0] = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_UNIVERSEFLOOR_02:
+ AlgalonFloorGUID[1] = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_UNIVERSEGLOBE01:
+ AlgalonUniverseGUID = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03:
+ AlgalonTrapdoorGUID = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_GIFT_OF_THE_OBSERVER_10:
+ case GO_GIFT_OF_THE_OBSERVER_25:
+ GiftOfTheObserverGUID = gameObject->GetGUID();
+ break;
}
}
@@ -349,10 +435,14 @@ class instance_ulduar : public InstanceMapScript
switch (gameObject->GetEntry())
{
case GO_LEVIATHAN_DOOR:
- AddDoor(gameObject, false);
- break;
case GO_XT_002_DOOR:
+ case GO_DOODAD_UL_SIGILDOOR_03:
+ case GO_DOODAD_UL_UNIVERSEFLOOR_01:
+ case GO_DOODAD_UL_UNIVERSEFLOOR_02:
+ case GO_DOODAD_UL_UNIVERSEGLOBE01:
+ case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03:
AddDoor(gameObject, false);
+ break;
default:
break;
}
@@ -390,6 +480,7 @@ class instance_ulduar : public InstanceMapScript
// Flame Leviathan's Tower Event triggers
Creature* FlameLeviathan = instance->GetCreature(LeviathanGUID);
if (FlameLeviathan && FlameLeviathan->isAlive()) // No leviathan, no event triggering ;)
+ {
switch (eventId)
{
case EVENT_TOWER_OF_STORM_DESTROYED:
@@ -405,6 +496,7 @@ class instance_ulduar : public InstanceMapScript
FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_LIFE_DESTROYED);
break;
}
+ }
}
@@ -465,6 +557,52 @@ class instance_ulduar : public InstanceMapScript
if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID))
gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
break;
+ case BOSS_ALGALON:
+ if (state == DONE)
+ {
+ _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER);
+ _events.CancelEvent(EVENT_DESPAWN_ALGALON);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0);
+ _algalonTimer = 61;
+ if (GameObject* gameObject = instance->GetGameObject(GiftOfTheObserverGUID))
+ gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
+ // get item level (recheck weapons)
+ Map::PlayerList const& players = instance->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (Player* player = itr->getSource())
+ for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot)
+ if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
+ _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
+ }
+ else if (state == IN_PROGRESS)
+ {
+ // get item level (armor cannot be swapped in combat)
+ Map::PlayerList const& players = instance->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ {
+ if (Player* player = itr->getSource())
+ {
+ for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
+ {
+ if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY)
+ continue;
+
+ if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ {
+ if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED)
+ {
+ if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
+ _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
+ }
+ else if (item->GetTemplate()->ItemLevel > _maxArmorItemLevel)
+ _maxArmorItemLevel = item->GetTemplate()->ItemLevel;
+ }
+ }
+ }
+ }
+ }
+ break;
}
return true;
@@ -497,6 +635,16 @@ class instance_ulduar : public InstanceMapScript
case DATA_UNBROKEN:
Unbroken = bool(data);
break;
+ case EVENT_DESPAWN_ALGALON:
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60);
+ _algalonTimer = 60;
+ _events.ScheduleEvent(EVENT_DESPAWN_ALGALON, 3600000);
+ _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
+ break;
+ case DATA_ALGALON_SUMMON_STATE:
+ _algalonSummoned = true;
+ break;
default:
break;
}
@@ -571,6 +719,22 @@ class instance_ulduar : public InstanceMapScript
return KeeperGUIDs[1];
case BOSS_STONEBARK:
return KeeperGUIDs[2];
+ case DATA_SIGILDOOR_01:
+ return AlgalonSigilDoorGUID[0];
+ case DATA_SIGILDOOR_02:
+ return AlgalonSigilDoorGUID[1];
+ case DATA_SIGILDOOR_03:
+ return AlgalonSigilDoorGUID[2];
+ case DATA_UNIVERSE_FLOOR_01:
+ return AlgalonFloorGUID[0];
+ case DATA_UNIVERSE_FLOOR_02:
+ return AlgalonFloorGUID[1];
+ case DATA_UNIVERSE_GLOBE:
+ return AlgalonUniverseGUID;
+ case DATA_ALGALON_TRAPDOOR:
+ return AlgalonTrapdoorGUID;
+ case DATA_BRANN_BRONZEBEARD_ALG:
+ return BrannBronzebeardAlgGUID;
}
return 0;
@@ -593,12 +757,23 @@ class instance_ulduar : public InstanceMapScript
return 0;
}
+ bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* , Unit const* /* = NULL */, uint32 /* = 0 */)
+ {
+ switch (criteriaId)
+ {
+ case CRITERIA_HERALD_OF_TITANS:
+ return _maxArmorItemLevel <= MAX_HERALD_ARMOR_ITEMLEVEL && _maxWeaponItemLevel <= MAX_HERALD_WEAPON_ITEMLEVEL;
+ }
+
+ return false;
+ }
+
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
- saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS);
+ saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << (_algalonSummoned ? 1 : 0);
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -628,15 +803,68 @@ class instance_ulduar : public InstanceMapScript
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
- if (i == DATA_COLOSSUS)
- SetData(i, tmpState);
- else
- SetBossState(i, EncounterState(tmpState));
+ SetBossState(i, EncounterState(tmpState));
+ }
+
+ uint32 tempState;
+ loadStream >> tempState;
+ if (tempState == IN_PROGRESS || tempState > SPECIAL)
+ tempState = NOT_STARTED;
+ SetData(DATA_COLOSSUS, tempState);
+
+ loadStream >> _algalonTimer;
+ loadStream >> tempState;
+ _algalonSummoned = tempState != 0;
+ if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE)
+ {
+ _summonAlgalon = true;
+ if (_algalonTimer && _algalonTimer <= 60)
+ {
+ _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer);
+ }
}
}
OUT_LOAD_INST_DATA_COMPLETE;
}
+
+ void Update(uint32 diff)
+ {
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_UPDATE_ALGALON_TIMER:
+ SaveToDB();
+ DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, --_algalonTimer);
+ if (_algalonTimer)
+ _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
+ else
+ {
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0);
+ _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER);
+ if (Creature* algalon = instance->GetCreature(AlgalonGUID))
+ algalon->AI()->DoAction(EVENT_DESPAWN_ALGALON);
+ }
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ uint32 _algalonTimer;
+ bool _summonAlgalon;
+ bool _algalonSummoned;
+ uint32 _maxArmorItemLevel;
+ uint32 _maxWeaponItemLevel;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index a31954b8a16..858a82bbe57 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -21,6 +21,8 @@
#include "ObjectMgr.h"
#define UlduarScriptName "instance_ulduar"
+extern Position const AlgalonLandPos;
+
enum UlduarBosses
{
MAX_ENCOUNTER = 20,
@@ -50,98 +52,124 @@ enum UlduarBosses
enum UlduarNPCs
{
// General
- NPC_LEVIATHAN = 33113,
- NPC_SALVAGED_DEMOLISHER = 33109,
- NPC_SALVAGED_SIEGE_ENGINE = 33060,
- NPC_IGNIS = 33118,
- NPC_RAZORSCALE = 33186,
- NPC_RAZORSCALE_CONTROLLER = 33233,
- NPC_STEELFORGED_DEFFENDER = 33236,
- NPC_EXPEDITION_COMMANDER = 33210,
- NPC_XT002 = 33293,
- NPC_XT_TOY_PILE = 33337,
- NPC_STEELBREAKER = 32867,
- NPC_MOLGEIM = 32927,
- NPC_BRUNDIR = 32857,
- NPC_KOLOGARN = 32930,
- NPC_FOCUSED_EYEBEAM = 33632,
- NPC_FOCUSED_EYEBEAM_RIGHT = 33802,
- NPC_LEFT_ARM = 32933,
- NPC_RIGHT_ARM = 32934,
- NPC_RUBBLE = 33768,
- NPC_AURIAYA = 33515,
- NPC_MIMIRON = 33350,
- NPC_HODIR = 32845,
- NPC_THORIM = 32865,
- NPC_FREYA = 32906,
- NPC_VEZAX = 33271,
- NPC_YOGGSARON = 33288,
- NPC_ALGALON = 32871,
+ NPC_LEVIATHAN = 33113,
+ NPC_SALVAGED_DEMOLISHER = 33109,
+ NPC_SALVAGED_SIEGE_ENGINE = 33060,
+ NPC_IGNIS = 33118,
+ NPC_RAZORSCALE = 33186,
+ NPC_RAZORSCALE_CONTROLLER = 33233,
+ NPC_STEELFORGED_DEFFENDER = 33236,
+ NPC_EXPEDITION_COMMANDER = 33210,
+ NPC_XT002 = 33293,
+ NPC_XT_TOY_PILE = 33337,
+ NPC_STEELBREAKER = 32867,
+ NPC_MOLGEIM = 32927,
+ NPC_BRUNDIR = 32857,
+ NPC_KOLOGARN = 32930,
+ NPC_FOCUSED_EYEBEAM = 33632,
+ NPC_FOCUSED_EYEBEAM_RIGHT = 33802,
+ NPC_LEFT_ARM = 32933,
+ NPC_RIGHT_ARM = 32934,
+ NPC_RUBBLE = 33768,
+ NPC_AURIAYA = 33515,
+ NPC_MIMIRON = 33350,
+ NPC_HODIR = 32845,
+ NPC_THORIM = 32865,
+ NPC_FREYA = 32906,
+ NPC_VEZAX = 33271,
+ NPC_YOGGSARON = 33288,
+ NPC_ALGALON = 32871,
// Mimiron
- NPC_LEVIATHAN_MKII = 33432,
- NPC_VX_001 = 33651,
- NPC_AERIAL_COMMAND_UNIT = 33670,
+ NPC_LEVIATHAN_MKII = 33432,
+ NPC_VX_001 = 33651,
+ NPC_AERIAL_COMMAND_UNIT = 33670,
// Freya's Keepers
- NPC_IRONBRANCH = 32913,
- NPC_BRIGHTLEAF = 32915,
- NPC_STONEBARK = 32914,
+ NPC_IRONBRANCH = 32913,
+ NPC_BRIGHTLEAF = 32915,
+ NPC_STONEBARK = 32914,
// Hodir's Helper NPCs
- NPC_TOR_GREYCLOUD = 32941,
- NPC_KAR_GREYCLOUD = 33333,
- NPC_EIVI_NIGHTFEATHER = 33325,
- NPC_ELLIE_NIGHTFEATHER = 32901,
- NPC_SPIRITWALKER_TARA = 33332,
- NPC_SPIRITWALKER_YONA = 32950,
- NPC_ELEMENTALIST_MAHFUUN = 33328,
- NPC_ELEMENTALIST_AVUUN = 32900,
- NPC_AMIRA_BLAZEWEAVER = 33331,
- NPC_VEESHA_BLAZEWEAVER = 32946,
- NPC_MISSY_FLAMECUFFS = 32893,
- NPC_SISSY_FLAMECUFFS = 33327,
- NPC_BATTLE_PRIEST_ELIZA = 32948,
- NPC_BATTLE_PRIEST_GINA = 33330,
- NPC_FIELD_MEDIC_PENNY = 32897,
- NPC_FIELD_MEDIC_JESSI = 33326,
+ NPC_TOR_GREYCLOUD = 32941,
+ NPC_KAR_GREYCLOUD = 33333,
+ NPC_EIVI_NIGHTFEATHER = 33325,
+ NPC_ELLIE_NIGHTFEATHER = 32901,
+ NPC_SPIRITWALKER_TARA = 33332,
+ NPC_SPIRITWALKER_YONA = 32950,
+ NPC_ELEMENTALIST_MAHFUUN = 33328,
+ NPC_ELEMENTALIST_AVUUN = 32900,
+ NPC_AMIRA_BLAZEWEAVER = 33331,
+ NPC_VEESHA_BLAZEWEAVER = 32946,
+ NPC_MISSY_FLAMECUFFS = 32893,
+ NPC_SISSY_FLAMECUFFS = 33327,
+ NPC_BATTLE_PRIEST_ELIZA = 32948,
+ NPC_BATTLE_PRIEST_GINA = 33330,
+ NPC_FIELD_MEDIC_PENNY = 32897,
+ NPC_FIELD_MEDIC_JESSI = 33326,
// Freya's trash NPCs
- NPC_CORRUPTED_SERVITOR = 33354,
- NPC_MISGUIDED_NYMPH = 33355,
- NPC_GUARDIAN_LASHER = 33430,
- NPC_FOREST_SWARMER = 33431,
- NPC_MANGROVE_ENT = 33525,
- NPC_IRONROOT_LASHER = 33526,
- NPC_NATURES_BLADE = 33527,
- NPC_GUARDIAN_OF_LIFE = 33528,
+ NPC_CORRUPTED_SERVITOR = 33354,
+ NPC_MISGUIDED_NYMPH = 33355,
+ NPC_GUARDIAN_LASHER = 33430,
+ NPC_FOREST_SWARMER = 33431,
+ NPC_MANGROVE_ENT = 33525,
+ NPC_IRONROOT_LASHER = 33526,
+ NPC_NATURES_BLADE = 33527,
+ NPC_GUARDIAN_OF_LIFE = 33528,
+
+ // Algalon the Observer
+ NPC_BRANN_BRONZBEARD_ALG = 34064,
+ NPC_AZEROTH = 34246,
+ NPC_LIVING_CONSTELLATION = 33052,
+ NPC_ALGALON_STALKER = 33086,
+ NPC_COLLAPSING_STAR = 32955,
+ NPC_BLACK_HOLE = 32953,
+ NPC_WORM_HOLE = 34099,
+ NPC_ALGALON_VOID_ZONE_VISUAL_STALKER = 34100,
+ NPC_ALGALON_STALKER_ASTEROID_TARGET_01 = 33104,
+ NPC_ALGALON_STALKER_ASTEROID_TARGET_02 = 33105,
+ NPC_UNLEASHED_DARK_MATTER = 34097,
};
enum UlduarGameObjects
{
- GO_KOLOGARN_CHEST_HERO = 195047,
- GO_KOLOGARN_CHEST = 195046,
- GO_KOLOGARN_BRIDGE = 194232,
- GO_KOLOGARN_DOOR = 194553,
- GO_THORIM_CHEST_HERO = 194315,
- GO_THORIM_CHEST = 194314,
- GO_HODIR_RARE_CACHE_OF_WINTER = 194200,
- GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201,
- GO_HODIR_CHEST_HERO = 194308,
- GO_HODIR_CHEST = 194307,
- GO_LEVIATHAN_DOOR = 194905,
- GO_LEVIATHAN_GATE = 194630,
- GO_XT_002_DOOR = 194631,
- GO_VEZAX_DOOR = 194750,
- GO_MOLE_MACHINE = 194316,
- GO_RAZOR_HARPOON_1 = 194542,
- GO_RAZOR_HARPOON_2 = 194541,
- GO_RAZOR_HARPOON_3 = 194543,
- GO_RAZOR_HARPOON_4 = 194519,
- GO_RAZOR_BROKEN_HARPOON = 194565,
- GO_HODIR_DOOR = 194634,
- GO_HODIR_ICE_DOOR = 194441,
- GO_ARCHIVUM_DOOR = 194556,
+ GO_KOLOGARN_CHEST_HERO = 195047,
+ GO_KOLOGARN_CHEST = 195046,
+ GO_KOLOGARN_BRIDGE = 194232,
+ GO_KOLOGARN_DOOR = 194553,
+ GO_THORIM_CHEST_HERO = 194315,
+ GO_THORIM_CHEST = 194314,
+ GO_HODIR_RARE_CACHE_OF_WINTER = 194200,
+ GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201,
+ GO_HODIR_CHEST_HERO = 194308,
+ GO_HODIR_CHEST = 194307,
+ GO_LEVIATHAN_DOOR = 194905,
+ GO_LEVIATHAN_GATE = 194630,
+ GO_XT_002_DOOR = 194631,
+ GO_VEZAX_DOOR = 194750,
+ GO_MOLE_MACHINE = 194316,
+ GO_RAZOR_HARPOON_1 = 194542,
+ GO_RAZOR_HARPOON_2 = 194541,
+ GO_RAZOR_HARPOON_3 = 194543,
+ GO_RAZOR_HARPOON_4 = 194519,
+ GO_RAZOR_BROKEN_HARPOON = 194565,
+ GO_HODIR_DOOR = 194634,
+ GO_HODIR_ICE_DOOR = 194441,
+ GO_ARCHIVUM_DOOR = 194556,
+
+ // Algalon the Observer
+ GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628,
+ GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752,
+ GO_DOODAD_UL_SIGILDOOR_01 = 194767,
+ GO_DOODAD_UL_SIGILDOOR_02 = 194911,
+ GO_DOODAD_UL_SIGILDOOR_03 = 194910,
+ GO_DOODAD_UL_UNIVERSEFLOOR_01 = 194715,
+ GO_DOODAD_UL_UNIVERSEFLOOR_02 = 194716,
+ GO_DOODAD_UL_UNIVERSEGLOBE01 = 194148,
+ GO_DOODAD_UL_ULDUAR_TRAPDOOR_03 = 194253,
+ GO_GIFT_OF_THE_OBSERVER_10 = 194821,
+ GO_GIFT_OF_THE_OBSERVER_25 = 194822,
};
enum LeviathanData
@@ -161,6 +189,7 @@ enum UlduarAchievementCriteriaIds
{
CRITERIA_CON_SPEED_ATORY = 21597,
CRITERIA_DISARMED = 21687,
+ CRITERIA_HERALD_OF_TITANS = 10678,
};
enum UlduarData
@@ -180,12 +209,38 @@ enum UlduarData
// Hodir
DATA_HODIR_RARE_CACHE,
+
+ // Algalon the Observer
+ DATA_ALGALON_SUMMON_STATE,
+ DATA_SIGILDOOR_01,
+ DATA_SIGILDOOR_02,
+ DATA_SIGILDOOR_03,
+ DATA_UNIVERSE_FLOOR_01,
+ DATA_UNIVERSE_FLOOR_02,
+ DATA_UNIVERSE_GLOBE,
+ DATA_ALGALON_TRAPDOOR,
+ DATA_BRANN_BRONZEBEARD_ALG,
+};
+
+enum UlduarWorldStates
+{
+ WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131,
+ WORLD_STATE_ALGALON_TIMER_ENABLED = 4132,
};
enum UlduarAchievementData
{
// FL Achievement boolean
DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs,
+ MAX_HERALD_ARMOR_ITEMLEVEL = 226,
+ MAX_HERALD_WEAPON_ITEMLEVEL = 232,
+};
+
+enum UlduarEvents
+{
+ EVENT_DESPAWN_ALGALON = 1,
+ EVENT_UPDATE_ALGALON_TIMER = 2,
+ ACTION_INIT_ALGALON = 6,
};
template<class AI>
@@ -199,13 +254,24 @@ CreatureAI* GetUlduarAI(Creature* creature)
return NULL;
}
+template<class AI>
+GameObjectAI* GetUlduarAI(GameObject* go)
+{
+ if (InstanceMap* instance = go->GetMap()->ToInstanceMap())
+ if (instance->GetInstanceScript())
+ if (instance->GetScriptId() == sObjectMgr->GetScriptId(UlduarScriptName))
+ return new AI(go);
+
+ return NULL;
+}
+
class PlayerOrPetCheck
{
public:
- bool operator() (Unit* unit)
+ bool operator()(WorldObject* object) const
{
- if (unit->GetTypeId() != TYPEID_PLAYER)
- if (!unit->ToCreature()->isPet())
+ if (object->GetTypeId() != TYPEID_PLAYER)
+ if (!object->ToCreature()->isPet())
return true;
return false;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
index a7853a07e22..48667053373 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
@@ -22,7 +22,8 @@ SDComment: Some Problems with Annhylde Movement, Blizzlike Timers (just shadow a
SDCategory: Udgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_keep.h"
enum Yells
@@ -100,6 +101,7 @@ public:
boss_ingvar_the_plundererAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ bIsUndead = false;
}
InstanceScript* instance;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index 93cc94923db..f53020a72c4 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -22,7 +22,10 @@ SDComment:
SDCategory: Utgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "utgarde_keep.h"
enum KelsethEncounter
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
index 915d1c71bb2..be8d60fbeb9 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -22,7 +22,8 @@ SDComment: Needs adjustments to blizzlike timers, Yell Text + Sound to DB
SDCategory: Utgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_keep.h"
enum eEnums
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
index fda4767e16b..1e79cc1c5bf 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
@@ -22,7 +22,8 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Utgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "utgarde_keep.h"
#define MAX_ENCOUNTER 3
@@ -119,7 +120,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index 95d2cb1709e..2d53e7062eb 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_keep.h"
uint32 entry_search[3] =
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index e2943f491f6..8cbfe4bafb4 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_pinnacle.h"
enum Spells
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 5132dd0f046..a6ad7befc38 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -25,7 +25,8 @@ SDComment: <Known Bugs>
SDCategory: Utgarde Pinnacle
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_pinnacle.h"
//Yell
@@ -171,6 +172,7 @@ public:
boss_skadiAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
instance = creature->GetInstanceScript();
+ m_uiGraufGUID = 0;
}
InstanceScript* instance;
@@ -206,7 +208,7 @@ public:
Summons.DespawnAll();
me->SetSpeed(MOVE_FLIGHT, 3.0f);
- if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted())
+ if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted())
me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
if (instance)
{
@@ -220,7 +222,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) == NULL)
+ if (!Unit::GetCreature(*me, m_uiGraufGUID))
me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index 29b8f2e7f48..f2f03ff602b 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "utgarde_pinnacle.h"
enum Spells
@@ -276,7 +279,7 @@ public:
arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false);
pos.Relocate(me);
pos.m_positionZ += 8.0f;
- me->GetMotionMaster()->MoveTakeoff(0, pos, 3.30078125f);
+ me->GetMotionMaster()->MoveTakeoff(0, pos);
// spectators flee event
if (instance)
{
@@ -333,7 +336,7 @@ public:
pos.m_positionX = me->GetHomePosition().GetPositionX();
pos.m_positionY = me->GetHomePosition().GetPositionY();
pos.m_positionZ = 90.6065f;
- me->GetMotionMaster()->MoveLand(0, pos, 6.247422f);
+ me->GetMotionMaster()->MoveLand(0, pos);
me->SetDisableGravity(false, true);
me->SetHover(true);
++introPhase;
@@ -522,12 +525,12 @@ public:
};
};
-class checkRitualTarget
+class RitualTargetCheck
{
public:
- explicit checkRitualTarget(Unit* _caster) : caster(_caster) { }
+ explicit RitualTargetCheck(Unit* _caster) : caster(_caster) { }
- bool operator() (Unit* unit)
+ bool operator() (WorldObject* unit) const
{
if (InstanceScript* instance = caster->GetInstanceScript())
if (instance->GetData64(DATA_SACRIFICED_PLAYER) == unit->GetGUID())
@@ -549,14 +552,14 @@ class spell_paralyze_pinnacle : public SpellScriptLoader
{
PrepareSpellScript(spell_paralyze_pinnacle_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if(checkRitualTarget(GetCaster()));
+ unitList.remove_if(RitualTargetCheck(GetCaster()));
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_paralyze_pinnacle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_paralyze_pinnacle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index f9251c637ba..39fd01a9269 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_pinnacle.h"
enum Spells
@@ -120,6 +121,9 @@ public:
m_uiActiveOrder[i] = m_uiActiveOrder[r];
m_uiActiveOrder[r] = temp;
}
+
+ m_uiActivedCreatureGUID = 0;
+ m_uiOrbGUID = 0;
}
bool m_bIsWalking;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp
index 26fbbf4d717..c5d50d4e7fd 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "utgarde_pinnacle.h"
#define MAX_ENCOUNTER 4
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
index bffc6af2a3a..96e0bc66bd1 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
#define EMOTE_BERSERK -1590002
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index 4980ed36ec3..903280d317a 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "vault_of_archavon.h"
//Emalon spells
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
index dd9db1c0a99..31003addf1f 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
enum Events
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 100f1fccac8..9c60673522c 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
index ec0de41ed6d..d1209b40a19 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "vault_of_archavon.h"
/* Vault of Archavon encounters:
diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
index 37ef8bf2788..b4ce402e7de 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 31902acfc46..bd59b731c3c 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index a191d9349f2..f6d918e0493 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
index 7a8254ad2b6..510e9874dd7 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index 1a70846e1b6..f368b07077a 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
//Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index ac165ac39ef..a01b41bfbcf 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index 4569741e459..d1c65259738 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
index 79c54880430..4b6fed181e4 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "violet_hold.h"
#define MAX_ENCOUNTER 3
@@ -690,7 +691,8 @@ public:
{
AddWave();
bActive = false;
- uiActivationTimer = 5000;
+ // 1 minute waiting time after each boss fight
+ uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000;
} else uiActivationTimer -= diff;
}
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index e9d2c85e13e..122d051f1dd 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "violet_hold.h"
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp
index f83538b344c..9b207c257fc 100644
--- a/src/server/scripts/Northrend/borean_tundra.cpp
+++ b/src/server/scripts/Northrend/borean_tundra.cpp
@@ -37,7 +37,9 @@ npc_lurgglbr
npc_nexus_drake_hatchling
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
@@ -186,7 +188,7 @@ public:
if (owner->GetTypeId() == TYPEID_PLAYER)
{
owner->CastSpell(owner, 46231, true);
- CAST_CRE(who)->ForcedDespawn();
+ CAST_CRE(who)->DespawnOrUnsummon();
}
}
}
diff --git a/src/server/scripts/Northrend/crystalsong_forest.cpp b/src/server/scripts/Northrend/crystalsong_forest.cpp
index d48903696ec..7b8eb331702 100644
--- a/src/server/scripts/Northrend/crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/crystalsong_forest.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: CrystalsongForest
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*******************************************************
* npc_warmage_violetstand
diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp
index e7b92732066..c19effbab1b 100644
--- a/src/server/scripts/Northrend/dalaran.cpp
+++ b/src/server/scripts/Northrend/dalaran.cpp
@@ -23,7 +23,9 @@ SDComment: For what is 63990+63991? Same function but don't work correct...
SDCategory: Dalaran
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*******************************************************
* npc_mageguard_dalaran
diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp
index 4cbe280a9f2..ecc012eb25d 100644
--- a/src/server/scripts/Northrend/dragonblight.cpp
+++ b/src/server/scripts/Northrend/dragonblight.cpp
@@ -27,7 +27,11 @@ EndScriptData */
npc_alexstrasza_wr_gate
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "ScriptedEscortAI.h"
enum eEnums
@@ -69,7 +73,106 @@ public:
}
};
+/*######
+## Quest Strengthen the Ancients (12096|12092)
+######*/
+
+enum StrengthenAncientsMisc
+{
+ SAY_WALKER_FRIENDLY = 0,
+ SAY_WALKER_ENEMY = 1,
+ SAY_LOTHALOR = 0,
+
+ SPELL_CREATE_ITEM_BARK = 47550,
+ SPELL_CONFUSED = 47044,
+
+ NPC_LOTHALOR = 26321,
+
+ FACTION_WALKER_ENEMY = 14,
+};
+
+class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
+{
+public:
+ spell_q12096_q12092_dummy() : SpellScriptLoader("spell_q12096_q12092_dummy") { }
+
+ class spell_q12096_q12092_dummy_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12096_q12092_dummy_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ uint32 roll = rand() % 2;
+
+ Creature* tree = GetHitCreature();
+ Player* player = GetCaster()->ToPlayer();
+
+ if (!tree || !player)
+ return;
+
+ tree->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+
+ if (roll == 1) // friendly version
+ {
+ tree->CastSpell(player, SPELL_CREATE_ITEM_BARK);
+ tree->AI()->Talk(SAY_WALKER_FRIENDLY, player->GetGUID());
+ tree->DespawnOrUnsummon(1000);
+ }
+ else if (roll == 0) // enemy version
+ {
+ tree->AI()->Talk(SAY_WALKER_ENEMY, player->GetGUID());
+ tree->setFaction(FACTION_WALKER_ENEMY);
+ tree->Attack(player, true);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12096_q12092_dummy_SpellScript();
+ }
+};
+
+class spell_q12096_q12092_bark : public SpellScriptLoader // Bark of the Walkers
+{
+public:
+ spell_q12096_q12092_bark() : SpellScriptLoader("spell_q12096_q12092_bark") { }
+
+ class spell_q12096_q12092_bark_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12096_q12092_bark_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ Creature* lothalor = GetHitCreature();
+ if (!lothalor || lothalor->GetEntry() != NPC_LOTHALOR)
+ return;
+
+ lothalor->AI()->Talk(SAY_LOTHALOR);
+ lothalor->RemoveAura(SPELL_CONFUSED);
+ lothalor->DespawnOrUnsummon(4000);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_bark_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12096_q12092_bark_SpellScript();
+ }
+};
+
void AddSC_dragonblight()
{
new npc_alexstrasza_wr_gate;
+ new spell_q12096_q12092_dummy;
+ new spell_q12096_q12092_bark;
}
diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp
index 2da84dd3fdb..4ca12bc82a1 100644
--- a/src/server/scripts/Northrend/grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/grizzly_hills.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*######
@@ -599,100 +600,99 @@ enum eSmokeEmOut
QUEST_SMOKE_EM_OUT_H = 12324,
SPELL_SMOKE_BOMB = 49075,
SPELL_CHOP = 43410,
- NPC_VENTURE_CO_STABLES_KC = 27568,
+ SPELL_VENTURE_STRAGGLER_CREDIT = 49093,
};
class npc_venture_co_straggler : public CreatureScript
{
-public:
- npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_venture_co_stragglerAI(creature);
- }
+ public:
+ npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
- struct npc_venture_co_stragglerAI : public ScriptedAI
- {
- npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
+ struct npc_venture_co_stragglerAI : public ScriptedAI
+ {
+ npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 uiPlayerGUID;
- uint32 uiRunAwayTimer;
- uint32 uiTimer;
- uint32 uiChopTimer;
+ uint64 uiPlayerGUID;
+ uint32 uiRunAwayTimer;
+ uint32 uiTimer;
+ uint32 uiChopTimer;
- void Reset()
- {
- uiPlayerGUID = 0;
- uiTimer = 0;
- uiChopTimer = urand(10000, 12500);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_AGGRESSIVE);
- }
+ void Reset()
+ {
+ uiPlayerGUID = 0;
+ uiTimer = 0;
+ uiRunAwayTimer = 0;
+ uiChopTimer = urand(10000, 12500);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (uiRunAwayTimer <= uiDiff)
+ void UpdateAI(const uint32 uiDiff)
{
- if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
+ if (uiPlayerGUID && uiRunAwayTimer <= uiDiff)
{
- switch (uiTimer)
+ if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
{
- case 0:
- if (player->GetQuestStatus(QUEST_SMOKE_EM_OUT_A) == QUEST_STATUS_INCOMPLETE ||
- player->GetQuestStatus(QUEST_SMOKE_EM_OUT_H) == QUEST_STATUS_INCOMPLETE)
- player->KilledMonsterCredit(NPC_VENTURE_CO_STABLES_KC, 0);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 1:
- DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 2:
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 3:
- me->DisappearAndDie();
- uiTimer = 0;
- break;
+ switch (uiTimer)
+ {
+ case 0:
+ DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 1:
+ DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 2:
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 3:
+ me->DisappearAndDie();
+ uiTimer = 0;
+ break;
+ }
}
}
- }
- else
- uiRunAwayTimer -= uiDiff;
+ else if (uiRunAwayTimer)
+ uiRunAwayTimer -= uiDiff;
- if (!UpdateVictim())
- return;
+ if (!UpdateVictim())
+ return;
- if (uiChopTimer <= uiDiff)
- {
- DoCast(me->getVictim(), SPELL_CHOP);
- uiChopTimer = urand(10000, 12000);
- }
- else
- uiChopTimer -= uiDiff;
+ if (uiChopTimer <= uiDiff)
+ {
+ DoCast(me->getVictim(), SPELL_CHOP);
+ uiChopTimer = urand(10000, 12000);
+ }
+ else
+ uiChopTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
+ DoMeleeAttackIfReady();
+ }
- void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
- {
- if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_PASSIVE);
- me->CombatStop(false);
- uiPlayerGUID = pCaster->GetGUID();
- uiRunAwayTimer = 3500;
+ if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_PASSIVE);
+ me->CombatStop(false);
+ uiPlayerGUID = caster->GetGUID();
+ uiRunAwayTimer = 3500;
+ }
}
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_venture_co_stragglerAI(creature);
}
- };
};
void AddSC_grizzly_hills()
diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp
index 88cc297868b..ffe38d6aade 100644
--- a/src/server/scripts/Northrend/howling_fjord.cpp
+++ b/src/server/scripts/Northrend/howling_fjord.cpp
@@ -27,7 +27,9 @@ npc_plaguehound_tracker
npc_apothecary_hanes
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp
index fb2e0f6c389..5989b5bad2e 100644
--- a/src/server/scripts/Northrend/icecrown.cpp
+++ b/src/server/scripts/Northrend/icecrown.cpp
@@ -27,7 +27,10 @@ EndScriptData */
npc_arete
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellAuras.h"
/*######
## npc_arete
@@ -169,8 +172,7 @@ enum eArgentValiant
{
SPELL_CHARGE = 63010,
SPELL_SHIELD_BREAKER = 65147,
-
- NPC_ARGENT_VALIANT_CREDIT = 24108
+ SPELL_KILL_CREDIT = 63049
};
class npc_argent_valiant : public CreatureScript
@@ -208,7 +210,7 @@ public:
if (uiDamage > me->GetHealth() && pDoneBy->GetTypeId() == TYPEID_PLAYER)
{
uiDamage = 0;
- CAST_PLR(pDoneBy)->KilledMonsterCredit(NPC_ARGENT_VALIANT_CREDIT, 0);
+ pDoneBy->CastSpell(pDoneBy, SPELL_KILL_CREDIT, true);
me->setFaction(35);
me->DespawnOrUnsummon(5000);
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp
index 6d76e348980..1cf8f54b4fe 100644
--- a/src/server/scripts/Northrend/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/isle_of_conquest.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#include "BattlegroundIC.h"
// TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs.
diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp
index 93d0182ea08..56ef25c5753 100644
--- a/src/server/scripts/Northrend/sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/sholazar_basin.cpp
@@ -28,8 +28,11 @@ npc_vekjik
avatar_of_freya
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "SpellScript.h"
/*######
## npc_injured_rainspeaker_oracle
@@ -746,6 +749,130 @@ public:
}
};
+/*######
+## Quest Kick, What Kick? (12589)
+######*/
+
+enum KickWhatKick
+{
+ NPC_LUCKY_WILHELM = 28054,
+ NPC_APPLE = 28053,
+ NPC_DROSTAN = 28328,
+ NPC_CRUNCHY = 28346,
+ NPC_THICKBIRD = 28093,
+
+ SPELL_HIT_APPLE = 51331,
+ SPELL_MISS_APPLE = 51332,
+ SPELL_MISS_BIRD_APPLE = 51366,
+ SPELL_APPLE_FALL = 51371,
+ SPELL_BIRD_FALL = 51369,
+
+ EVENT_MISS = 0,
+ EVENT_HIT = 1,
+ EVENT_MISS_BIRD = 2,
+
+ SAY_WILHELM_MISS = 0,
+ SAY_WILHELM_HIT = 1,
+ SAY_DROSTAN_REPLY_MISS = 0,
+};
+
+class spell_q12589_shoot_rjr : public SpellScriptLoader
+{
+public:
+ spell_q12589_shoot_rjr() : SpellScriptLoader("spell_q12589_shoot_rjr") { }
+
+ class spell_q12589_shoot_rjr_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12589_shoot_rjr_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (Unit* target = GetExplTargetUnit())
+ if (target->GetEntry() == NPC_LUCKY_WILHELM)
+ return SPELL_CAST_OK;
+
+ SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM);
+ return SPELL_FAILED_CUSTOM_ERROR;
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ uint32 roll = urand(1, 100);
+
+ uint8 ev;
+ if (roll <= 50)
+ ev = EVENT_MISS;
+ else if (roll <= 83)
+ ev = EVENT_HIT;
+ else
+ ev = EVENT_MISS_BIRD;
+
+ Unit* shooter = GetCaster();
+ Creature* wilhelm = GetHitUnit()->ToCreature();
+ Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30);
+ Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30);
+
+ if (!wilhelm || !apple || !drostan)
+ return;
+
+ switch (ev)
+ {
+ case EVENT_MISS_BIRD:
+ {
+ Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30);
+ Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30);
+
+ if (!bird || !crunchy)
+ ; // fall to EVENT_MISS
+ else
+ {
+ shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE);
+ bird->CastSpell(bird, SPELL_BIRD_FALL);
+ wilhelm->AI()->Talk(SAY_WILHELM_MISS);
+ drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
+
+ bird->Kill(bird);
+ crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
+ bird->GetMap()->GetWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
+ // TODO: Make crunchy perform emote eat when he reaches the bird
+
+ break;
+ }
+ }
+ case EVENT_MISS:
+ {
+ shooter->CastSpell(wilhelm, SPELL_MISS_APPLE);
+ wilhelm->AI()->Talk(SAY_WILHELM_MISS);
+ drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
+ break;
+ }
+ case EVENT_HIT:
+ {
+ shooter->CastSpell(apple, SPELL_HIT_APPLE);
+ apple->CastSpell(apple, SPELL_APPLE_FALL);
+ wilhelm->AI()->Talk(SAY_WILHELM_HIT);
+ if (Player* player = shooter->ToPlayer())
+ player->KilledMonsterCredit(NPC_APPLE, 0);
+ apple->DespawnOrUnsummon();
+
+ break;
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_q12589_shoot_rjr_SpellScript::CheckCast);
+ OnEffectHitTarget += SpellEffectFn(spell_q12589_shoot_rjr_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12589_shoot_rjr_SpellScript();
+ }
+};
+
void AddSC_sholazar_basin()
{
new npc_injured_rainspeaker_oracle();
@@ -756,4 +883,5 @@ void AddSC_sholazar_basin()
new npc_adventurous_dwarf();
new npc_jungle_punch_target();
new spell_q12620_the_lifewarden_wrath();
+ new spell_q12589_shoot_rjr();
}
diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp
index 251bdb8278a..6bf342e4643 100644
--- a/src/server/scripts/Northrend/storm_peaks.cpp
+++ b/src/server/scripts/Northrend/storm_peaks.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Vehicle.h"
@@ -550,7 +552,7 @@ public:
// drake unsummoned, passengers dropped
if (!me->IsOnVehicle(drake) && !hasEmptySeats)
- me->ForcedDespawn(3000);
+ me->DespawnOrUnsummon(3000);
if (enter_timer <= 0)
return;
@@ -605,7 +607,7 @@ public:
me->ExitVehicle();
me->CastSpell(me, SPELL_SUMMON_LIBERATED, true);
- me->ForcedDespawn(500);
+ me->DespawnOrUnsummon(500);
// drake is empty now, deliver credit for drake and despawn him
if (drake->GetVehicleKit()->HasEmptySeat(1) &&
@@ -616,7 +618,7 @@ public:
if (rider->ToPlayer())
rider->ToPlayer()->KilledMonsterCredit(29709, 0);
- drake->ForcedDespawn(0);
+ drake->DespawnOrUnsummon(0);
}
}
}
diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp
new file mode 100644
index 00000000000..fc967acf9e2
--- /dev/null
+++ b/src/server/scripts/Northrend/wintergrasp.cpp
@@ -0,0 +1,560 @@
+/* Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "BattlefieldMgr.h"
+#include "BattlefieldWG.h"
+#include "Battlefield.h"
+#include "ScriptSystem.h"
+#include "WorldSession.h"
+#include "ObjectMgr.h"
+#include "Vehicle.h"
+#include "GameObjectAI.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+
+#define GOSSIP_HELLO_DEMO1 "Build catapult."
+#define GOSSIP_HELLO_DEMO2 "Build demolisher."
+#define GOSSIP_HELLO_DEMO3 "Build siege engine."
+#define GOSSIP_HELLO_DEMO4 "I cannot build more!"
+
+enum WGqueuenpctext
+{
+ WG_NPCQUEUE_TEXT_H_NOWAR = 14775,
+ WG_NPCQUEUE_TEXT_H_QUEUE = 14790,
+ WG_NPCQUEUE_TEXT_H_WAR = 14777,
+ WG_NPCQUEUE_TEXT_A_NOWAR = 14782,
+ WG_NPCQUEUE_TEXT_A_QUEUE = 14791,
+ WG_NPCQUEUE_TEXT_A_WAR = 14781,
+ WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
+};
+
+enum Spells
+{
+ // Demolisher engineers spells
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE = 61409,
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE = 56662,
+ SPELL_BUILD_CATAPULT_FORCE = 56664,
+ SPELL_BUILD_DEMOLISHER_FORCE = 56659,
+ SPELL_ACTIVATE_CONTROL_ARMS = 49899,
+ SPELL_RIDE_WG_VEHICLE = 60968,
+
+ SPELL_VEHICLE_TELEPORT = 49759,
+
+ // Spirit guide
+ SPELL_CHANNEL_SPIRIT_HEAL = 22011,
+};
+
+enum CreatureIds
+{
+ NPC_GOBLIN_MECHANIC = 30400,
+ NPC_GNOMISH_ENGINEER = 30499,
+
+ NPC_WINTERGRASP_CONTROL_ARMS = 27852,
+
+ NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23472,
+};
+
+enum QuestIds
+{
+ QUEST_BONES_AND_ARROWS_HORDE_ATT = 13193,
+ QUEST_JINXING_THE_WALLS_HORDE_ATT = 13202,
+ QUEST_SLAY_THEM_ALL_HORDE_ATT = 13180,
+ QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT = 13200,
+ QUEST_HEALING_WITH_ROSES_HORDE_ATT = 13201,
+ QUEST_DEFEND_THE_SIEGE_HORDE_ATT = 13223,
+
+ QUEST_BONES_AND_ARROWS_HORDE_DEF = 13199,
+ QUEST_WARDING_THE_WALLS_HORDE_DEF = 13192,
+ QUEST_SLAY_THEM_ALL_HORDE_DEF = 13178,
+ QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF = 13191,
+ QUEST_HEALING_WITH_ROSES_HORDE_DEF = 13194,
+ QUEST_TOPPLING_THE_TOWERS_HORDE_DEF = 13539,
+ QUEST_STOP_THE_SIEGE_HORDE_DEF = 13185,
+
+ QUEST_BONES_AND_ARROWS_ALLIANCE_ATT = 13196,
+ QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT = 13198,
+ QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT = 13179,
+ QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT = 13222,
+ QUEST_A_RARE_HERB_ALLIANCE_ATT = 13195,
+
+ QUEST_BONES_AND_ARROWS_ALLIANCE_DEF = 13154,
+ QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF = 13153,
+ QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF = 13177,
+ QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF = 13538,
+ QUEST_STOP_THE_SIEGE_ALLIANCE_DEF = 13186,
+ QUEST_A_RARE_HERB_ALLIANCE_DEF = 13156,
+};
+
+uint8 const MAX_WINTERGRASP_VEHICLES = 4;
+
+uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] =
+{
+ NPC_WINTERGRASP_CATAPULT,
+ NPC_WINTERGRASP_DEMOLISHER,
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE
+};
+
+class npc_wg_demolisher_engineer : public CreatureScript
+{
+ public:
+ npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+
+ if (canBuild(creature))
+ {
+ if (player->HasAura(SPELL_CORPORAL))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ else if (player->HasAura(SPELL_LIEUTENANT))
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ }
+ }
+ else
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
+
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp= sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+
+ if (canBuild(creature))
+ {
+ switch (action - GOSSIP_ACTION_INFO_DEF)
+ {
+ case 0:
+ creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true);
+ break;
+ case 1:
+ creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true);
+ break;
+ case 2:
+ creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE : SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE, true);
+ break;
+ }
+ if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true))
+ creature->CastSpell(controlArms, SPELL_ACTIVATE_CONTROL_ARMS, true);
+ }
+ return true;
+ }
+
+ private:
+ bool canBuild(Creature* creature)
+ {
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+
+ if (!wintergrasp)
+ return false;
+ switch (creature->GetEntry())
+ {
+ case NPC_GOBLIN_MECHANIC:
+ return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ case NPC_GNOMISH_ENGINEER:
+ return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ default:
+ return false;
+ }
+ }
+};
+
+class npc_wg_spirit_guide : public CreatureScript
+{
+ public:
+ npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
+ for (uint8 i = 0; i < graveyard.size(); i++)
+ if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
+
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender */ , uint32 action)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (wintergrasp)
+ {
+ GraveyardVect gy = wintergrasp->GetGraveyardVector();
+ for (uint8 i = 0; i < gy.size(); i++)
+ if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
+ if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId()))
+ player->TeleportTo(safeLoc->map_id, safeLoc->x, safeLoc->y, safeLoc->z, 0);
+ }
+ return true;
+ }
+
+ struct npc_wg_spirit_guideAI : public ScriptedAI
+ {
+ npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void UpdateAI(uint32 const /*diff*/)
+ {
+ if (!me->HasUnitState(UNIT_STATE_CASTING))
+ DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_wg_spirit_guideAI(creature);
+ }
+};
+
+class npc_wg_queue : public CreatureScript
+{
+ public:
+ npc_wg_queue() : CreatureScript("npc_wg_queue") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (wintergrasp->IsWarTime())
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
+ }
+ else
+ {
+ uint32 timer = wintergrasp->GetTimer() / 1000;
+ player->SendUpdateWorldState(4354, time(NULL) + timer);
+ if (timer < 15 * MINUTE)
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
+ }
+ else
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
+ }
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender*/ , uint32 /*action*/)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (wintergrasp->IsWarTime())
+ wintergrasp->InvitePlayerToWar(player);
+ else
+ {
+ uint32 timer = wintergrasp->GetTimer() / 1000;
+ if (timer < 15 * MINUTE)
+ wintergrasp->InvitePlayerToQueue(player);
+ }
+ return true;
+ }
+};
+
+class go_wg_vehicle_teleporter : public GameObjectScript
+{
+ public:
+ go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") { }
+
+ struct go_wg_vehicle_teleporterAI : public GameObjectAI
+ {
+ go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), _checkTimer(1000) { }
+
+ void UpdateAI(uint32 diff)
+ {
+ if (_checkTimer <= diff)
+ {
+ // Tabulation madness in the hole!
+ for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++)
+ if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true))
+ if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT))
+ if (Vehicle* vehicle = vehicleCreature->GetVehicle())
+ if (Unit* passenger = vehicle->GetPassenger(0))
+ if (go->GetUInt32Value(GAMEOBJECT_FACTION) == passenger->getFaction())
+ if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true))
+ teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
+
+ _checkTimer = 1000;
+ }
+ else _checkTimer -= diff;
+ }
+
+ private:
+ uint32 _checkTimer;
+ };
+
+ GameObjectAI* GetGameObjectAI(GameObject* go) const
+ {
+ return new go_wg_vehicle_teleporterAI(go);
+ }
+};
+
+class npc_wg_quest_giver : public CreatureScript
+{
+ public:
+ npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (creature->isQuestGiver())
+ {
+ QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
+ QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
+
+ QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
+ qm.ClearMenu();
+
+ for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
+ {
+ uint32 questId = i->second;
+ QuestStatus status = player->GetQuestStatus(questId);
+ if (status == QUEST_STATUS_COMPLETE)
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_INCOMPLETE)
+ qm.AddMenuItem(questId, 4);
+ //else if (status == QUEST_STATUS_AVAILABLE)
+ // qm.AddMenuItem(quest_id, 2);
+ }
+
+ for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
+ {
+ uint32 questId = i->second;
+ Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
+ if (!quest)
+ continue;
+
+ switch (questId)
+ {
+ // Horde attacker
+ case QUEST_BONES_AND_ARROWS_HORDE_ATT:
+ case QUEST_JINXING_THE_WALLS_HORDE_ATT:
+ case QUEST_SLAY_THEM_ALL_HORDE_ATT:
+ case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
+ case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
+ case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
+ if (wintergrasp->GetAttackerTeam() == TEAM_HORDE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Horde defender
+ case QUEST_BONES_AND_ARROWS_HORDE_DEF:
+ case QUEST_WARDING_THE_WALLS_HORDE_DEF:
+ case QUEST_SLAY_THEM_ALL_HORDE_DEF:
+ case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
+ case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
+ case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
+ case QUEST_STOP_THE_SIEGE_HORDE_DEF:
+ if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Alliance attacker
+ case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
+ case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
+ case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
+ case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
+ case QUEST_A_RARE_HERB_ALLIANCE_ATT:
+ if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Alliance defender
+ case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
+ case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
+ case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
+ case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
+ case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
+ case QUEST_A_RARE_HERB_ALLIANCE_DEF:
+ if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ default:
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ break;
+ }
+ }
+ }
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+};
+
+class spell_wintergrasp_force_building : public SpellScriptLoader
+{
+ public:
+ spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { }
+
+ class spell_wintergrasp_force_building_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_force_building_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_force_building_SpellScript();
+ }
+};
+
+class spell_wintergrasp_grab_passenger : public SpellScriptLoader
+{
+ public:
+ spell_wintergrasp_grab_passenger() : SpellScriptLoader("spell_wintergrasp_grab_passenger") { }
+
+ class spell_wintergrasp_grab_passenger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* target = GetHitPlayer())
+ target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, true);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_grab_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_grab_passenger_SpellScript();
+ }
+};
+
+class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
+{
+public:
+ achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
+
+ bool OnCheck(Player* source, Unit* target)
+ {
+ if (!target)
+ return false;
+
+ if (Player* victim = target->ToPlayer())
+ {
+ if (!victim->IsMounted())
+ return false;
+
+ if (Vehicle* vehicle = source->GetVehicle())
+ if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
+ return true;
+ }
+
+ return false;
+ }
+};
+
+void AddSC_wintergrasp()
+{
+ new npc_wg_queue();
+ new npc_wg_spirit_guide();
+ new npc_wg_demolisher_engineer();
+ new go_wg_vehicle_teleporter();
+ new npc_wg_quest_giver();
+ new spell_wintergrasp_force_building();
+ new spell_wintergrasp_grab_passenger();
+ new achievement_wg_didnt_stand_a_chance();
+}
diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp
index 369f47cfb1c..6af96f3fdfd 100644
--- a/src/server/scripts/Northrend/zuldrak.cpp
+++ b/src/server/scripts/Northrend/zuldrak.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*####
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
index 1db4fb4dfc9..2a94ddb3134 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPEP.h"
#include "WorldPacket.h"
#include "Player.h"
@@ -26,7 +27,6 @@
#include "Language.h"
#include "World.h"
#include "GossipDef.h"
-#include "ScriptPCH.h"
OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index 06c1813d1dc..a4b506e9271 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPHP.h"
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
@@ -23,7 +24,6 @@
#include "World.h"
#include "ObjectMgr.h"
#include "Language.h"
-#include "ScriptPCH.h"
const uint32 HP_LANG_LOSE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_LOSE_BROKENHILL_A, LANG_OPVP_HP_LOSE_OVERLOOK_A, LANG_OPVP_HP_LOSE_STADIUM_A};
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index f912f25d87f..abf807327e3 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPNA.h"
#include "Player.h"
#include "ObjectMgr.h"
@@ -22,7 +23,6 @@
#include "WorldPacket.h"
#include "Language.h"
#include "World.h"
-#include "ScriptPCH.h"
OutdoorPvPNA::OutdoorPvPNA()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index a69dd3ed874..c70e4168826 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPSI.h"
#include "WorldPacket.h"
#include "Player.h"
@@ -24,7 +25,6 @@
#include "OutdoorPvPMgr.h"
#include "Language.h"
#include "World.h"
-#include "ScriptPCH.h"
OutdoorPvPSI::OutdoorPvPSI()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
index ec0c10f4afe..9572125a4bd 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPTF.h"
#include "OutdoorPvPMgr.h"
#include "OutdoorPvP.h"
@@ -23,7 +24,6 @@
#include "ObjectMgr.h"
#include "Language.h"
#include "World.h"
-#include "ScriptPCH.h"
OutdoorPvPTF::OutdoorPvPTF()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index 38fed30f542..6644dd3f47f 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPZM.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
@@ -24,7 +25,6 @@
#include "WorldPacket.h"
#include "GossipDef.h"
#include "World.h"
-#include "ScriptPCH.h"
OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type)
: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N)
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 ae1a7296de6..a8b4b1797cb 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -29,7 +29,8 @@ boss_exarch_maladaar
mob_avatar_of_martyred
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_MOONFIRE 37328
#define SPELL_FIREBALL 37329
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 5fc912f2a01..f678cf9c198 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
@@ -23,7 +23,8 @@ Comment: InhibitMagic should stack slower far from the boss, proper Visual for F
Category: Auchindoun, Auchenai Crypts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_INHIBITMAGIC 32264
#define SPELL_ATTRACTMAGIC 32265
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
index a4bba5f28fb..351f30c926f 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
@@ -28,7 +28,8 @@ boss_nexusprince_shaffar
mob_ethereal_beacon
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum ePrince
{
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
index 487a1dd41ea..459ba3a8f86 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
@@ -23,7 +23,8 @@ SDComment: Not known how void blast is done (amount of rapid cast seems to be re
SDCategory: Auchindoun, Mana Tombs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_AGGRO_1 -1557008
#define SAY_AGGRO_2 -1557009
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
index 37544f9377b..0a85cf1dc5b 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
@@ -23,7 +23,8 @@ SDComment: Shock spells/times need more work. Heroic partly implemented.
SDCategory: Auchindoun, Sethekk Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_SUMMON -1556000
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
index 768c4bf12d3..ec35d6c80b3 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
@@ -23,7 +23,8 @@ SDComment: Heroic supported. Some details missing, but most are spell related.
SDCategory: Auchindoun, Sethekk Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sethekk_halls.h"
#define SAY_INTRO -1556007
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
index 02c5a035375..f57bed1207b 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
@@ -23,7 +23,8 @@ SDComment: Instance Data for Sethekk Halls instance
SDCategory: Auchindoun, Sethekk Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "sethekk_halls.h"
enum eEnums
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
index d92e76685d1..a109e3738b1 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
@@ -23,7 +23,8 @@ SDComment: Enrage spell missing/not known
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "shadow_labyrinth.h"
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
index 6eac36f71c8..e7063e479ee 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp
@@ -23,7 +23,8 @@ SDComment: Incite Chaos not functional since core lacks Mind Control support
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
#define SPELL_INCITE_CHAOS 33676
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
index 8d971c37559..a1780d1d4a8 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
#define SAY_INTRO -1555028
@@ -170,6 +171,7 @@ public:
summonTraveler_Timer = 90000;
banish_Timer = 17000;
HelpYell = false;
+ sumportals = false;
destroyPortals();
if (instance)
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
index 99661d8818c..4f8fc917424 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
@@ -23,7 +23,8 @@ SDComment: Timers may be incorrect
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
#define EMOTE_SONIC_BOOM -1555036
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
index 846669552ba..9facb42107b 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
@@ -23,7 +23,8 @@ SDComment: Some cleanup left along with save
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "shadow_labyrinth.h"
#define MAX_ENCOUNTER 5
@@ -109,7 +110,7 @@ public:
if (creature->isAlive())
{
++m_uiFelOverseerCount;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount);
}
break;
}
@@ -126,7 +127,7 @@ public:
case TYPE_OVERSEER:
if (uiData != DONE)
{
- sLog->outError("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE");
+ sLog->outError(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE");
return;
}
if (m_uiFelOverseerCount)
@@ -134,11 +135,11 @@ public:
--m_uiFelOverseerCount;
if (m_uiFelOverseerCount)
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount);
else
{
m_auiEncounter[1] = DONE;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE");
+ sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER == DONE");
}
}
break;
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
index 546f9ee1e7d..5fe5b8aab0c 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
@@ -27,7 +27,9 @@ EndScriptData */
npc_spirit_of_olum
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+ #include "ScriptedGossip.h"
#include "black_temple.h"
/*###
diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
index caac89da765..fd775df3392 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
@@ -23,7 +23,8 @@ SDComment: Bloodboil not working correctly, missing enrage
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
//Speech'n'Sound
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 1926929c97c..6fd6f61c061 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -23,7 +23,10 @@ SDComment: Somewhat of a workaround for Parasitic Shadowfiend, unable to summon
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "PassiveAI.h"
#include "black_temple.h"
#define GETGO(obj, guid) GameObject* obj = instance->instance->GetGameObject(guid)
@@ -795,7 +798,7 @@ public:
{
EnterEvadeMode();
me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, 0);
- sLog->outError("SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)");
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)");
}
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index 4e4607a7d44..1b2fe61e87c 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -23,7 +23,8 @@ SDComment: Saber Lash missing, Fatal Attraction slightly incorrect; need to dama
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
//Speech'n'Sounds
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 c5e78f2fa7b..44c37fc9753 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
#include "Spell.h"
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 630e44429fa..2757a862c93 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -23,7 +23,9 @@ SDComment: Seems to be complete.
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "black_temple.h"
#define SAY_DEATH -1564013
@@ -320,7 +322,7 @@ public:
GridSearcherSucceeded = true;
}
}
- } else sLog->outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
+ } else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
}
}
@@ -338,13 +340,13 @@ public:
if (reseting)
return;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Increasing Death Count for Shade of Akama encounter");
+ sLog->outDebug(LOG_FILTER_TSCR, "Increasing Death Count for Shade of Akama encounter");
++DeathCount;
me->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2);
if (guid)
{
if (Sorcerers.empty())
- sLog->outError("SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid);
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid);
else Sorcerers.remove(guid);
}
}
@@ -396,17 +398,17 @@ public:
{
CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID();
Channelers.push_back((*itr)->GetGUID());
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID());
+ sLog->outDebug(LOG_FILTER_TSCR, "Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID());
}
}
- else sLog->outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy");
+ else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy");
}
void SetSelectableChannelers()
{
if (Channelers.empty())
{
- sLog->outError("SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy");
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy");
return;
}
@@ -532,7 +534,7 @@ void mob_ashtongue_channeler::mob_ashtongue_channelerAI::JustDied(Unit* /*killer
Creature* Shade = (Unit::GetCreature((*me), ShadeGUID));
if (Shade && Shade->isAlive())
CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount();
- else sLog->outError("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
+ else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
}
void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/)
@@ -540,7 +542,7 @@ void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/
Creature* Shade = (Unit::GetCreature((*me), ShadeGUID));
if (Shade && Shade->isAlive())
CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(me->GetGUID());
- else sLog->outError("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama.");
+ else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama.");
}
class npc_akama_shade : public CreatureScript
diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
index ce1732433c8..e34a229eea5 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
@@ -23,7 +23,9 @@ SDComment: Need to implement molten punch
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#include "black_temple.h"
#define EMOTE_NEW_TARGET -1564010
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index bc12a6c1c6c..524992b3c44 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -23,7 +23,8 @@ SDComment: Requires Mind Control support for Ghosts.
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
//Speech'n'sound
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 5b2bb8e7bf5..e8bee95865f 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
enum eEnums
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 0742f174ccf..710f5c82fab 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -23,7 +23,10 @@ SDComment: Circle of Healing not working properly.
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "black_temple.h"
//Speech'n'Sounds
@@ -156,7 +159,7 @@ public:
Council[1] = instance->GetData64(DATA_VERASDARKSHADOW);
Council[2] = instance->GetData64(DATA_LADYMALANDE);
Council[3] = instance->GetData64(DATA_HIGHNETHERMANCERZEREVOR);
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
}
void EnterCombat(Unit* /*who*/) {}
@@ -403,7 +406,7 @@ struct boss_illidari_councilAI : public ScriptedAI
}
else
{
- sLog->outError(ERROR_INST_DATA);
+ sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
EnterEvadeMode();
return;
}
@@ -451,7 +454,7 @@ struct boss_illidari_councilAI : public ScriptedAI
{
if (!instance)
{
- sLog->outError(ERROR_INST_DATA);
+ sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
return;
}
diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
index 49bce6d82c0..98d90aa1818 100644
--- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
@@ -23,7 +23,8 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "black_temple.h"
#define MAX_ENCOUNTER 9
@@ -137,7 +138,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Black Temple: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
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 206ba3d9455..a5737714e71 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -23,7 +23,8 @@ SDComment: Cyclone workaround
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "ScriptedEscortAI.h"
@@ -691,7 +692,7 @@ public:
Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000);
if (Cyclone)
{
- CAST_CRE(Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f);
+ CAST_CRE(Cyclone)->SetObjectScale(3.0f);
Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Cyclone->setFaction(me->getFaction());
Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true);
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 7abd2bbc8a8..bad10752db3 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
@@ -23,7 +23,8 @@ SDComment: Some details and adjustments left to do, probably nothing major. Spaw
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#define SAY_AGGRO -1548000
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 18d8b2b5a1e..3b94feda02b 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -23,7 +23,8 @@ SDComment: Missing blizzlike Shield Generators coords
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "Spell.h"
@@ -199,7 +200,7 @@ public:
JustCreated = false;
} else CanAttack = true;
-
+
for (uint8 i = 0; i < 4; ++i)
if (Unit* remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i]))
remo->setDeathState(JUST_DIED);
@@ -353,7 +354,7 @@ public:
// Static Charge
// Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);
- if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
+ if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds
StaticChargeTimer = 10000+rand()%20000;
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 4876410890c..81e03a19c1f 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
@@ -23,7 +23,8 @@ SDComment: Possesion Support
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
// --- Spells used by Leotheras The Blind
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
index 00de1802bc9..b9e530996af 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -23,7 +23,8 @@ SDComment: Coilfang Frenzy, find out how could we fishing in the strangepool
SDCategory: The Lurker Below
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "Spell.h"
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
index 865fb143800..32f03d4d1f9 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -23,7 +23,8 @@ SDComment: Water globules don't explode properly, remove hacks
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
enum eEnums
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
index 3ed3d1a82de..87053d1de1c 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -23,7 +23,8 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "serpent_shrine.h"
#define MAX_ENCOUNTER 6
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
index 48c5a360619..038300213a4 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
@@ -28,7 +28,8 @@ boss_hydromancer_thespia
mob_coilfang_waterelemental
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "steam_vault.h"
#define SAY_SUMMON -1545000
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
index 739168863f4..50cc913c669 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
@@ -28,7 +28,8 @@ boss_mekgineer_steamrigger
mob_steamrigger_mechanic
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "steam_vault.h"
#define SAY_MECHANICS -1545007
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
index cae1117805a..d81a021c4bc 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
@@ -23,7 +23,8 @@ SDComment: Contains workarounds regarding warlord's rage spells not acting as ex
SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "steam_vault.h"
#define SAY_INTRO -1545016
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
index 51032fd70ed..dd0b5ea9160 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -23,7 +23,8 @@ SDComment: Instance script and access panel GO
SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "steam_vault.h"
#define MAX_ENCOUNTER 4
@@ -138,7 +139,7 @@ public:
if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL)
HandleGameObject(MainChambersDoor, true);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Steamvault: Access panel used.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used.");
}
m_auiEncounter[0] = data;
break;
@@ -150,7 +151,7 @@ public:
if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL)
HandleGameObject(MainChambersDoor, true);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Steamvault: Access panel used.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used.");
}
m_auiEncounter[1] = data;
break;
@@ -199,16 +200,12 @@ public:
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
+
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
index 42d617992ed..54823687e5e 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
@@ -23,7 +23,8 @@ SDComment: Need confirmation if spell data are same in both modes. Summons shoul
SDCategory: Coilfang Resevoir, Underbog
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_FOUL_SPORES 31673
#define SPELL_ACID_GEYSER 38739
diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp
index f7079e5c664..4006e756ca2 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp
@@ -23,7 +23,8 @@ SDComment: Timers may be incorrect
SDCategory: Coilfang Resevoir, Underbog
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_LEVITATE 31704
#define SPELL_SUSPENSION 31719
diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
index 0e654ade995..3443103fa70 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
@@ -19,11 +19,13 @@
/* ScriptData
SDName: Boss_Gruul
SD%Complete: 60
-SDComment: Ground Slam need further development (knock back effect and shatter effect must be added to the core)
+SDComment: Ground Slam need further development (knock back effect must be added to the core)
SDCategory: Gruul's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "gruuls_lair.h"
enum eEnums
@@ -144,12 +146,7 @@ public:
//this part should be in the core
if (pSpell->Id == SPELL_SHATTER)
{
- //this spell must have custom handling in the core, dealing damage based on distance
- target->CastSpell(target, SPELL_SHATTER_EFFECT, true);
-
- if (target->HasAura(SPELL_STONED))
- target->RemoveAurasDueToSpell(SPELL_STONED);
-
+ // todo: use eventmap to kill this stuff
//clear this, if we are still performing
if (m_bPerformingGroundSlam)
{
@@ -258,7 +255,83 @@ public:
};
+class spell_gruul_shatter : public SpellScriptLoader
+{
+ public:
+ spell_gruul_shatter() : SpellScriptLoader("spell_gruul_shatter") { }
+
+ class spell_gruul_shatter_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gruul_shatter_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_STONED))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_SHATTER_EFFECT))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ target->RemoveAurasDueToSpell(SPELL_STONED);
+ target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gruul_shatter_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gruul_shatter_SpellScript();
+ }
+};
+
+class spell_gruul_shatter_effect : public SpellScriptLoader
+{
+ public:
+ spell_gruul_shatter_effect() : SpellScriptLoader("spell_gruul_shatter_effect") { }
+
+ class spell_gruul_shatter_effect_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gruul_shatter_effect_SpellScript);
+
+ void CalculateDamage()
+ {
+ if (!GetHitUnit())
+ return;
+
+ float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster());
+ if (!radius)
+ return;
+
+ float distance = GetCaster()->GetDistance2d(GetHitUnit());
+ if (distance > 1.0f)
+ SetHitDamage(int32(GetHitDamage() * ((radius - distance) / radius)));
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_gruul_shatter_effect_SpellScript::CalculateDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gruul_shatter_effect_SpellScript();
+ }
+};
+
void AddSC_boss_gruul()
{
new boss_gruul();
+ new spell_gruul_shatter();
+ new spell_gruul_shatter_effect();
}
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 0f42b1b7e53..03089d646f9 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -23,7 +23,8 @@ SDComment: Correct timers, after whirlwind melee attack bug, prayer of healing
SDCategory: Gruul's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gruuls_lair.h"
#define SAY_AGGRO -1565000
diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
index 3514732b53a..fa67659ca66 100644
--- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
+++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Gruul's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "gruuls_lair.h"
#define MAX_ENCOUNTER 2
@@ -170,15 +171,9 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index f6b7518661e..3a2e0834fed 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -23,7 +23,8 @@ SDComment: pre-event not made
SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blood_furnace.h"
enum eEnums
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 01873afeaa9..a0bcc396fdb 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
@@ -28,7 +28,9 @@ boss_kelidan_the_breaker
mob_shadowmoon_channeler
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "blood_furnace.h"
enum eKelidan
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
index dc9f83b073d..df9aefabe15 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
@@ -23,7 +23,8 @@ SDComment: Mind control no support
SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blood_furnace.h"
enum eEnums
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
index d9f6b7e303e..4c434feb4ec 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "blood_furnace.h"
#define ENTRY_SEWER1 181823
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
index 2ab2b2b5b2e..714ea275471 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
@@ -23,7 +23,8 @@ SDComment: Temporary solution for orbital/shadow whip-ability. Needs more core s
SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
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 a5cdebea754..3bb0858d2be 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
@@ -23,7 +23,8 @@ Comment:
Category: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSpells
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
index 2c00a68321a..1d2ecccf3c7 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
@@ -23,7 +23,8 @@ SDComment: Missing adds to heal him. Surge should be used on target furthest awa
SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
index 3dab24eab1b..ba7b5afb4c8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "hellfire_ramparts.h"
class instance_ramparts : public InstanceMapScript
@@ -66,7 +67,7 @@ class instance_ramparts : public InstanceMapScript
void SetData(uint32 uiType, uint32 uiData)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Ramparts: SetData received for type %u with data %u", uiType, uiData);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Ramparts: SetData received for type %u with data %u", uiType, uiData);
switch (uiType)
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 1b29abf1afc..bbf03e39f9b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -23,7 +23,8 @@ SDComment: In Development
SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magtheridons_lair.h"
struct Yell
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
index cb55d627f7d..640e4439593 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "magtheridons_lair.h"
enum eSpells
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 7dfdc40a787..c6434d9a989 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -29,7 +29,8 @@ mob_fel_orc_convert
mob_lesser_shadow_fissure
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shattered_halls.h"
struct Say
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 5371473e21e..3d2d39e9817 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -28,7 +28,8 @@ mob_omrogg_heads
boss_warbringer_omrogg
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shattered_halls.h"
enum eEnums
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 c1489671292..99f7c69aff2 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
@@ -27,7 +27,8 @@ EndScriptData */
boss_warchief_kargath_bladefist
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
index cc36bf9a385..4105a7d5821 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
@@ -23,7 +23,8 @@ SDComment: currently missing info about door. instance not complete
SDCategory: Hellfire Citadel, Shattered Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "shattered_halls.h"
#define MAX_ENCOUNTER 2
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index 77c07f5fe4d..3770ac3ba09 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
enum eSpells
@@ -409,7 +410,7 @@ class boss_alar : public CreatureScript
if (Summoned)
{
Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- Summoned->SetFloatValue(OBJECT_FIELD_SCALE_X, Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f);
+ Summoned->SetObjectScale(Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f);
Summoned->SetDisplayId(11686);
Summoned->setFaction(me->getFaction());
Summoned->SetLevel(me->getLevel());
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index c0203150789..5b5c3ff2326 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "the_eye.h"
@@ -140,7 +141,7 @@ class boss_high_astromancer_solarian : public CreatureScript
me->SetArmor(defaultarmor);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisible(true);
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize);
+ me->SetObjectScale(defaultsize);
me->SetDisplayId(MODEL_HUMAN);
Summons.DespawnAll();
@@ -153,7 +154,7 @@ class boss_high_astromancer_solarian : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize);
+ me->SetObjectScale(defaultsize);
me->SetDisplayId(MODEL_HUMAN);
DoScriptText(SAY_DEATH, me);
if (instance)
@@ -397,7 +398,7 @@ class boss_high_astromancer_solarian : public CreatureScript
DoScriptText(SAY_VOIDB, me);
me->SetArmor(WV_ARMOR);
me->SetDisplayId(MODEL_VOIDWALKER);
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize*2.5f);
+ me->SetObjectScale(defaultsize*2.5f);
}
DoMeleeAttackIfReady();
}
@@ -501,9 +502,9 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
public:
spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { }
- class spell_astromancer_wrath_of_the_astromancer_SpellScript : public SpellScript
+ class spell_astromancer_wrath_of_the_astromancer_AuraScript : public AuraScript
{
- PrepareSpellScript(spell_astromancer_wrath_of_the_astromancer_SpellScript);
+ PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer_AuraScript);
bool Validate(SpellInfo const* /*SpellEntry*/)
{
@@ -512,50 +513,25 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
return true;
}
- bool Load()
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- _targetCount = 0;
- return true;
- }
-
- void CountTargets(std::list<Unit*>& targetList)
- {
- _targetCount = targetList.size();
- }
-
- void HandleDummy(SpellEffIndex /* effIndex */)
- {
- if (Unit* caster = GetOriginalCaster())
- if (Unit* target = GetHitUnit())
- {
- if (!target->isAlive() || !_targetCount)
- return;
-
- int32 damage = 10000 / _targetCount;
-
- SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
- damageInfo.damage = damage;
+ // Final heal only on duration end
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ return;
- caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo());
- caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb);
- caster->SendSpellNonMeleeDamageLog(&damageInfo);
- caster->DealSpellDamage(&damageInfo, false);
- }
+ Unit* target = GetUnitOwner();
+ target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(),false);
}
- private:
- int32 _targetCount;
-
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
- SpellScript* GetSpellScript() const
+ AuraScript* GetAuraScript() const
{
- return new spell_astromancer_wrath_of_the_astromancer_SpellScript();
+ return new spell_astromancer_wrath_of_the_astromancer_AuraScript();
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 1d8c7e71bef..f60cc1d188c 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -23,7 +23,8 @@ SDComment: SQL, weapon scripts, mind control, need correct spells(interruptible/
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
#include "WorldPacket.h"
@@ -365,7 +366,7 @@ class boss_kaelthas : public CreatureScript
if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3])
{
- sLog->outError("TSCR: Kael'Thas One or more advisors missing, Skipping Phases 1-3");
+ sLog->outError(LOG_FILTER_TSCR, "Kael'Thas One or more advisors missing, Skipping Phases 1-3");
DoScriptText(SAY_PHASE4_INTRO2, me);
@@ -693,7 +694,7 @@ class boss_kaelthas : public CreatureScript
Advisor = Unit::GetCreature((*me), m_auiAdvisorGuid[i]);
if (!Advisor)
- sLog->outError("SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i);
+ sLog->outError(LOG_FILTER_TSCR, "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i);
else
CAST_AI(advisorbase_ai, Advisor->AI())->Revive(target);
}
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 275a72e75ac..2c778485131 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -23,7 +23,8 @@ SDComment: Should reset if raid are out of room.
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
enum eEnums
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
index f25b6749055..1230b7e88cf 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "the_eye.h"
#define MAX_ENCOUNTER 5
@@ -165,16 +166,12 @@ class instance_the_eye : public InstanceMapScript
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
+
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
index 421f9f2f545..a38ad1d734e 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
@@ -27,7 +27,8 @@ EndScriptData */
mob_crystalcore_devastator
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
enum eSpells
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
index 4d579ac8c16..1d816f1eee3 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
@@ -23,7 +23,8 @@ SDComment: Place Holder
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//not used
#define SAY_AGGRO -1554000
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
index a1287a57402..83acc1258be 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp
index 3579a7d697b..d2b0475fa77 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp
@@ -18,6 +18,7 @@
//! TODO - Boss not scripted, just ported required spellscript from core
#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
enum Spells
@@ -52,10 +53,10 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader
return true;
}
- void HandleTargets(std::list<Unit*>& targetList)
+ void HandleTargets(std::list<WorldObject*>& targetList)
{
uint8 count = 0;
- for (std::list<Unit*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
+ for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
if (Player* target = (*ihit)->ToPlayer())
if (target->HasAura(GetTriggeringSpell()->Id))
@@ -88,7 +89,7 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
index 59837fdbed1..02be844711d 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
@@ -23,7 +23,8 @@ SDComment: Need adjustments to initial summons
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "mechanar.h"
enum eSays
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
index 3a4d449707d..622e6e6d7e6 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
@@ -23,7 +23,8 @@ SDComment: Event missing. Script for himself 99% blizzlike.
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
index ad3c899237f..a96666705d1 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "mechanar.h"
#define MAX_ENCOUNTER 1
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index d675b438968..f45ece47220 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -29,7 +29,8 @@ npc_warden_mellichar
mob_zerekethvoidzone
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "arcatraz.h"
/*#####
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
index c2eeaf9fe7a..730bab7e626 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
@@ -28,7 +28,8 @@ boss_harbinger_skyriss
boss_harbinger_skyriss_illusion
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "arcatraz.h"
enum eSays
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
index ffe96fb7bd1..d5b61b87fc2 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
@@ -23,7 +23,8 @@ SDComment: Mainly Harbringer Skyriss event
SDCategory: Tempest Keep, The Arcatraz
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "arcatraz.h"
#define MAX_ENCOUNTER 9
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 ba61a1bfb12..a53f62c96f4 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
@@ -23,7 +23,8 @@ SDComment: some strange visual related to tree form(if aura lost before normal d
SDCategory: Tempest Keep, The Botanica
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
index e8188f892b3..ed04c42edc7 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
@@ -23,7 +23,8 @@ SDComment: Immunities are wrong, must be adjusted to use resistance from creatur
SDCategory: Tempest Keep, The Botanica
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSpells
{
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 3acde2455db..e3b1a7e94e1 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -23,7 +23,8 @@ SDComment: Includes Sapling (need some better control with these).
SDCategory: Tempest Keep, The Botanica
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp
index 7a371170d7d..c263ac85ef5 100644
--- a/src/server/scripts/Outland/blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/blades_edge_mountains.cpp
@@ -33,7 +33,13 @@ go_legion_obelisk
go_thunderspike
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
//Support for quest: You're Fired! (10821)
bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five;
@@ -651,7 +657,7 @@ class npc_simon_bunny : public CreatureScript
{
_events.Update(diff);
- switch(_events.ExecuteEvent())
+ switch (_events.ExecuteEvent())
{
case EVENT_SIMON_PERIODIC_PLAYER_CHECK:
if (!CheckPlayer())
@@ -774,7 +780,7 @@ class npc_simon_bunny : public CreatureScript
colorSequence.clear();
playableSequence.clear();
playerSequence.clear();
- me->SetFloatValue(OBJECT_FIELD_SCALE_X, large ? 2.0f : 1.0f);
+ me->SetObjectScale(large ? 2.0f : 1.0f);
std::list<WorldObject*> ClusterList;
Trinity::AllWorldObjectsInRange objects(me, searchDistance);
@@ -855,7 +861,7 @@ class npc_simon_bunny : public CreatureScript
if (GameObject* relic = me->FindNearestGameObject(large ? GO_APEXIS_MONUMENT : GO_APEXIS_RELIC, searchDistance))
relic->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
- me->ForcedDespawn(1000);
+ me->DespawnOrUnsummon(1000);
}
/*
diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
index 147d2d60359..96897ae3033 100644
--- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
+++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
@@ -16,7 +16,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuraEffects.h"
+#include "SpellScript.h"
enum Texts
{
@@ -31,15 +34,16 @@ enum Texts
enum Spells
{
- SPELL_SHADOWVOLLEY = 32963,
+ SPELL_SHADOW_VOLLEY = 32963,
SPELL_CLEAVE = 31779,
SPELL_THUNDERCLAP = 36706,
- SPELL_VOIDBOLT = 39329,
- SPELL_MARKOFKAZZAK = 32960,
- SPELL_MARKOFKAZZAK_DAMAGE = 32961,
+ SPELL_VOID_BOLT = 39329,
+ SPELL_MARK_OF_KAZZAK = 32960,
+ SPELL_MARK_OF_KAZZAK_DAMAGE = 32961,
SPELL_ENRAGE = 32964,
- SPELL_CAPTURESOUL = 32966,
- SPELL_TWISTEDREFLECTION = 21063
+ SPELL_CAPTURE_SOUL = 32966,
+ SPELL_TWISTED_REFLECTION = 21063,
+ SPELL_BERSERK = 32965,
};
enum Events
@@ -47,10 +51,11 @@ enum Events
EVENT_SHADOW_VOLLEY = 1,
EVENT_CLEAVE = 2,
EVENT_THUNDERCLAP = 3,
- EVENT_VOIDBOLT = 4,
+ EVENT_VOID_BOLT = 4,
EVENT_MARK_OF_KAZZAK = 5,
EVENT_ENRAGE = 6,
- EVENT_TWISTED_REFLECTION = 7
+ EVENT_TWISTED_REFLECTION = 7,
+ EVENT_BERSERK = 8
};
class boss_doomlord_kazzak : public CreatureScript
@@ -70,10 +75,11 @@ class boss_doomlord_kazzak : public CreatureScript
_events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(6000, 10000));
_events.ScheduleEvent(EVENT_CLEAVE, 7000);
_events.ScheduleEvent(EVENT_THUNDERCLAP, urand(14000, 18000));
- _events.ScheduleEvent(EVENT_VOIDBOLT, 30000);
+ _events.ScheduleEvent(EVENT_VOID_BOLT, 30000);
_events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 25000);
_events.ScheduleEvent(EVENT_ENRAGE, 60000);
_events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 33000);
+ _events.ScheduleEvent(EVENT_BERSERK, 180000);
}
void JustRespawned()
@@ -92,7 +98,7 @@ class boss_doomlord_kazzak : public CreatureScript
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
- DoCast(me, SPELL_CAPTURESOUL);
+ DoCast(me, SPELL_CAPTURE_SOUL);
Talk(SAY_KILL);
}
@@ -118,7 +124,7 @@ class boss_doomlord_kazzak : public CreatureScript
switch (eventId)
{
case EVENT_SHADOW_VOLLEY:
- DoCastVictim(SPELL_SHADOWVOLLEY);
+ DoCastVictim(SPELL_SHADOW_VOLLEY);
_events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(4000, 6000));
break;
case EVENT_CLEAVE:
@@ -129,13 +135,13 @@ class boss_doomlord_kazzak : public CreatureScript
DoCastVictim(SPELL_THUNDERCLAP);
_events.ScheduleEvent(EVENT_THUNDERCLAP, urand(10000, 14000));
break;
- case EVENT_VOIDBOLT:
- DoCastVictim(SPELL_VOIDBOLT);
- _events.ScheduleEvent(EVENT_VOIDBOLT, urand(15000, 18000));
+ case EVENT_VOID_BOLT:
+ DoCastVictim(SPELL_VOID_BOLT);
+ _events.ScheduleEvent(EVENT_VOID_BOLT, urand(15000, 18000));
break;
case EVENT_MARK_OF_KAZZAK:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
- DoCast(target, SPELL_MARKOFKAZZAK);
+ DoCast(target, SPELL_MARK_OF_KAZZAK);
_events.ScheduleEvent(EVENT_MARK_OF_KAZZAK, 20000);
break;
case EVENT_ENRAGE:
@@ -145,9 +151,12 @@ class boss_doomlord_kazzak : public CreatureScript
break;
case EVENT_TWISTED_REFLECTION:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
- DoCast(target, SPELL_TWISTEDREFLECTION);
+ DoCast(target, SPELL_TWISTED_REFLECTION);
_events.ScheduleEvent(EVENT_TWISTED_REFLECTION, 15000);
break;
+ case EVENT_BERSERK:
+ DoCast(me, SPELL_BERSERK);
+ break;
default:
break;
}
@@ -166,7 +175,55 @@ class boss_doomlord_kazzak : public CreatureScript
}
};
+class spell_mark_of_kazzak : public SpellScriptLoader
+{
+ public:
+ spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { }
+
+ class spell_mark_of_kazzak_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_mark_of_kazzak_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_KAZZAK_DAMAGE))
+ return false;
+ return true;
+ }
+
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* owner = GetUnitOwner())
+ amount = CalculatePctU(owner->GetPower(POWER_MANA), 5);
+ }
+
+ void OnPeriodic(AuraEffect const* aurEff)
+ {
+ Unit* target = GetTarget();
+
+ if (target->GetPower(POWER_MANA) == 0)
+ {
+ target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, NULL, aurEff);
+ // Remove aura
+ SetDuration(0);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_mark_of_kazzak_AuraScript();
+ }
+};
+
void AddSC_boss_doomlordkazzak()
{
new boss_doomlord_kazzak();
+ new spell_mark_of_kazzak();
}
diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp
index 67834601d6f..ae3bd283db4 100644
--- a/src/server/scripts/Outland/boss_doomwalker.cpp
+++ b/src/server/scripts/Outland/boss_doomwalker.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp
index b0e19f0e322..4c44d4e828e 100644
--- a/src/server/scripts/Outland/hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/hellfire_peninsula.cpp
@@ -33,7 +33,9 @@ npc_trollbane
npc_wounded_blood_elf
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
@@ -158,7 +160,7 @@ public:
if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
Start(false, false, creature->GetOwner()->GetGUID());
else
- sLog->outError("TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player.");
+ sLog->outError(LOG_FILTER_TSCR, "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player.");
creature->SetSpeed(MOVE_WALK, 1.5f);
Reset();
diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp
index 8080a1402af..977ec57e2df 100644
--- a/src/server/scripts/Outland/nagrand.cpp
+++ b/src/server/scripts/Outland/nagrand.cpp
@@ -28,8 +28,9 @@ npc_greatmother_geyah
npc_maghar_captive
npc_creditmarker_visit_with_ancestors
EndContentData */
-
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
@@ -450,7 +451,7 @@ public:
{
if (Say_Timer <= diff)
{
- me->ForcedDespawn();
+ me->DespawnOrUnsummon();
ReleasedFromCage = false;
}
else
@@ -689,7 +690,7 @@ class go_warmaul_prison : public GameObjectScript
player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
prisoner->AI()->Talk(SAY_FREE, player->GetGUID());
- prisoner->ForcedDespawn(6000);
+ prisoner->DespawnOrUnsummon(6000);
}
return true;
}
diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp
index 388d18697b9..480275c42bd 100644
--- a/src/server/scripts/Outland/netherstorm.cpp
+++ b/src/server/scripts/Outland/netherstorm.cpp
@@ -32,7 +32,9 @@ npc_maxx_a_million
go_captain_tyralius_prison
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
@@ -496,7 +498,7 @@ public:
return true;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_commander_dawnforge event already in progress, need to wait.");
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_commander_dawnforge event already in progress, need to wait.");
return false;
}
@@ -777,10 +779,10 @@ public:
PlayerGUID = who->GetGUID();
}
- void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/)
- {
- DoCast(me, SPELL_DE_MATERIALIZE);
- }
+ //void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/)
+ //{
+ // DoCast(me, SPELL_DE_MATERIALIZE);
+ //}
void UpdateAI(const uint32 diff)
{
@@ -1057,7 +1059,7 @@ class go_captain_tyralius_prison : public GameObjectScript
player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS, 0);
tyralius->AI()->Talk(SAY_FREE);
- tyralius->ForcedDespawn(8000);
+ tyralius->DespawnOrUnsummon(8000);
}
return true;
}
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 340049ba4fa..c79bf74aab6 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -40,7 +40,9 @@ go_crystal_prison
npc_enraged_spirit
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp
index 79cce47e16c..8ad2c311fc5 100644
--- a/src/server/scripts/Outland/shattrath_city.cpp
+++ b/src/server/scripts/Outland/shattrath_city.cpp
@@ -34,7 +34,9 @@ npc_ishanah
npc_khadgar
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp
index 6c2214cde37..707cabfcf0c 100644
--- a/src/server/scripts/Outland/terokkar_forest.cpp
+++ b/src/server/scripts/Outland/terokkar_forest.cpp
@@ -33,7 +33,9 @@ npc_isla_starmane
npc_slim
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp
index 90ce070ecc7..aa51b532c27 100644
--- a/src/server/scripts/Outland/zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zangarmarsh.cpp
@@ -32,7 +32,9 @@ npc_kayra_longmane
npc_timothy_daniels
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
/*######
diff --git a/src/server/scripts/Spells/CMakeLists.txt b/src/server/scripts/Spells/CMakeLists.txt
index 04dcee9287c..2bb695bd8a9 100644
--- a/src/server/scripts/Spells/CMakeLists.txt
+++ b/src/server/scripts/Spells/CMakeLists.txt
@@ -24,6 +24,7 @@ set(scripts_STAT_SRCS
Spells/spell_paladin.cpp
Spells/spell_item.cpp
Spells/spell_holiday.cpp
+ Spells/spell_pet.cpp
)
message(" -> Prepared: Spells")
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 5d874faf411..a1c48878507 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -40,6 +40,8 @@ enum DeathKnightSpells
DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611,
DK_SPELL_UNHOLY_PRESENCE = 48265,
DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622,
+ SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736,
+ DK_SPELL_BLACK_ICE_R1 = 49140,
};
// 50462 - Anti-Magic Shell (on raid member)
@@ -111,8 +113,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
- // Set absorbtion amount to unlimited
- amount = -1;
+ amount = GetCaster()->CountPctFromMaxHealth(hpPct);
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
@@ -334,16 +335,30 @@ class spell_dk_death_pact : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_death_pact_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ SpellCastResult CheckCast()
+ {
+ // Check if we have valid targets, otherwise skip spell casting here
+ if (Player* player = GetCaster()->ToPlayer())
+ for (Unit::ControlList::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
+ if (Creature* undeadPet = (*itr)->ToCreature())
+ if (undeadPet->isAlive() &&
+ undeadPet->GetOwnerGUID() == player->GetGUID() &&
+ undeadPet->GetCreatureType() == CREATURE_TYPE_UNDEAD &&
+ undeadPet->IsWithinDist(player, 100.0f, false))
+ return SPELL_CAST_OK;
+
+ return SPELL_FAILED_NO_PET;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
Unit* unit_to_add = NULL;
- for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
+ for (std::list<WorldObject*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
- if ((*itr)->GetTypeId() == TYPEID_UNIT
- && (*itr)->GetOwnerGUID() == GetCaster()->GetGUID()
- && (*itr)->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD)
+ if (Unit* unit = (*itr)->ToUnit())
+ if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
{
- unit_to_add = (*itr);
+ unit_to_add = unit;
break;
}
}
@@ -351,18 +366,12 @@ class spell_dk_death_pact : public SpellScriptLoader
unitList.clear();
if (unit_to_add)
unitList.push_back(unit_to_add);
- else
- {
- // Pet not found - remove cooldown
- if (Player* modOwner = GetCaster()->GetSpellModOwner())
- modOwner->RemoveSpellCooldown(GetSpellInfo()->Id, true);
- FinishCast(SPELL_FAILED_NO_PET);
- }
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
+ OnCheckCast += SpellCheckCastFn(spell_dk_death_pact_SpellScript::CheckCast);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
}
};
@@ -381,6 +390,13 @@ class spell_dk_scourge_strike : public SpellScriptLoader
class spell_dk_scourge_strike_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_scourge_strike_SpellScript);
+ float multiplier;
+
+ bool Load()
+ {
+ multiplier = 1.0f;
+ return true;
+ }
bool Validate(SpellInfo const* /*spellEntry*/)
{
@@ -394,7 +410,23 @@ class spell_dk_scourge_strike : public SpellScriptLoader
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
{
- int32 bp = CalculatePctN(GetHitDamage(), GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()));
+ multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
+ // Death Knight T8 Melee 4P Bonus
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
+ AddPctF(multiplier, aurEff->GetAmount());
+ }
+ }
+
+ void HandleAfterHit()
+ {
+ Unit* caster = GetCaster();
+ if (Unit* unitTarget = GetHitUnit())
+ {
+ int32 bp = GetHitDamage() * multiplier;
+
+ if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
+ AddPctN(bp, aurEff->GetAmount());
+
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
}
}
@@ -402,6 +434,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
+ AfterHit += SpellHitFn(spell_dk_scourge_strike_SpellScript::HandleAfterHit);
}
};
@@ -588,7 +621,7 @@ public:
if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
{
int32 basePoints1 = aurEff->GetAmount();
- target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, aurEff);
+ target->CastCustomSpell(target, DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff);
}
}
@@ -723,14 +756,14 @@ class spell_dk_death_coil : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_death_coil_SpellScript);
- bool Validate(SpellInfo const* /*SpellEntry*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL))
return false;
return true;
}
- void HandleDummy(SpellEffIndex /* effIndex */)
+ void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
Unit* caster = GetCaster();
@@ -750,8 +783,26 @@ class spell_dk_death_coil : public SpellScriptLoader
}
}
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (Unit* target = GetExplTargetUnit())
+ {
+ if (!caster->IsFriendlyTo(target) && !caster->isInFront(target))
+ return SPELL_FAILED_UNIT_NOT_INFRONT;
+
+ if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
+ return SPELL_FAILED_BAD_TARGETS;
+ }
+ else
+ return SPELL_FAILED_BAD_TARGETS;
+
+ return SPELL_CAST_OK;
+ }
+
void Register()
{
+ OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
@@ -775,7 +826,7 @@ class spell_dk_death_grip : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
- Position const* pos = GetTargetDest();
+ Position const* pos = GetExplTargetDest();
if (Unit* target = GetHitUnit())
{
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 380cac4e5ee..b213f3df624 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -28,7 +28,12 @@
enum DruidSpells
{
DRUID_INCREASED_MOONFIRE_DURATION = 38414,
- DRUID_NATURES_SPLENDOR = 57865
+ DRUID_NATURES_SPLENDOR = 57865,
+ DRUID_LIFEBLOOM_FINAL_HEAL = 33778,
+ DRUID_LIFEBLOOM_ENERGIZE = 64372,
+ DRUID_SURVIVAL_INSTINCTS = 50322,
+ DRUID_SAVAGE_ROAR = 62071,
+ SPELL_DRUID_ITEM_T8_BALANCE_RELIC = 64950,
};
// 54846 Glyph of Starfire
@@ -154,7 +159,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// reduces all damage taken while Stunned in Cat Form
- if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
+ if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
}
@@ -228,37 +233,37 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
if (!GetCaster()->ToPlayer()->GetGroup())
{
- unitList.clear();
- unitList.push_back(GetCaster());
+ targets.clear();
+ targets.push_back(GetCaster());
}
else
{
- unitList.remove(GetTargetUnit());
+ targets.remove(GetExplTargetUnit());
std::list<Unit*> tempTargets;
- for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
- if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr))
- tempTargets.push_back(*itr);
+ for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
+ if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith((*itr)->ToUnit()))
+ tempTargets.push_back((*itr)->ToUnit());
if (tempTargets.empty())
{
- unitList.clear();
+ targets.clear();
FinishCast(SPELL_FAILED_DONT_REPORT);
return;
}
Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets);
- unitList.clear();
- unitList.push_back(target);
+ targets.clear();
+ targets.push_back(target);
}
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
}
};
@@ -277,14 +282,14 @@ class spell_dru_starfall_aoe : public SpellScriptLoader
{
PrepareSpellScript(spell_dru_starfall_aoe_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- unitList.remove(GetTargetUnit());
+ targets.remove(GetExplTargetUnit());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -337,7 +342,12 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
{
PrepareSpellScript(spell_dru_starfall_dummy_SpellScript);
- void HandleDummy(SpellEffIndex /* effIndex */)
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ Trinity::Containers::RandomResizeList(targets, 2);
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
// Shapeshifting into an animal form or mounting cancels the effect
@@ -348,15 +358,16 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
return;
}
- //Any effect which causes you to lose control of your character will supress the starfall effect.
+ // Any effect which causes you to lose control of your character will supress the starfall effect.
if (caster->HasUnitState(UNIT_STATE_CONTROLLED))
return;
- caster->CastSpell(GetHitUnit(), GetEffectValue(), true);
+ caster->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register()
{
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -367,6 +378,272 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
}
};
+class spell_dru_lifebloom : public SpellScriptLoader
+{
+ public:
+ spell_dru_lifebloom() : SpellScriptLoader("spell_dru_lifebloom") { }
+
+ class spell_dru_lifebloom_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_lifebloom_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_FINAL_HEAL))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_ENERGIZE))
+ return false;
+ return true;
+ }
+
+ void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ // Final heal only on duration end
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ return;
+
+ // final heal
+ int32 stack = GetStackAmount();
+ int32 healAmount = aurEff->GetAmount();
+ if (Unit* caster = GetCaster())
+ {
+ healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack);
+ healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack);
+
+ GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+
+ // restore mana
+ int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
+ caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ return;
+ }
+
+ GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ }
+
+ void HandleDispel(DispelInfo* dispelInfo)
+ {
+ if (Unit* target = GetUnitOwner())
+ {
+ if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
+ {
+ // final heal
+ int32 healAmount = aurEff->GetAmount();
+ if (Unit* caster = GetCaster())
+ {
+ healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
+ healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
+ target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+
+ // restore mana
+ int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
+ caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ return;
+ }
+
+ target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ }
+ }
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_lifebloom_AuraScript();
+ }
+};
+
+class spell_dru_predatory_strikes : public SpellScriptLoader
+{
+ public:
+ spell_dru_predatory_strikes() : SpellScriptLoader("spell_dru_predatory_strikes") { }
+
+ class spell_dru_predatory_strikes_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_predatory_strikes_AuraScript);
+
+ void UpdateAmount(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Player* target = GetTarget()->ToPlayer())
+ target->UpdateAttackPowerAndDamage();
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_predatory_strikes_AuraScript();
+ }
+};
+
+class spell_dru_savage_roar : public SpellScriptLoader
+{
+ public:
+ spell_dru_savage_roar() : SpellScriptLoader("spell_dru_savage_roar") { }
+
+ class spell_dru_savage_roar_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dru_savage_roar_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (caster->GetShapeshiftForm() != FORM_CAT)
+ return SPELL_FAILED_ONLY_SHAPESHIFT;
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_dru_savage_roar_SpellScript::CheckCast);
+ }
+ };
+
+ class spell_dru_savage_roar_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_savage_roar_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(DRUID_SAVAGE_ROAR))
+ return false;
+ return true;
+ }
+
+ void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID());
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(DRUID_SAVAGE_ROAR);
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_dru_savage_roar_SpellScript();
+ }
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_savage_roar_AuraScript();
+ }
+};
+
+class spell_dru_survival_instincts : public SpellScriptLoader
+{
+ public:
+ spell_dru_survival_instincts() : SpellScriptLoader("spell_dru_survival_instincts") { }
+
+ class spell_dru_survival_instincts_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dru_survival_instincts_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (!caster->IsInFeralForm())
+ return SPELL_FAILED_ONLY_SHAPESHIFT;
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_dru_survival_instincts_SpellScript::CheckCast);
+ }
+ };
+
+ class spell_dru_survival_instincts_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_survival_instincts_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(DRUID_SURVIVAL_INSTINCTS))
+ return false;
+ return true;
+ }
+
+ void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ int32 bp0 = target->CountPctFromMaxHealth(aurEff->GetAmount());
+ target->CastCustomSpell(target, DRUID_SURVIVAL_INSTINCTS, &bp0, NULL, NULL, true);
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(DRUID_SURVIVAL_INSTINCTS);
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_survival_instincts_AuraScript::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_survival_instincts_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_dru_survival_instincts_SpellScript();
+ }
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_survival_instincts_AuraScript();
+ }
+};
+
+class spell_dru_insect_swarm : public SpellScriptLoader
+{
+ public:
+ spell_dru_insect_swarm() : SpellScriptLoader("spell_dru_insect_swarm") { }
+
+ class spell_dru_insect_swarm_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_insect_swarm_AuraScript);
+
+ void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
+ {
+ if (Unit* caster = GetCaster())
+ if (AuraEffect const* relicAurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0))
+ amount += relicAurEff->GetAmount() / aurEff->GetTotalTicks();
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_insect_swarm_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_insect_swarm_AuraScript();
+ }
+};
+
void AddSC_druid_spell_scripts()
{
new spell_dru_glyph_of_starfire();
@@ -377,4 +654,9 @@ void AddSC_druid_spell_scripts()
new spell_dru_starfall_aoe();
new spell_dru_swift_flight_passive();
new spell_dru_starfall_dummy();
+ new spell_dru_lifebloom();
+ new spell_dru_predatory_strikes();
+ new spell_dru_savage_roar();
+ new spell_dru_survival_instincts();
+ new spell_dru_insect_swarm();
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 035f9ec98b2..9cbf81b39af 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -169,7 +169,7 @@ class spell_gen_burn_brutallus : public SpellScriptLoader
}
};
-enum eCannibalizeSpells
+enum CannibalizeSpells
{
SPELL_CANNIBALIZE_TRIGGERED = 20578,
};
@@ -224,7 +224,7 @@ class spell_gen_cannibalize : public SpellScriptLoader
};
// 45472 Parachute
-enum eParachuteSpells
+enum ParachuteSpells
{
SPELL_PARACHUTE = 45472,
SPELL_PARACHUTE_BUFF = 44795,
@@ -239,7 +239,7 @@ class spell_gen_parachute : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_parachute_AuraScript);
- bool Validate(SpellInfo const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
return false;
@@ -365,7 +365,7 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader
};
// 66118 Leeching Swarm
-enum eLeechingSwarmSpells
+enum LeechingSwarmSpells
{
SPELL_LEECHING_SWARM_DMG = 66240,
SPELL_LEECHING_SWARM_HEAL = 66125,
@@ -481,7 +481,7 @@ class spell_gen_elune_candle : public SpellScriptLoader
};
// 24750 Trick
-enum eTrickSpells
+enum TrickSpells
{
SPELL_PIRATE_COSTUME_MALE = 24708,
SPELL_PIRATE_COSTUME_FEMALE = 24709,
@@ -557,7 +557,7 @@ class spell_gen_trick : public SpellScriptLoader
};
// 24751 Trick or Treat
-enum eTrickOrTreatSpells
+enum TrickOrTreatSpells
{
SPELL_TRICK = 24714,
SPELL_TREAT = 24715,
@@ -660,22 +660,16 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
return true;
}
- void HandleScript(SpellEffIndex /*effIndex*/)
+ void HandleScript()
{
- Player* caster = GetCaster()->ToPlayer();
- SpellInfo const* spellInfo = GetSpellInfo();
- caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)->GetRecoveryTime() / IN_MILLISECONDS);
- WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
- data << uint64(caster->GetGUID());
- data << uint8(0);
- data << uint32(spellInfo->Id);
- data << uint32(0);
- caster->GetSession()->SendPacket(&data);
+ // This is only needed because spells cast from spell_linked_spell are triggered by default
+ // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
+ GetCaster()->ToPlayer()->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell());
}
void Register()
{
- OnEffectHit += SpellEffectFn(spell_pvp_trinket_wotf_shared_cd_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
+ AfterCast += SpellCastFn(spell_pvp_trinket_wotf_shared_cd_SpellScript::HandleScript);
}
};
@@ -1282,7 +1276,7 @@ class spell_gen_launch : public SpellScriptLoader
void Launch()
{
- WorldLocation const* const position = GetTargetDest();
+ WorldLocation const* const position = GetExplTargetDest();
if (Player* player = GetHitPlayer())
{
@@ -1513,7 +1507,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
if (group->isLFGGroup())
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
- if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
+ if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty()))
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
return; // in correct dungeon
@@ -2052,9 +2046,9 @@ class spell_gen_defend : public SpellScriptLoader
public:
spell_gen_defend() : SpellScriptLoader("spell_gen_defend") { }
- class spell_gen_defendAuraScript : public AuraScript
+ class spell_gen_defend_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_gen_defendAuraScript);
+ PrepareAuraScript(spell_gen_defend_AuraScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
@@ -2103,26 +2097,26 @@ class spell_gen_defend : public SpellScriptLoader
// Defend spells casted by NPCs (add visuals)
if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
{
- AfterEffectApply += AuraEffectApplyFn(spell_gen_defendAuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
- OnEffectRemove += AuraEffectRemoveFn(spell_gen_defendAuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
}
// Remove Defend spell from player when he dismounts
if (spell->Effects[EFFECT_2].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)
- OnEffectRemove += AuraEffectRemoveFn(spell_gen_defendAuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL);
// Defend spells casted by players (add/remove visuals)
if (spell->Effects[EFFECT_1].ApplyAuraName == SPELL_AURA_DUMMY)
{
- AfterEffectApply += AuraEffectApplyFn(spell_gen_defendAuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
- OnEffectRemove += AuraEffectRemoveFn(spell_gen_defendAuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
}
}
};
AuraScript* GetAuraScript() const
{
- return new spell_gen_defendAuraScript();
+ return new spell_gen_defend_AuraScript();
}
};
@@ -2326,9 +2320,9 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
public:
spell_gen_on_tournament_mount() : SpellScriptLoader("spell_gen_on_tournament_mount") { }
- class spell_gen_on_tournament_mountAuraScript : public AuraScript
+ class spell_gen_on_tournament_mount_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_gen_on_tournament_mountAuraScript);
+ PrepareAuraScript(spell_gen_on_tournament_mount_AuraScript);
uint32 _pennantSpellId;
@@ -2468,14 +2462,14 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
void Register()
{
- AfterEffectApply += AuraEffectApplyFn(spell_gen_on_tournament_mountAuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
- OnEffectRemove += AuraEffectRemoveFn(spell_gen_on_tournament_mountAuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_on_tournament_mount_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_on_tournament_mount_AuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const
{
- return new spell_gen_on_tournament_mountAuraScript();
+ return new spell_gen_on_tournament_mount_AuraScript();
}
};
@@ -2484,9 +2478,9 @@ class spell_gen_tournament_pennant : public SpellScriptLoader
public:
spell_gen_tournament_pennant() : SpellScriptLoader("spell_gen_tournament_pennant") { }
- class spell_gen_tournament_pennantAuraScript : public AuraScript
+ class spell_gen_tournament_pennant_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_gen_tournament_pennantAuraScript);
+ PrepareAuraScript(spell_gen_tournament_pennant_AuraScript);
bool Load()
{
@@ -2502,13 +2496,13 @@ class spell_gen_tournament_pennant : public SpellScriptLoader
void Register()
{
- OnEffectApply += AuraEffectApplyFn(spell_gen_tournament_pennantAuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectApply += AuraEffectApplyFn(spell_gen_tournament_pennant_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const
{
- return new spell_gen_tournament_pennantAuraScript();
+ return new spell_gen_tournament_pennant_AuraScript();
}
};
@@ -2618,6 +2612,470 @@ class spell_gen_wg_water : public SpellScriptLoader
}
};
+class spell_gen_count_pct_from_max_hp : public SpellScriptLoader
+{
+ public:
+ spell_gen_count_pct_from_max_hp(char const* name, int32 damagePct = 0) : SpellScriptLoader(name), _damagePct(damagePct) { }
+
+ class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript)
+
+ public:
+ spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { }
+
+ void RecalculateDamage()
+ {
+ if (!_damagePct)
+ _damagePct = GetHitDamage();
+
+ SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(_damagePct));
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_gen_count_pct_from_max_hp_SpellScript::RecalculateDamage);
+ }
+
+ private:
+ int32 _damagePct;
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_count_pct_from_max_hp_SpellScript(_damagePct);
+ }
+
+ private:
+ int32 _damagePct;
+};
+
+class spell_gen_despawn_self : public SpellScriptLoader
+{
+public:
+ spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { }
+
+ class spell_gen_despawn_self_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_despawn_self_SpellScript);
+
+ bool Load()
+ {
+ return GetCaster()->GetTypeId() == TYPEID_UNIT;
+ }
+
+ void HandleDummy(SpellEffIndex effIndex)
+ {
+ if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT)
+ GetCaster()->ToCreature()->DespawnOrUnsummon();
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_despawn_self_SpellScript();
+ }
+};
+
+class spell_gen_touch_the_nightmare : public SpellScriptLoader
+{
+public:
+ spell_gen_touch_the_nightmare() : SpellScriptLoader("spell_gen_touch_the_nightmare") { }
+
+ class spell_gen_touch_the_nightmare_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_touch_the_nightmare_SpellScript);
+
+ void HandleDamageCalc(SpellEffIndex /*effIndex*/)
+ {
+ uint32 bp = GetCaster()->GetMaxHealth() * 0.3f;
+ SetHitDamage(bp);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_touch_the_nightmare_SpellScript::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_touch_the_nightmare_SpellScript();
+ }
+};
+
+class spell_gen_dream_funnel: public SpellScriptLoader
+{
+public:
+ spell_gen_dream_funnel() : SpellScriptLoader("spell_gen_dream_funnel") { }
+
+ class spell_gen_dream_funnel_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_dream_funnel_AuraScript);
+
+ void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
+ {
+ if (GetCaster())
+ amount = GetCaster()->GetMaxHealth() * 0.05f;
+
+ canBeRecalculated = false;
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_dream_funnel_AuraScript();
+ }
+};
+
+enum GenericBandage
+{
+ SPELL_RECENTLY_BANDAGED = 11196,
+};
+
+class spell_gen_bandage : public SpellScriptLoader
+{
+ public:
+ spell_gen_bandage() : SpellScriptLoader("spell_gen_bandage") { }
+
+ class spell_gen_bandage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_bandage_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED))
+ return false;
+ return true;
+ }
+
+ SpellCastResult CheckCast()
+ {
+ if (Unit* target = GetExplTargetUnit())
+ {
+ if (target->HasAura(SPELL_RECENTLY_BANDAGED))
+ return SPELL_FAILED_TARGET_AURASTATE;
+ }
+ return SPELL_CAST_OK;
+ }
+
+ void HandleScript()
+ {
+ if (Unit* target = GetHitUnit())
+ GetCaster()->CastSpell(target, SPELL_RECENTLY_BANDAGED, true);
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_gen_bandage_SpellScript::CheckCast);
+ AfterHit += SpellHitFn(spell_gen_bandage_SpellScript::HandleScript);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_bandage_SpellScript();
+ }
+};
+
+enum GenericLifebloom
+{
+ SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL = 43422,
+ SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL = 52552,
+ SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL = 53692,
+ SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL = 57763,
+ SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL = 66094,
+};
+
+class spell_gen_lifebloom : public SpellScriptLoader
+{
+ public:
+ spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
+
+ class spell_gen_lifebloom_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_lifebloom_AuraScript);
+
+ public:
+ spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(_spellId))
+ return false;
+ return true;
+ }
+
+ void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ // Final heal only on duration end
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
+ return;
+
+ // final heal
+ GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID());
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
+ }
+
+ private:
+ uint32 _spellId;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_lifebloom_AuraScript(_spellId);
+ }
+
+ private:
+ uint32 _spellId;
+};
+
+enum SummonElemental
+{
+ SPELL_SUMMON_FIRE_ELEMENTAL = 8985,
+ SPELL_SUMMON_EARTH_ELEMENTAL = 19704
+};
+
+class spell_gen_summon_elemental : public SpellScriptLoader
+{
+ public:
+ spell_gen_summon_elemental(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { }
+
+ class spell_gen_summon_elemental_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_summon_elemental_AuraScript);
+
+ public:
+ spell_gen_summon_elemental_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(_spellId))
+ return false;
+ return true;
+ }
+
+ void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetCaster())
+ if (Unit* owner = GetCaster()->GetOwner())
+ owner->CastSpell(owner, _spellId, true);
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetCaster())
+ if (Unit* owner = GetCaster()->GetOwner())
+ if (owner->GetTypeId() == TYPEID_PLAYER) // todo: this check is maybe wrong
+ owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_gen_summon_elemental_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_gen_summon_elemental_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+
+ private:
+ uint32 _spellId;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_summon_elemental_AuraScript(_spellId);
+ }
+
+ private:
+ uint32 _spellId;
+};
+
+enum Mounts
+{
+ SPELL_COLD_WEATHER_FLYING = 54197,
+
+ // Magic Broom
+ SPELL_MAGIC_BROOM_60 = 42680,
+ SPELL_MAGIC_BROOM_100 = 42683,
+ SPELL_MAGIC_BROOM_150 = 42667,
+ SPELL_MAGIC_BROOM_280 = 42668,
+
+ // Headless Horseman's Mount
+ SPELL_HEADLESS_HORSEMAN_MOUNT_60 = 51621,
+ SPELL_HEADLESS_HORSEMAN_MOUNT_100 = 48024,
+ SPELL_HEADLESS_HORSEMAN_MOUNT_150 = 51617,
+ SPELL_HEADLESS_HORSEMAN_MOUNT_280 = 48023,
+
+ // Winged Steed of the Ebon Blade
+ SPELL_WINGED_STEED_150 = 54726,
+ SPELL_WINGED_STEED_280 = 54727,
+
+ // Big Love Rocket
+ SPELL_BIG_LOVE_ROCKET_0 = 71343,
+ SPELL_BIG_LOVE_ROCKET_60 = 71344,
+ SPELL_BIG_LOVE_ROCKET_100 = 71345,
+ SPELL_BIG_LOVE_ROCKET_150 = 71346,
+ SPELL_BIG_LOVE_ROCKET_310 = 71347,
+
+ // Invincible
+ SPELL_INVINCIBLE_60 = 72281,
+ SPELL_INVINCIBLE_100 = 72282,
+ SPELL_INVINCIBLE_150 = 72283,
+ SPELL_INVINCIBLE_310 = 72284,
+
+ // Blazing Hippogryph
+ SPELL_BLAZING_HIPPOGRYPH_150 = 74854,
+ SPELL_BLAZING_HIPPOGRYPH_280 = 74855,
+
+ // Celestial Steed
+ SPELL_CELESTIAL_STEED_60 = 75619,
+ SPELL_CELESTIAL_STEED_100 = 75620,
+ SPELL_CELESTIAL_STEED_150 = 75617,
+ SPELL_CELESTIAL_STEED_280 = 75618,
+ SPELL_CELESTIAL_STEED_310 = 76153,
+
+ // X-53 Touring Rocket
+ SPELL_X53_TOURING_ROCKET_150 = 75957,
+ SPELL_X53_TOURING_ROCKET_280 = 75972,
+ SPELL_X53_TOURING_ROCKET_310 = 76154,
+};
+
+class spell_gen_mount : public SpellScriptLoader
+{
+ public:
+ spell_gen_mount(const char* name, uint32 mount0 = 0, uint32 mount60 = 0, uint32 mount100 = 0, uint32 mount150 = 0, uint32 mount280 = 0, uint32 mount310 = 0) : SpellScriptLoader(name),
+ _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { }
+
+ class spell_gen_mount_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_mount_SpellScript);
+
+ public:
+ spell_gen_mount_SpellScript(uint32 mount0, uint32 mount60, uint32 mount100, uint32 mount150, uint32 mount280, uint32 mount310) : SpellScript(),
+ _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (_mount0 && !sSpellMgr->GetSpellInfo(_mount0))
+ return false;
+ if (_mount60 && !sSpellMgr->GetSpellInfo(_mount60))
+ return false;
+ if (_mount100 && !sSpellMgr->GetSpellInfo(_mount100))
+ return false;
+ if (_mount150 && !sSpellMgr->GetSpellInfo(_mount150))
+ return false;
+ if (_mount280 && !sSpellMgr->GetSpellInfo(_mount280))
+ return false;
+ if (_mount310 && !sSpellMgr->GetSpellInfo(_mount310))
+ return false;
+ return true;
+ }
+
+ void HandleMount(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+
+ if (Player* target = GetHitPlayer())
+ {
+ // Prevent stacking of mounts and client crashes upon dismounting
+ target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura());
+
+ // Triggered spell id dependent on riding skill and zone
+ bool canFly = false;
+ uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId());
+ if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING)))
+ canFly = true;
+
+ float x, y, z;
+ target->GetPosition(x, y, z);
+ uint32 areaFlag = target->GetBaseMap()->GetAreaFlag(x, y, z);
+ AreaTableEntry const* area = sAreaStore.LookupEntry(areaFlag);
+ if (!area || (canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE)))
+ canFly = false;
+
+ uint32 mount = 0;
+ switch (target->GetBaseSkillValue(SKILL_RIDING))
+ {
+ case 0:
+ mount = _mount0;
+ break;
+ case 75:
+ mount = _mount60;
+ break;
+ case 150:
+ mount = _mount100;
+ break;
+ case 225:
+ if (canFly)
+ mount = _mount150;
+ else
+ mount = _mount100;
+ break;
+ case 300:
+ if (canFly)
+ {
+ if (_mount310 && target->Has310Flyer(false))
+ mount = _mount310;
+ else
+ mount = _mount280;
+ }
+ else
+ mount = _mount100;
+ break;
+ default:
+ break;
+ }
+
+ if (mount)
+ {
+ PreventHitAura();
+ target->CastSpell(target, mount, true);
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_mount_SpellScript::HandleMount, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+
+ private:
+ uint32 _mount0;
+ uint32 _mount60;
+ uint32 _mount100;
+ uint32 _mount150;
+ uint32 _mount280;
+ uint32 _mount310;
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_mount_SpellScript(_mount0, _mount60, _mount100, _mount150, _mount280, _mount310);
+ }
+
+ private:
+ uint32 _mount0;
+ uint32 _mount60;
+ uint32 _mount100;
+ uint32 _mount150;
+ uint32 _mount280;
+ uint32 _mount310;
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -2669,4 +3127,25 @@ void AddSC_generic_spell_scripts()
new spell_gen_chaos_blast();
new spell_gen_ds_flush_knockback();
new spell_gen_wg_water();
+ new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp");
+ new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50);
+ new spell_gen_despawn_self();
+ new spell_gen_touch_the_nightmare();
+ new spell_gen_dream_funnel();
+ new spell_gen_bandage();
+ new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL);
+ new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL);
+ new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL);
+ new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL);
+ new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL);
+ new spell_gen_summon_elemental("spell_gen_summon_fire_elemental", SPELL_SUMMON_FIRE_ELEMENTAL);
+ new spell_gen_summon_elemental("spell_gen_summon_earth_elemental", SPELL_SUMMON_EARTH_ELEMENTAL);
+ new spell_gen_mount("spell_magic_broom", 0, SPELL_MAGIC_BROOM_60, SPELL_MAGIC_BROOM_100, SPELL_MAGIC_BROOM_150, SPELL_MAGIC_BROOM_280);
+ new spell_gen_mount("spell_headless_horseman_mount", 0, SPELL_HEADLESS_HORSEMAN_MOUNT_60, SPELL_HEADLESS_HORSEMAN_MOUNT_100, SPELL_HEADLESS_HORSEMAN_MOUNT_150, SPELL_HEADLESS_HORSEMAN_MOUNT_280);
+ new spell_gen_mount("spell_winged_steed_of_the_ebon_blade", 0, 0, 0, SPELL_WINGED_STEED_150, SPELL_WINGED_STEED_280);
+ new spell_gen_mount("spell_big_love_rocket", SPELL_BIG_LOVE_ROCKET_0, SPELL_BIG_LOVE_ROCKET_60, SPELL_BIG_LOVE_ROCKET_100, SPELL_BIG_LOVE_ROCKET_150, SPELL_BIG_LOVE_ROCKET_310);
+ new spell_gen_mount("spell_invincible", 0, SPELL_INVINCIBLE_60, SPELL_INVINCIBLE_100, SPELL_INVINCIBLE_150, SPELL_INVINCIBLE_310);
+ new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280);
+ new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310);
+ new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
}
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index dabe978b58c..a1ecac6256a 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -20,7 +20,12 @@
* Scriptnames in this file should be prefixed with "spell_#holidayname_".
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "GridNotifiers.h"
+#include "CellImpl.h"
// 45102 Romantic Picnic
enum SpellsPicnic
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 5d8e8f84e6a..a2ee6c1c3a3 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -137,8 +137,9 @@ class spell_hun_chimera_shot : public SpellScriptLoader
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
- basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
+ basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
ApplyPctN(basePoint, TickCount * 40);
+ basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
else if (familyFlag[1] & 0x00000080)
@@ -286,8 +287,8 @@ class spell_hun_masters_call : public SpellScriptLoader
target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask);
// there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that
// it's more likely that on on retail it's possible to call target selector based on dbc values
- // anyways, we're using GetTargetUnit() here and it's ok
- if (Unit* ally = GetTargetUnit())
+ // anyways, we're using GetExplTargetUnit() here and it's ok
+ if (Unit* ally = GetExplTargetUnit())
{
target->CastSpell(ally, GetEffectValue(), castMask);
target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask);
@@ -617,6 +618,86 @@ class spell_hun_misdirection_proc : public SpellScriptLoader
}
};
+class spell_hun_disengage : public SpellScriptLoader
+{
+ public:
+ spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { }
+
+ class spell_hun_disengage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_hun_disengage_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat())
+ return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_hun_disengage_SpellScript();
+ }
+};
+
+class spell_hun_tame_beast : public SpellScriptLoader
+{
+ public:
+ spell_hun_tame_beast() : SpellScriptLoader("spell_hun_tame_beast") { }
+
+ class spell_hun_tame_beast_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_hun_tame_beast_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (caster->GetTypeId() != TYPEID_PLAYER)
+ return SPELL_FAILED_DONT_REPORT;
+
+ if (!GetExplTargetUnit())
+ return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
+
+ if (Creature* target = GetExplTargetUnit()->ToCreature())
+ {
+ if (target->getLevel() > caster->getLevel())
+ return SPELL_FAILED_HIGHLEVEL;
+
+ // use SMSG_PET_TAME_FAILURE?
+ if (!target->GetCreatureTemplate()->isTameable(caster->ToPlayer()->CanTameExoticPets()))
+ return SPELL_FAILED_BAD_TARGETS;
+
+ if (caster->GetPetGUID())
+ return SPELL_FAILED_ALREADY_HAVE_SUMMON;
+
+ if (caster->GetCharmGUID())
+ return SPELL_FAILED_ALREADY_HAVE_CHARM;
+ }
+ else
+ return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_hun_tame_beast_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_hun_tame_beast_SpellScript();
+ }
+};
void AddSC_hunter_spell_scripts()
{
@@ -632,4 +713,6 @@ void AddSC_hunter_spell_scripts()
new spell_hun_pet_carrion_feeder();
new spell_hun_misdirection();
new spell_hun_misdirection_proc();
+ new spell_hun_disengage();
+ new spell_hun_tame_beast();
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 666477e68e7..3c89cb7005a 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -1095,7 +1095,7 @@ class spell_item_shimmering_vessel : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
if (Creature* target = GetHitCreature())
- target->setDeathState(JUST_ALIVED);
+ target->setDeathState(JUST_RESPAWNED);
}
void Register()
@@ -1535,7 +1535,7 @@ class spell_item_impale_leviroth : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
if (Unit* target = GetHitCreature())
- if (target->GetEntry() == NPC_LEVIROTH && target->HealthBelowPct(95))
+ if (target->GetEntry() == NPC_LEVIROTH && !target->HealthBelowPct(95))
target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true);
}
@@ -1744,11 +1744,20 @@ class spell_item_rocket_boots : public SpellScriptLoader
if (Battleground* bg = caster->GetBattleground())
bg->EventPlayerDroppedFlag(caster);
+ caster->RemoveSpellCooldown(SPELL_ROCKET_BOOTS_PROC);
caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL);
}
+ SpellCastResult CheckCast()
+ {
+ if (GetCaster()->IsInWater())
+ return SPELL_FAILED_ONLY_ABOVEWATER;
+ return SPELL_CAST_OK;
+ }
+
void Register()
{
+ OnCheckCast += SpellCheckCastFn(spell_item_rocket_boots_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -1839,60 +1848,6 @@ class spell_item_unusual_compass : public SpellScriptLoader
}
};
-enum UDED
-{
- NPC_IRONWOOL_MAMMOTH = 53806,
- SPELL_MAMMOTH_CARCASS = 57444,
- SPELL_MAMMOTH_MEAT = 54625,
-};
-
-class spell_item_uded : public SpellScriptLoader
-{
- public:
- spell_item_uded() : SpellScriptLoader("spell_item_uded") { }
-
- class spell_item_uded_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_item_uded_SpellScript);
-
- bool Load()
- {
- if (GetHitCreature() && GetHitCreature()->GetEntry() == NPC_IRONWOOL_MAMMOTH)
- return true;
- return false;
- }
-
- bool Validate(SpellInfo const* /*spell*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_MAMMOTH_CARCASS) || !sSpellMgr->GetSpellInfo(SPELL_MAMMOTH_MEAT))
- return false;
- return true;
- }
-
- void HandleDummy(SpellEffIndex /* effIndex */)
- {
- Unit* caster = GetCaster();
- Creature* creature = GetHitCreature();
- caster->CastSpell(caster,SPELL_MAMMOTH_CARCASS,true);
-
- for (uint8 i = 0; i < 4; ++i)
- caster->CastSpell(caster,SPELL_MAMMOTH_MEAT,true);
-
- creature->Kill(creature);
- }
-
- void Register()
- {
- OnEffectHitTarget += SpellEffectFn(spell_item_uded_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- }
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_item_uded_SpellScript();
- }
-};
-
enum ChickenCover
{
SPELL_CHICKEN_NET = 51959,
@@ -2005,7 +1960,7 @@ class spell_item_muisek_vessel : public SpellScriptLoader
{
if (Creature* target = GetHitCreature())
if (target->isDead())
- target->ForcedDespawn();
+ target->DespawnOrUnsummon();
}
void Register()
@@ -2020,6 +1975,37 @@ class spell_item_muisek_vessel : public SpellScriptLoader
}
};
+enum GreatmothersSoulcather
+{
+ SPELL_FORCE_CAST_SUMMON_GNOME_SOUL = 46486,
+};
+class spell_item_greatmothers_soulcatcher : public SpellScriptLoader
+{
+public:
+ spell_item_greatmothers_soulcatcher() : SpellScriptLoader("spell_item_greatmothers_soulcatcher") { }
+
+ class spell_item_greatmothers_soulcatcher_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_item_greatmothers_soulcatcher_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitUnit())
+ GetCaster()->CastSpell(GetCaster(),SPELL_FORCE_CAST_SUMMON_GNOME_SOUL);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_item_greatmothers_soulcatcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_item_greatmothers_soulcatcher_SpellScript();
+ }
+};
+
void AddSC_item_spell_scripts()
{
// 23074 Arcanite Dragonling
@@ -2069,7 +2055,7 @@ void AddSC_item_spell_scripts()
new spell_item_rocket_boots();
new spell_item_pygmy_oil();
new spell_item_unusual_compass();
- new spell_item_uded();
new spell_item_chicken_cover();
new spell_item_muisek_vessel();
+ new spell_item_greatmothers_soulcatcher();
}
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 050741ffaba..0edfbaee437 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -342,13 +342,52 @@ public:
}
};
+class spell_mage_living_bomb : public SpellScriptLoader
+{
+ public:
+ spell_mage_living_bomb() : SpellScriptLoader("spell_mage_living_bomb") { }
+
+ class spell_mage_living_bomb_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_mage_living_bomb_AuraScript);
+
+ bool Validate(SpellInfo const* spell)
+ {
+ if (!sSpellMgr->GetSpellInfo(uint32(spell->Effects[EFFECT_1].CalcValue())))
+ return false;
+ return true;
+ }
+
+ void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
+ if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE)
+ return;
+
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(GetTarget(), uint32(aurEff->GetAmount()), true, NULL, aurEff);
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_mage_living_bomb_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_mage_living_bomb_AuraScript();
+ }
+};
+
void AddSC_mage_spell_scripts()
{
- new spell_mage_blast_wave;
- new spell_mage_cold_snap;
+ new spell_mage_blast_wave();
+ new spell_mage_cold_snap();
new spell_mage_frost_warding_trigger();
new spell_mage_incanters_absorbtion_absorb();
new spell_mage_incanters_absorbtion_manashield();
- new spell_mage_polymorph_cast_visual;
- new spell_mage_summon_water_elemental;
+ new spell_mage_polymorph_cast_visual();
+ new spell_mage_summon_water_elemental();
+ new spell_mage_living_bomb();
}
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index d823c629d4b..0bf2e5664a0 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -43,6 +43,10 @@ enum PaladinSpells
SPELL_DIVINE_STORM = 53385,
SPELL_DIVINE_STORM_DUMMY = 54171,
SPELL_DIVINE_STORM_HEAL = 54172,
+
+ SPELL_FORBEARANCE = 25771,
+ SPELL_AVENGING_WRATH_MARKER = 61987,
+ SPELL_IMMUNE_SHIELD_MARKER = 61988,
};
// 31850 - Ardent Defender
@@ -255,17 +259,18 @@ class spell_pal_holy_shock : public SpellScriptLoader
class spell_pal_holy_shock_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_pal_holy_shock_SpellScript)
- bool Validate(SpellInfo const* spellEntry)
+ PrepareSpellScript(spell_pal_holy_shock_SpellScript);
+
+ bool Validate(SpellInfo const* spell)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
- if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
+ if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id))
return false;
- uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
+ uint8 rank = sSpellMgr->GetSpellRank(spell->Id);
if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
@@ -285,9 +290,29 @@ class spell_pal_holy_shock : public SpellScriptLoader
}
}
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (Unit* target = GetExplTargetUnit())
+ {
+ if (!caster->IsFriendlyTo(target))
+ {
+ if (!caster->IsValidAttackTarget(target))
+ return SPELL_FAILED_BAD_TARGETS;
+
+ if (!caster->isInFront(target))
+ return SPELL_FAILED_UNIT_NOT_INFRONT;
+ }
+ }
+ else
+ return SPELL_FAILED_BAD_TARGETS;
+ return SPELL_CAST_OK;
+ }
+
void Register()
{
// add dummy effect spell handler to Holy Shock
+ OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -384,7 +409,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
return true;
}
- void CountTargets(std::list<Unit*>& targetList)
+ void CountTargets(std::list<WorldObject*>& targetList)
{
_targetCount = targetList.size();
}
@@ -403,7 +428,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
}
};
@@ -413,6 +438,134 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
}
};
+class spell_pal_lay_on_hands : public SpellScriptLoader
+{
+ public:
+ spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { }
+
+ class spell_pal_lay_on_hands_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_pal_lay_on_hands_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_FORBEARANCE))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_AVENGING_WRATH_MARKER))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_IMMUNE_SHIELD_MARKER))
+ return false;
+ return true;
+ }
+
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (Unit* target = GetExplTargetUnit())
+ if (caster == target)
+ if (target->HasAura(SPELL_FORBEARANCE) || target->HasAura(SPELL_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_IMMUNE_SHIELD_MARKER))
+ return SPELL_FAILED_TARGET_AURASTATE;
+
+ return SPELL_CAST_OK;
+ }
+
+ void HandleScript()
+ {
+ Unit* caster = GetCaster();
+ if (caster == GetHitUnit())
+ {
+ caster->CastSpell(caster, SPELL_FORBEARANCE, true);
+ caster->CastSpell(caster, SPELL_AVENGING_WRATH_MARKER, true);
+ caster->CastSpell(caster, SPELL_IMMUNE_SHIELD_MARKER, true);
+ }
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast);
+ AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_pal_lay_on_hands_SpellScript();
+ }
+};
+
+class spell_pal_righteous_defense : public SpellScriptLoader
+{
+ public:
+ spell_pal_righteous_defense() : SpellScriptLoader("spell_pal_righteous_defense") { }
+
+ class spell_pal_righteous_defense_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_pal_righteous_defense_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ Unit* caster = GetCaster();
+ if (caster->GetTypeId() != TYPEID_PLAYER)
+ return SPELL_FAILED_DONT_REPORT;
+
+ if (Unit* target = GetExplTargetUnit())
+ {
+ if (!target->IsFriendlyTo(caster) || target->getAttackers().empty())
+ return SPELL_FAILED_BAD_TARGETS;
+ }
+ else
+ return SPELL_FAILED_BAD_TARGETS;
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_pal_righteous_defense_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_pal_righteous_defense_SpellScript();
+ }
+};
+
+class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader
+{
+ public:
+ spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { }
+
+ class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript);
+
+ void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
+ {
+ if (!spellMod)
+ {
+ spellMod = new SpellModifier(aurEff->GetBase());
+ spellMod->op = SPELLMOD_DAMAGE;
+ spellMod->type = SPELLMOD_FLAT;
+ spellMod->spellId = GetId();
+ spellMod->mask[1] = 0x200002;
+ }
+
+ spellMod->value = aurEff->GetAmount();
+ }
+
+ void Register()
+ {
+ DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript();
+ }
+};
+
void AddSC_paladin_spell_scripts()
{
new spell_pal_ardent_defender();
@@ -423,4 +576,7 @@ void AddSC_paladin_spell_scripts()
new spell_pal_judgement_of_command();
new spell_pal_divine_storm();
new spell_pal_divine_storm_dummy();
+ new spell_pal_lay_on_hands();
+ new spell_pal_righteous_defense();
+ new spell_pal_exorcism_and_holy_wrath_damage();
}
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
new file mode 100644
index 00000000000..7830d46260c
--- /dev/null
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -0,0 +1,1744 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+/*
+ * Scripts for spells with SPELLFAMILY_DEATHKNIGHT and SPELLFAMILY_GENERIC spells used by deathknight players.
+ * Ordered alphabetically using scriptname.
+ * Scriptnames of files in this file should be prefixed with "spell_dk_".
+ */
+
+#include "ScriptMgr.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "Unit.h"
+#include "Player.h"
+#include "Pet.h"
+
+enum HunterPetCalculate
+{
+ SPELL_TAMED_PET_PASSIVE_06 = 19591,
+ SPELL_TAMED_PET_PASSIVE_07 = 20784,
+ SPELL_TAMED_PET_PASSIVE_08 = 34666,
+ SPELL_TAMED_PET_PASSIVE_09 = 34667,
+ SPELL_TAMED_PET_PASSIVE_10 = 34675,
+ SPELL_HUNTER_PET_SCALING_01 = 34902,
+ SPELL_HUNTER_PET_SCALING_02 = 34903,
+ SPELL_HUNTER_PET_SCALING_03 = 34904,
+ SPELL_HUNTER_PET_SCALING_04 = 61017,
+ SPELL_HUNTER_ANIMAL_HANDLER = 34453,
+};
+
+enum WarlockPetCalculate
+{
+ SPELL_PET_PASSIVE_CRIT = 35695,
+ SPELL_PET_PASSIVE_DAMAGE_TAKEN = 35697,
+ SPELL_WARLOCK_PET_SCALING_01 = 34947,
+ SPELL_WARLOCK_PET_SCALING_02 = 34956,
+ SPELL_WARLOCK_PET_SCALING_03 = 34957,
+ SPELL_WARLOCK_PET_SCALING_04 = 34958,
+ SPELL_WARLOCK_PET_SCALING_05 = 61013,
+ ENTRY_FELGUARD = 17252,
+ ENTRY_VOIDWALKER = 1860,
+ ENTRY_FELHUNTER = 417,
+ ENTRY_SUCCUBUS = 1863,
+ ENTRY_IMP = 416,
+ SPELL_WARLOCK_GLYPH_OF_VOIDWALKER = 56247,
+};
+
+enum DKPetCalculate
+{
+ SPELL_DEATH_KNIGHT_RUNE_WEAPON_02 = 51906,
+ SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566,
+ SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996,
+ SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697,
+ SPELL_NIGHT_OF_THE_DEAD = 55620,
+ ENTRY_ARMY_OF_THE_DEAD_GHOUL = 24207,
+ SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL = 58686,
+};
+
+enum ShamanPetCalculate
+{
+ SPELL_FERAL_SPIRIT_PET_UNK_01 = 35674,
+ SPELL_FERAL_SPIRIT_PET_UNK_02 = 35675,
+ SPELL_FERAL_SPIRIT_PET_UNK_03 = 35676,
+ SPELL_FERAL_SPIRIT_PET_SCALING_04 = 61783,
+};
+
+enum MiscPetCalculate
+{
+ SPELL_MAGE_PET_PASSIVE_ELEMENTAL = 44559,
+ SPELL_PET_HEALTH_SCALING = 61679,
+ SPELL_PET_UNK_01 = 67561,
+ SPELL_PET_UNK_02 = 67557,
+};
+
+class spell_gen_pet_calculate : public SpellScriptLoader
+{
+ public:
+ spell_gen_pet_calculate() : SpellScriptLoader("spell_gen_pet_calculate") { }
+
+ class spell_gen_pet_calculate_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_pet_calculate_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritSpell = 0.0f;
+ // Crit from Intellect
+ CritSpell += owner->GetSpellCritFromIntellect();
+ // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
+ CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit spell from spell crit ratings
+ CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
+
+ amount += int32(CritSpell);
+ }
+ }
+
+ void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritMelee = 0.0f;
+ // Crit from Agility
+ CritMelee += owner->GetMeleeCritFromAgility();
+ // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
+ CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit melee from melee crit ratings
+ CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
+
+ amount += int32(CritMelee);
+ }
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float Expertise = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_EXPERTISE
+ Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
+ // Increase Expertise from Expertise ratings
+ Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
+
+ amount += int32(Expertise);
+ }
+ }
+
+ void Register()
+ {
+ switch (m_scriptSpellId)
+ {
+ case SPELL_TAMED_PET_PASSIVE_06:
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ break;
+ case SPELL_PET_PASSIVE_CRIT:
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ break;
+ case SPELL_WARLOCK_PET_SCALING_05:
+ case SPELL_HUNTER_PET_SCALING_04:
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
+ break;
+ case SPELL_DEATH_KNIGHT_PET_SCALING_03:
+// case SPELL_SHAMAN_PET_HIT:
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ break;
+ default:
+ break;
+ }
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_pet_calculate_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_01 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_01() : SpellScriptLoader("spell_warl_pet_scaling_01") { }
+
+ class spell_warl_pet_scaling_01_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_01_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ _tempBonus = 0;
+ return true;
+ }
+
+ void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempBonus)
+ {
+ PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
+ uint32 healthMod = 0;
+ uint32 baseHealth = pInfo->health;
+ switch (pet->GetEntry())
+ {
+ case ENTRY_IMP:
+ healthMod = uint32(_tempBonus * 8.4f);
+ break;
+ case ENTRY_FELGUARD:
+ case ENTRY_VOIDWALKER:
+ healthMod = _tempBonus * 11;
+ break;
+ case ENTRY_SUCCUBUS:
+ healthMod = uint32(_tempBonus * 9.1f);
+ break;
+ case ENTRY_FELHUNTER:
+ healthMod = uint32(_tempBonus * 9.5f);
+ break;
+ default:
+ healthMod = 0;
+ break;
+ }
+ if (healthMod)
+ pet->ToPet()->SetCreateHealth(baseHealth + healthMod);
+ }
+ }
+
+ void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ {
+ PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
+ pet->ToPet()->SetCreateHealth(pInfo->health);
+ }
+ }
+
+ void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
+ int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 maximum = (fire > shadow) ? fire : shadow;
+ if (maximum < 0)
+ maximum = 0;
+ float bonusAP = maximum * 0.57f;
+
+ amount += bonusAP;
+
+ // Glyph of felguard
+ if (pet->GetEntry() == ENTRY_FELGUARD)
+ {
+ if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0))
+ {
+ float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
+ amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount());
+ }
+ }
+ }
+ }
+
+ void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ //the damage bonus used for pets is either fire or shadow damage, whatever is higher
+ int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
+ int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 maximum = (fire > shadow) ? fire : shadow;
+ float bonusDamage = 0.0f;
+
+ if (maximum > 0)
+ bonusDamage = maximum * 0.15f;
+
+ amount += bonusDamage;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
+ }
+
+ private:
+ uint32 _tempBonus;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_01_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_02() : SpellScriptLoader("spell_warl_pet_scaling_02") { }
+
+ class spell_warl_pet_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ _tempBonus = 0;
+ return true;
+ }
+
+ void CalculateIntellectAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
+
+ amount += ownerBonus;
+ _tempBonus = ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempBonus)
+ {
+ PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
+ uint32 manaMod = 0;
+ uint32 baseMana = pInfo->mana;
+ switch (pet->GetEntry())
+ {
+ case ENTRY_IMP:
+ manaMod = uint32(_tempBonus * 4.9f);
+ break;
+ case ENTRY_VOIDWALKER:
+ case ENTRY_SUCCUBUS:
+ case ENTRY_FELHUNTER:
+ case ENTRY_FELGUARD:
+ manaMod = uint32(_tempBonus * 11.5f);
+ break;
+ default:
+ manaMod = 0;
+ break;
+ }
+ if (manaMod)
+ pet->ToPet()->SetCreateMana(baseMana + manaMod);
+ }
+ }
+
+ void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ {
+ PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
+ pet->ToPet()->SetCreateMana(pInfo->mana);
+ }
+ }
+
+ void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_02_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_02_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateIntellectAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateArmorAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+
+ private:
+ uint32 _tempBonus;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_02_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_03 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_03() : SpellScriptLoader("spell_warl_pet_scaling_03") { }
+
+ class spell_warl_pet_scaling_03_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_03_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateFrostResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_03_AuraScript();
+ }
+};
+
+
+class spell_warl_pet_scaling_04 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_04() : SpellScriptLoader("spell_warl_pet_scaling_04") { }
+
+ class spell_warl_pet_scaling_04_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_04_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_04_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_04_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_05 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_05() : SpellScriptLoader("spell_warl_pet_scaling_05") { }
+
+ class spell_warl_pet_scaling_05_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_05_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float Expertise = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ Expertise += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(Expertise);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_05_AuraScript();
+ }
+};
+
+class spell_warl_pet_passive : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_passive() : SpellScriptLoader("spell_warl_pet_passive") { }
+
+ class spell_warl_pet_passive_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_passive_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritSpell = 0.0f;
+ // Crit from Intellect
+ CritSpell += owner->GetSpellCritFromIntellect();
+ // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
+ CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit spell from spell crit ratings
+ CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
+
+ if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
+ if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
+ if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
+ amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount());
+ }
+ }
+
+ void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritMelee = 0.0f;
+ // Crit from Agility
+ CritMelee += owner->GetMeleeCritFromAgility();
+ // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
+ CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit melee from melee crit ratings
+ CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
+
+ if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
+ if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
+ if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
+ amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount());
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_passive_AuraScript();
+ }
+};
+// this doesnt actually fit in here
+class spell_warl_pet_passive_damage_done : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_passive_damage_done() : SpellScriptLoader("spell_warl_pet_passive_damage_done") { }
+
+ class spell_warl_pet_passive_damage_done_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_passive_damage_done_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (GetCaster()->GetOwner()->ToPlayer())
+ {
+ switch (GetCaster()->GetEntry())
+ {
+ case ENTRY_VOIDWALKER:
+ amount += -16;
+ break;
+ case ENTRY_FELHUNTER:
+ amount += -20;
+ break;
+ case ENTRY_SUCCUBUS:
+ case ENTRY_FELGUARD:
+ amount += 5;
+ break;
+ }
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_passive_damage_done_AuraScript();
+ }
+};
+
+class spell_warl_pet_passive_voidwalker : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_passive_voidwalker() : SpellScriptLoader("spell_warl_pet_passive_voidwalker") { }
+
+ class spell_warl_pet_passive_voidwalker_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_passive_voidwalker_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0))
+ amount += /* aurEff */ect->GetAmount();
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_voidwalker_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_passive_voidwalker_AuraScript();
+ }
+};
+
+
+class spell_sha_pet_scaling_04 : public SpellScriptLoader
+{
+public:
+ spell_sha_pet_scaling_04() : SpellScriptLoader("spell_sha_pet_scaling_04") { }
+
+ class spell_sha_pet_scaling_04_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_sha_pet_scaling_04_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_sha_pet_scaling_04_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_01 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_01() : SpellScriptLoader("spell_hun_pet_scaling_01") { }
+
+ class spell_hun_pet_scaling_01_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_01_AuraScript);
+
+ void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float mod = 0.45f;
+ float ownerBonus = 0.0f;
+
+ PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
+ if (itr == pet->ToPet()->m_spells.end())
+ itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
+
+ if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ }
+
+ ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
+
+ amount += ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempHealth)
+ pet->SetHealth(_tempHealth);
+ }
+
+ void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ _tempHealth = pet->GetHealth();
+ }
+
+ void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 1.0f; //Hunter contribution modifier
+ float bonusAP = 0.0f;
+
+ PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
+ if (itr == pet->ToPet()->m_spells.end())
+ itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
+
+ if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ }
+
+ bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
+
+ amount += bonusAP;
+ }
+ }
+
+ void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 1.0f; //Hunter contribution modifier
+ float bonusDamage = 0.0f;
+
+ PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
+ if (itr == pet->ToPet()->m_spells.end())
+ itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
+
+ if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ }
+
+ bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
+
+ amount += bonusDamage;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_hun_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_hun_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
+ }
+
+ private:
+ uint32 _tempHealth;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_01_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_02() : SpellScriptLoader("spell_hun_pet_scaling_02") { }
+
+ class spell_hun_pet_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFrostResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_02_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_03 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_03() : SpellScriptLoader("spell_hun_pet_scaling_03") { }
+
+ class spell_hun_pet_scaling_03_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_03_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArmorAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_03_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_04 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_04() : SpellScriptLoader("spell_hun_pet_scaling_04") { }
+
+ class spell_hun_pet_scaling_04_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_04_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float Expertise = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_EXPERTISE
+ Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
+ // Increase Expertise from Expertise ratings
+ Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
+
+ amount += int32(Expertise);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_04_AuraScript();
+ }
+};
+
+class spell_hun_pet_passive_crit : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_passive_crit() : SpellScriptLoader("spell_hun_pet_passive_crit") { }
+
+ class spell_hun_pet_passive_crit_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_passive_crit_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritSpell = 0.0f;
+ // Crit from Intellect
+ // CritSpell += owner->GetSpellCritFromIntellect();
+ // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
+ // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit spell from spell crit ratings
+ // CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
+
+ amount += (CritSpell*0.8f);
+ }
+ }
+
+ void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritMelee = 0.0f;
+ // Crit from Agility
+ // CritMelee += owner->GetMeleeCritFromAgility();
+ // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
+ // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit melee from melee crit ratings
+ // CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
+
+ amount += (CritMelee*0.8f);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_passive_crit_AuraScript();
+ }
+};
+
+class spell_hun_pet_passive_damage_done : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_passive_damage_done() : SpellScriptLoader("spell_hun_pet_passive_damage_done") { }
+
+ class spell_hun_pet_passive_damage_done_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_passive_damage_done_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (GetCaster()->GetOwner()->ToPlayer())
+ {
+ // Pet's base damage changes depending on happiness
+ if (GetCaster()->isPet() && GetCaster()->ToPet()->isHunterPet())
+ {
+ switch (GetCaster()->ToPet()->GetHappinessState())
+ {
+ case HAPPY:
+ // 125% of normal damage
+ amount += 25.0f;
+ break;
+ case CONTENT:
+ // 100% of normal damage, nothing to modify
+ break;
+ case UNHAPPY:
+ // 75% of normal damage
+ amount += -25.0f;
+ break;
+ }
+ }
+ // Cobra Reflexes
+ if (AuraEffect* cobraReflexes = GetCaster()->GetAuraEffectOfRankedSpell(61682, EFFECT_0))
+ amount -= cobraReflexes->GetAmount();
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_passive_damage_done_AuraScript();
+ }
+};
+
+class spell_hun_animal_handler : public SpellScriptLoader
+{
+public:
+ spell_hun_animal_handler() : SpellScriptLoader("spell_hun_animal_handler") { }
+
+ class spell_hun_animal_handler_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_animal_handler_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ if (AuraEffect* /* aurEff */ect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1))
+ amount = /* aurEff */ect->GetAmount();
+ else
+ amount = 0;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_animal_handler_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_ATTACK_POWER_PCT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_animal_handler_AuraScript();
+ }
+};
+
+
+class spell_dk_avoidance_passive : public SpellScriptLoader
+{
+public:
+ spell_dk_avoidance_passive() : SpellScriptLoader("spell_dk_avoidance_passive") { }
+
+ class spell_dk_avoidance_passive_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_avoidance_passive_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAvoidanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (Unit* owner = pet->GetOwner())
+ {
+ // Army of the dead ghoul
+ if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL)
+ amount = -90;
+ // Night of the dead
+ else if ( Aura * aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD))
+ amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
+ }
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_avoidance_passive_AuraScript::CalculateAvoidanceAmount, EFFECT_0, SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_avoidance_passive_AuraScript();
+ }
+};
+
+class spell_dk_pet_scaling_01 : public SpellScriptLoader
+{
+public:
+ spell_dk_pet_scaling_01() : SpellScriptLoader("spell_dk_pet_scaling_01") { }
+
+ class spell_dk_pet_scaling_01_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_pet_scaling_01_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ _tempHealth = 0;
+ return true;
+ }
+
+ void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (pet->isGuardian())
+ {
+ if (Unit* owner = pet->GetOwner())
+ {
+ float mod = 0.3f;
+
+ // Ravenous Dead. Check just if owner has Ravenous Dead since it's effect is not an aura
+ if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0))
+ {
+ mod += aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()/100; // Ravenous Dead edits the original scale
+ }
+ // Glyph of the Ghoul
+ if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL, 0))
+ mod += aurEff->GetAmount()/100;
+
+ float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod;
+ amount += ownerBonus;
+ }
+ }
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempHealth)
+ pet->SetHealth(_tempHealth);
+ }
+
+ void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ _tempHealth = pet->GetHealth();
+ }
+
+ void CalculateStrengthAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isGuardian())
+ return;
+
+ Unit* owner = pet->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 0.7f;
+
+ // Ravenous Dead
+ AuraEffect const* aurEff = NULL;
+ // Check just if owner has Ravenous Dead since it's effect is not an aura
+ aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
+ if (aurEff)
+ {
+ mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ }
+ // Glyph of the Ghoul
+ aurEff = owner->GetAuraEffect(58686, 0);
+ if (aurEff)
+ mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod;
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_dk_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount, EFFECT_1, SPELL_AURA_MOD_STAT);
+ }
+
+ private:
+ uint32 _tempHealth;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_pet_scaling_01_AuraScript();
+ }
+};
+
+class spell_dk_pet_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_dk_pet_scaling_02() : SpellScriptLoader("spell_dk_pet_scaling_02") { }
+
+ class spell_dk_pet_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_pet_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HasteMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
+
+ amount += int32(HasteMelee);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_pet_scaling_02_AuraScript();
+ }
+};
+
+class spell_dk_pet_scaling_03 : public SpellScriptLoader
+{
+public:
+ spell_dk_pet_scaling_03() : SpellScriptLoader("spell_dk_pet_scaling_03") { }
+
+ class spell_dk_pet_scaling_03_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_pet_scaling_03_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_pet_scaling_03_AuraScript();
+ }
+};
+
+class spell_dk_rune_weapon_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_dk_rune_weapon_scaling_02() : SpellScriptLoader("spell_dk_rune_weapon_scaling_02") { }
+
+ class spell_dk_rune_weapon_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_rune_weapon_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ Unit* owner = pet->GetOwner();
+ if (!owner)
+ return;
+
+ if (pet->isGuardian())
+ ((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK));
+
+ amount += owner->CalculateDamage(BASE_ATTACK, true, true);;
+ }
+ }
+
+ void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HasteMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
+
+ amount += int32(HasteMelee);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateDamageDoneAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_rune_weapon_scaling_02_AuraScript();
+ }
+};
+
+void AddSC_pet_spell_scripts()
+{
+ new spell_gen_pet_calculate();
+}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index d2bba2b8bc3..3d8ca3e729b 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -34,6 +34,11 @@ enum PriestSpells
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619,
PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201,
+ PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085,
+ PRIEST_SPELL_EMPOWERED_RENEW = 63544,
+ PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021,
+ PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874,
+ PRIEST_SHADOW_WORD_DEATH = 32409,
};
// Guardian Spirit
@@ -129,14 +134,14 @@ class spell_pri_mind_sear : public SpellScriptLoader
{
PrepareSpellScript(spell_pri_mind_sear_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)));
+ unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)));
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_pri_mind_sear_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_mind_sear_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -227,10 +232,9 @@ class spell_pri_penance : public SpellScriptLoader
SpellCastResult CheckCast()
{
Player* caster = GetCaster()->ToPlayer();
- if (GetTargetUnit())
- if (Player* target = GetTargetUnit()->ToPlayer())
- if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target))
- return SPELL_FAILED_BAD_TARGETS;
+ if (Unit* target = GetExplTargetUnit())
+ if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target))
+ return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
@@ -291,12 +295,170 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
}
};
+enum PrayerOfMending
+{
+ SPELL_T9_HEALING_2_PIECE = 67201,
+};
+// Prayer of Mending Heal
+class spell_pri_prayer_of_mending_heal : public SpellScriptLoader
+{
+public:
+ spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { }
+
+ class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript);
+
+ void HandleHeal(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* caster = GetOriginalCaster())
+ {
+ if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0))
+ {
+ int32 heal = GetHitHeal();
+ AddPctN(heal, aurEff->GetAmount());
+ SetHitHeal(heal);
+ }
+ }
+
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_pri_prayer_of_mending_heal_SpellScript();
+ }
+};
+
+class spell_pri_vampiric_touch : public SpellScriptLoader
+{
+ public:
+ spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { }
+
+ class spell_pri_vampiric_touch_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pri_vampiric_touch_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL))
+ return false;
+ return true;
+ }
+
+ void HandleDispel(DispelInfo* /*dispelInfo*/)
+ {
+ if (Unit* caster = GetCaster())
+ if (Unit* target = GetUnitOwner())
+ if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
+ {
+ int32 damage = aurEff->GetAmount() * 8;
+ // backfire damage
+ caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
+ }
+ }
+
+ void Register()
+ {
+ AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_pri_vampiric_touch_AuraScript();
+ }
+};
+
+class spell_priest_renew : public SpellScriptLoader
+{
+ public:
+ spell_priest_renew() : SpellScriptLoader("spell_priest_renew") { }
+
+ class spell_priest_renew_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_priest_renew_AuraScript);
+
+ bool Load()
+ {
+ return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void HandleApplyEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ {
+ // Empowered Renew
+ if (AuraEffect const* empoweredRenewAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT, EFFECT_1))
+ {
+ uint32 heal = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), GetEffect(EFFECT_0)->GetAmount(), DOT);
+ heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
+
+ int32 basepoints0 = empoweredRenewAurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100;
+ caster->CastCustomSpell(GetTarget(), PRIEST_SPELL_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff);
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_priest_renew_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_priest_renew_AuraScript();
+ }
+};
+
+class spell_pri_shadow_word_death : public SpellScriptLoader
+{
+ public:
+ spell_pri_shadow_word_death() : SpellScriptLoader("spell_pri_shadow_word_death") { }
+
+ class spell_pri_shadow_word_death_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_pri_shadow_word_death_SpellScript);
+
+ void HandleDamage()
+ {
+ int32 damage = GetHitDamage();
+
+ // Pain and Suffering reduces damage
+ if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
+ AddPctN(damage, aurEff->GetAmount());
+
+ GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_pri_shadow_word_death_SpellScript::HandleDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_pri_shadow_word_death_SpellScript();
+ }
+};
+
void AddSC_priest_spell_scripts()
{
new spell_pri_guardian_spirit();
- new spell_pri_mana_burn;
- new spell_pri_pain_and_suffering_proc;
- new spell_pri_penance;
+ new spell_pri_mana_burn();
+ new spell_pri_pain_and_suffering_proc();
+ new spell_pri_penance();
new spell_pri_reflective_shield_trigger();
new spell_pri_mind_sear();
+ new spell_pri_prayer_of_mending_heal();
+ new spell_pri_vampiric_touch();
+ new spell_priest_renew();
+ new spell_pri_shadow_word_death();
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 48faf83cd2f..5648c510413 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -275,7 +275,7 @@ class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
- if (Unit* target = GetTargetUnit())
+ if (Unit* target = GetExplTargetUnit())
if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
// Make sure nobody else is channeling the same target
if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
@@ -639,7 +639,7 @@ class spell_q12851_going_bearback : public SpellScriptLoader
// Already in fire
if (target->HasAura(SPELL_ABLAZE))
return;
-
+
if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
switch (target->GetEntry())
@@ -837,7 +837,7 @@ class spell_q12659_ahunaes_knife : public SpellScriptLoader
Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature())
{
- target->ForcedDespawn();
+ target->DespawnOrUnsummon();
caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0);
}
}
@@ -1105,6 +1105,146 @@ public:
}
};
+enum LeaveNothingToChance
+{
+ NPC_UPPER_MINE_SHAFT = 27436,
+ NPC_LOWER_MINE_SHAFT = 27437,
+
+ SPELL_UPPER_MINE_SHAFT_CREDIT = 48744,
+ SPELL_LOWER_MINE_SHAFT_CREDIT = 48745,
+};
+
+class spell_q12277_wintergarde_mine_explosion : public SpellScriptLoader
+{
+ public:
+ spell_q12277_wintergarde_mine_explosion() : SpellScriptLoader("spell_q12277_wintergarde_mine_explosion") { }
+
+ class spell_q12277_wintergarde_mine_explosion_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12277_wintergarde_mine_explosion_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (Creature* unitTarget = GetHitCreature())
+ {
+ if (Unit* caster = GetCaster())
+ {
+ if (caster->GetTypeId() == TYPEID_UNIT)
+ {
+ if (Unit* owner = caster->GetOwner())
+ {
+ switch (unitTarget->GetEntry())
+ {
+ case NPC_UPPER_MINE_SHAFT:
+ caster->CastSpell(owner, SPELL_UPPER_MINE_SHAFT_CREDIT, true);
+ break;
+ case NPC_LOWER_MINE_SHAFT:
+ caster->CastSpell(owner, SPELL_LOWER_MINE_SHAFT_CREDIT, true);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12277_wintergarde_mine_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12277_wintergarde_mine_explosion_SpellScript();
+ }
+};
+
+enum FocusOnTheBeach
+{
+ SPELL_BUNNY_CREDIT_BEAM = 47390,
+};
+
+class spell_q12066_bunny_kill_credit : public SpellScriptLoader
+{
+public:
+ spell_q12066_bunny_kill_credit() : SpellScriptLoader("spell_q12066_bunny_kill_credit") { }
+
+ class spell_q12066_bunny_kill_credit_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12066_bunny_kill_credit_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (Creature* target = GetHitCreature())
+ target->CastSpell(GetCaster(), SPELL_BUNNY_CREDIT_BEAM, false);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12066_bunny_kill_credit_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12066_bunny_kill_credit_SpellScript();
+ }
+};
+
+enum ACleansingSong
+{
+ SPELL_SUMMON_SPIRIT_ATAH = 52954,
+ SPELL_SUMMON_SPIRIT_HAKHALAN = 52958,
+ SPELL_SUMMON_SPIRIT_KOOSU = 52959,
+
+ AREA_BITTERTIDELAKE = 4385,
+ AREA_RIVERSHEART = 4290,
+ AREA_WINTERGRASPRIVER = 4388,
+};
+
+class spell_q12735_song_of_cleansing : public SpellScriptLoader
+{
+ public:
+ spell_q12735_song_of_cleansing() : SpellScriptLoader("spell_q12735_song_of_cleansing") { }
+
+ class spell_q12735_song_of_cleansing_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12735_song_of_cleansing_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ switch (caster->GetAreaId())
+ {
+ case AREA_BITTERTIDELAKE:
+ caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_ATAH);
+ break;
+ case AREA_RIVERSHEART:
+ caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_HAKHALAN);
+ break;
+ case AREA_WINTERGRASPRIVER:
+ caster->CastSpell(caster, SPELL_SUMMON_SPIRIT_KOOSU);
+ break;
+ default:
+ break;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12735_song_of_cleansing_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12735_song_of_cleansing_SpellScript();
+ }
+};
+
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
@@ -1131,4 +1271,7 @@ void AddSC_quest_spell_scripts()
new spell_q14112_14145_chum_the_water();
new spell_q9452_cast_net();
new spell_q12987_read_pronouncement();
+ new spell_q12277_wintergarde_mine_explosion();
+ new spell_q12066_bunny_kill_credit();
+ new spell_q12735_song_of_cleansing();
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 3a4132f62fe..ad437c5e431 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -350,7 +350,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]);
continue;
}
@@ -386,6 +386,34 @@ class spell_rog_deadly_poison : public SpellScriptLoader
}
};
+class spell_rog_shadowstep : public SpellScriptLoader
+{
+ public:
+ spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { }
+
+ class spell_rog_shadowstep_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_rog_shadowstep_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (GetCaster()->HasUnitState(UNIT_STATE_ROOT))
+ return SPELL_FAILED_ROOTED;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_rog_shadowstep_SpellScript();
+ }
+};
+
void AddSC_rogue_spell_scripts()
{
new spell_rog_cheat_death();
@@ -394,4 +422,5 @@ void AddSC_rogue_spell_scripts()
new spell_rog_prey_on_the_weak();
new spell_rog_shiv();
new spell_rog_deadly_poison();
+ new spell_rog_shadowstep();
}
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 1a0f4576fea..c863c2363af 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -36,9 +36,18 @@ enum ShamanSpells
SHAMAN_SPELL_SATED = 57724,
SHAMAN_SPELL_EXHAUSTION = 57723,
+ SHAMAN_SPELL_STORM_EARTH_AND_FIRE = 51483,
+ EARTHBIND_TOTEM_SPELL_EARTHGRAB = 64695,
+
// For Earthen Power
SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474,
SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566,
+
+ SHAMAN_BIND_SIGHT = 6277,
+
+ ICON_ID_SHAMAN_LAVA_FLOW = 3087,
+ SHAMAN_LAVA_FLOWS_R1 = 51480,
+ SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694,
};
// 51474 - Astral shift
@@ -210,20 +219,35 @@ class spell_sha_earthbind_totem : public SpellScriptLoader
return true;
}
- void HandleEffectPeriodic(AuraEffect const* aurEff)
+ void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
+ {
+ if (!GetCaster())
+ return;
+ if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0))
+ if (roll_chance_i(aur->GetBaseAmount()))
+ GetTarget()->CastSpell((Unit*)NULL, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true);
+ }
+
+ void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- if (Unit* target = GetTarget())
- if (Unit* caster = aurEff->GetBase()->GetCaster())
- if (TempSummon* summon = caster->ToTempSummon())
- if (Unit* owner = summon->GetOwner())
- if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0))
- if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE))
- caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff);
+ if (!GetCaster())
+ return;
+ Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
+ if (!owner)
+ return;
+ // Storm, Earth and Fire
+ if (AuraEffect* aurEff = owner->GetAuraEffectOfRankedSpell(SHAMAN_SPELL_STORM_EARTH_AND_FIRE, EFFECT_1))
+ {
+ if (roll_chance_i(aurEff->GetAmount()))
+ GetCaster()->CastSpell(GetCaster(), EARTHBIND_TOTEM_SPELL_EARTHGRAB, false);
+ }
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_earthbind_totem_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ OnEffectApply += AuraEffectApplyFn(spell_sha_earthbind_totem_AuraScript::Apply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -233,6 +257,49 @@ class spell_sha_earthbind_totem : public SpellScriptLoader
}
};
+class EarthenPowerTargetSelector
+{
+ public:
+ EarthenPowerTargetSelector() { }
+
+ bool operator() (WorldObject* target)
+ {
+ if (!target->ToUnit())
+ return true;
+
+ if (!target->ToUnit()->HasAuraWithMechanic(1 << MECHANIC_SNARE))
+ return true;
+
+ return false;
+ }
+};
+
+class spell_sha_earthen_power : public SpellScriptLoader
+{
+ public:
+ spell_sha_earthen_power() : SpellScriptLoader("spell_sha_earthen_power") { }
+
+ class spell_sha_earthen_power_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_sha_earthen_power_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& unitList)
+ {
+ unitList.remove_if(EarthenPowerTargetSelector());
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_sha_earthen_power_SpellScript();
+ }
+};
+
class spell_sha_bloodlust : public SpellScriptLoader
{
public:
@@ -249,9 +316,9 @@ class spell_sha_bloodlust : public SpellScriptLoader
return true;
}
- void RemoveInvalidTargets(std::list<Unit*>& targets)
+ void RemoveInvalidTargets(std::list<WorldObject*>& targets)
{
- targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED));
+ targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED));
}
void ApplyDebuff()
@@ -262,9 +329,9 @@ class spell_sha_bloodlust : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
AfterHit += SpellHitFn(spell_sha_bloodlust_SpellScript::ApplyDebuff);
}
};
@@ -291,9 +358,9 @@ class spell_sha_heroism : public SpellScriptLoader
return true;
}
- void RemoveInvalidTargets(std::list<Unit*>& targets)
+ void RemoveInvalidTargets(std::list<WorldObject*>& targets)
{
- targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION));
+ targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION));
}
void ApplyDebuff()
@@ -304,9 +371,9 @@ class spell_sha_heroism : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
- OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
AfterHit += SpellHitFn(spell_sha_heroism_SpellScript::ApplyDebuff);
}
};
@@ -430,7 +497,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader
if (Unit* owner = caster->GetOwner())
{
if (triggeringSpell)
- damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL));
+ damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL));
// Restorative Totems
if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1))
@@ -439,6 +506,8 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader
// Glyph of Healing Stream Totem
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
AddPctN(damage, aurEff->GetAmount());
+
+ damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL));
}
caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID());
}
@@ -592,12 +661,101 @@ class spell_sha_chain_heal : public SpellScriptLoader
}
};
+class spell_sha_flame_shock : public SpellScriptLoader
+{
+ public:
+ spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { }
+
+ class spell_sha_flame_shock_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_sha_flame_shock_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_R1))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_TRIGGERED_R1))
+ return false;
+ return true;
+ }
+
+ void HandleDispel(DispelInfo* /*dispelInfo*/)
+ {
+ if (Unit* caster = GetCaster())
+ // Lava Flows
+ if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0))
+ {
+ if (sSpellMgr->GetFirstSpellInChain(SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId()))
+ return;
+
+ uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId());
+ caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true);
+ }
+ }
+
+ void Register()
+ {
+ AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_sha_flame_shock_AuraScript();
+ }
+};
+
+class spell_sha_sentry_totem : public SpellScriptLoader
+{
+ public:
+ spell_sha_sentry_totem() : SpellScriptLoader("spell_sha_sentry_totem") { }
+
+ class spell_sha_sentry_totem_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_sha_sentry_totem_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_BIND_SIGHT))
+ return false;
+ return true;
+ }
+
+ void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[4]))
+ if (totem->isTotem())
+ caster->CastSpell(totem, SHAMAN_BIND_SIGHT, true);
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ if (caster->GetTypeId() == TYPEID_PLAYER)
+ caster->ToPlayer()->StopCastingBindSight();
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_sha_sentry_totem_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_sha_sentry_totem_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_sha_sentry_totem_AuraScript();
+ }
+};
+
void AddSC_shaman_spell_scripts()
{
new spell_sha_astral_shift();
new spell_sha_fire_nova();
new spell_sha_mana_tide_totem();
new spell_sha_earthbind_totem();
+ new spell_sha_earthen_power();
new spell_sha_bloodlust();
new spell_sha_heroism();
new spell_sha_ancestral_awakening_proc();
@@ -606,4 +764,6 @@ void AddSC_shaman_spell_scripts()
new spell_sha_mana_spring_totem();
new spell_sha_lava_lash();
new spell_sha_chain_heal();
+ new spell_sha_flame_shock();
+ new spell_sha_sentry_totem();
}
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 29a52406279..e0131190916 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -37,6 +37,10 @@ enum WarlockSpells
WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020,
WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388,
+ WARLOCK_HAUNT = 48181,
+ WARLOCK_HAUNT_HEAL = 48210,
+ WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
+ WARLOCK_CURSE_OF_DOOM_EFFECT = 18662,
};
class spell_warl_banish : public SpellScriptLoader
@@ -172,6 +176,19 @@ class spell_warl_create_healthstone : public SpellScriptLoader
return true;
}
+ SpellCastResult CheckCast()
+ {
+ if (Player* caster = GetCaster()->ToPlayer())
+ {
+ uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
+ ItemPosCountVec dest;
+ InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL);
+ if (msg != EQUIP_ERR_OK)
+ return SPELL_FAILED_TOO_MANY_OF_ITEM;
+ }
+ return SPELL_CAST_OK;
+ }
+
void HandleScriptEffect(SpellEffIndex effIndex)
{
if (Unit* unitTarget = GetHitUnit())
@@ -185,7 +202,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
case WARLOCK_IMPROVED_HEALTHSTONE_R1: rank = 1; break;
case WARLOCK_IMPROVED_HEALTHSTONE_R2: rank = 2; break;
default:
- sLog->outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
break;
}
}
@@ -198,6 +215,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnCheckCast += SpellCheckCastFn(spell_warl_create_healthstone_SpellScript::CheckCast);
}
};
@@ -285,15 +303,15 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
{
PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- if (GetTargetUnit())
- unitList.remove(GetTargetUnit());
+ if (GetExplTargetUnit())
+ targets.remove(GetExplTargetUnit());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -509,6 +527,150 @@ class spell_warl_demonic_circle_teleport : public SpellScriptLoader
}
};
+class spell_warl_haunt : public SpellScriptLoader
+{
+ public:
+ spell_warl_haunt() : SpellScriptLoader("spell_warl_haunt") { }
+
+ class spell_warl_haunt_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_warl_haunt_SpellScript);
+
+ void HandleOnHit()
+ {
+ if (Aura* aura = GetHitAura())
+ if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
+ aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage()));
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit);
+ }
+ };
+
+ class spell_warl_haunt_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_haunt_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_HAUNT_HEAL))
+ return false;
+ return true;
+ }
+
+ void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* caster = GetCaster())
+ {
+ int32 amount = aurEff->GetAmount();
+ GetTarget()->CastCustomSpell(caster, WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_warl_haunt_SpellScript();
+ }
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_haunt_AuraScript();
+ }
+};
+
+class spell_warl_unstable_affliction : public SpellScriptLoader
+{
+ public:
+ spell_warl_unstable_affliction() : SpellScriptLoader("spell_warl_unstable_affliction") { }
+
+ class spell_warl_unstable_affliction_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_unstable_affliction_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_UNSTABLE_AFFLICTION_DISPEL))
+ return false;
+ return true;
+ }
+
+ void HandleDispel(DispelInfo* dispelInfo)
+ {
+ if (Unit* caster = GetCaster())
+ if (AuraEffect const* aurEff = GetEffect(EFFECT_0))
+ {
+ int32 damage = aurEff->GetAmount() * 9;
+ // backfire damage and silence
+ caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
+ }
+ }
+
+ void Register()
+ {
+ AfterDispel += AuraDispelFn(spell_warl_unstable_affliction_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_unstable_affliction_AuraScript();
+ }
+};
+
+class spell_warl_curse_of_doom : public SpellScriptLoader
+{
+ public:
+ spell_warl_curse_of_doom() : SpellScriptLoader("spell_warl_curse_of_doom") { }
+
+ class spell_warl_curse_of_doom_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_curse_of_doom_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_CURSE_OF_DOOM_EFFECT))
+ return false;
+ return true;
+ }
+
+ bool Load()
+ {
+ return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ if (!GetCaster())
+ return;
+
+ AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
+ if (removeMode != AURA_REMOVE_BY_DEATH || !IsExpired())
+ return;
+
+ if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget()))
+ GetCaster()->CastSpell(GetTarget(), WARLOCK_CURSE_OF_DOOM_EFFECT, true, NULL, aurEff);
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_warl_curse_of_doom_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_curse_of_doom_AuraScript();
+ }
+};
+
void AddSC_warlock_spell_scripts()
{
new spell_warl_banish();
@@ -521,4 +683,7 @@ void AddSC_warlock_spell_scripts()
new spell_warl_life_tap();
new spell_warl_demonic_circle_summon();
new spell_warl_demonic_circle_teleport();
+ new spell_warl_haunt();
+ new spell_warl_unstable_affliction();
+ new spell_warl_curse_of_doom();
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 2ce3c72580e..c64101e11ea 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -77,7 +77,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
{
PrepareSpellScript(spell_warr_improved_spell_reflection_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
if (GetCaster())
unitList.remove(GetCaster());
@@ -85,7 +85,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
}
};
@@ -177,24 +177,27 @@ class spell_warr_deep_wounds : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
int32 damage = GetEffectValue();
+ Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
- if (Unit* caster = GetCaster())
- {
- // apply percent damage mods
- damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
+ {
+ // apply percent damage mods
+ damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
- ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
+ ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC);
- uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
+ damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
- // Add remaining ticks to damage done
- if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID()))
- damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber());
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC);
+ uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
- damage = damage / ticks;
- caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true);
- }
+ // Add remaining ticks to damage done
+ if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID()))
+ damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber());
+
+ damage = damage / ticks;
+
+ caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true);
+ }
}
void Register()
@@ -365,7 +368,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
- SetHitDamage(GetHitDamage() + CalculatePctF(GetHitDamage(),GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)));
+ SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
}
void Register()
@@ -394,16 +397,29 @@ class spell_warr_bloodthirst : public SpellScriptLoader
{
PrepareSpellScript(spell_warr_bloodthirst_SpellScript);
- void HandleDummy(SpellEffIndex /* effIndex */)
+ void HandleDamage(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
- if (GetHitUnit())
- GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL);
+ ApplyPctF(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
+
+ if (Unit* target = GetHitUnit())
+ {
+ damage = GetCaster()->SpellDamageBonusDone(target, GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE);
+ damage = target->SpellDamageBonusTaken(GetCaster(), GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE);
+ }
+ SetHitDamage(damage);
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ int32 damage = GetEffectValue();
+ GetCaster()->CastCustomSpell(GetCaster(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL);
}
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
+ OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ OnEffectHit += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
}
};
@@ -413,6 +429,38 @@ class spell_warr_bloodthirst : public SpellScriptLoader
}
};
+enum BloodthirstHeal
+{
+ SPELL_BLOODTHIRST_DAMAGE = 23881,
+};
+
+class spell_warr_bloodthirst_heal : public SpellScriptLoader
+{
+ public:
+ spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { }
+
+ class spell_warr_bloodthirst_heal_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript);
+
+ void HandleHeal(SpellEffIndex /*effIndex*/)
+ {
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_BLOODTHIRST_DAMAGE))
+ SetHitHeal(GetCaster()->CountPctFromMaxHealth(spellInfo->Effects[EFFECT_1].CalcValue(GetCaster())));
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_warr_bloodthirst_heal_SpellScript();
+ }
+};
+
enum Overpower
{
SPELL_UNRELENTING_ASSAULT_RANK_1 = 46859,
@@ -441,9 +489,9 @@ public:
if (!spellId)
return;
- Unit* target = GetHitUnit();
- if (target->HasUnitState(UNIT_STATE_CASTING))
- target->CastSpell(target, spellId, true);
+ if (Player* target = GetHitPlayer())
+ if (target->HasUnitState(UNIT_STATE_CASTING))
+ target->CastSpell(target, spellId, true);
}
void Register()
@@ -469,5 +517,6 @@ void AddSC_warrior_spell_scripts()
new spell_warr_execute();
new spell_warr_concussion_blow();
new spell_warr_bloodthirst();
+ new spell_warr_bloodthirst_heal();
new spell_warr_overpower();
}
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 9bcf450b3aa..60572ee3e6a 100755
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -235,30 +235,6 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
}
};
-class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
-{
-public:
- achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
-
- bool OnCheck(Player* source, Unit* target)
- {
- if (!target)
- return false;
-
- if (Player* victim = target->ToPlayer())
- {
- if (!victim->IsMounted())
- return false;
-
- if (Vehicle* vehicle = source->GetVehicle())
- if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
- return true;
- }
-
- return false;
- }
-};
-
class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
{
public:
@@ -313,6 +289,27 @@ class achievement_tilted : public AchievementCriteriaScript
}
};
+class achievement_not_even_a_scratch : public AchievementCriteriaScript
+{
+ public:
+ achievement_not_even_a_scratch() : AchievementCriteriaScript("achievement_not_even_a_scratch") { }
+
+ bool OnCheck(Player* source, Unit* /*target*/)
+ {
+ if (!source)
+ return false;
+
+ Battleground* battleground = source->GetBattleground();
+ if (!battleground)
+ return false;
+
+ if (static_cast<BattlegroundSA*>(battleground)->notEvenAScratch(source->GetTeam()))
+ return true;
+
+ return false;
+ }
+};
+
void AddSC_achievement_scripts()
{
new achievement_resilient_victory();
@@ -323,7 +320,6 @@ void AddSC_achievement_scripts()
new achievement_bg_ic_mowed_down();
new achievement_bg_sa_artillery();
new achievement_sickly_gazelle();
- new achievement_wg_didnt_stand_a_chance();
new achievement_everything_counts();
new achievement_bg_av_perfection();
new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2);
@@ -331,4 +327,5 @@ void AddSC_achievement_scripts()
new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5);
new achievement_bg_sa_defense_of_ancients();
new achievement_tilted();
+ new achievement_not_even_a_scratch();
}
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index daf0ef213d9..f302009a4f3 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -35,7 +35,8 @@ at_brewfest
at_area_52_entrance
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*######
## at_coilfang_waterfall
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index 045dea9c9a9..abb20130ef8 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -224,9 +224,9 @@ class DreamFogTargetSelector
public:
DreamFogTargetSelector() { }
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* object) const
{
- return unit->HasAura(SPELL_SLEEP);
+ return object->ToUnit() && object->ToUnit()->HasAura(SPELL_SLEEP);
}
};
@@ -239,14 +239,14 @@ class spell_dream_fog_sleep : public SpellScriptLoader
{
PrepareSpellScript(spell_dream_fog_sleep_SpellScript);
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& unitList)
{
- unitList.remove_if (DreamFogTargetSelector());
+ unitList.remove_if(DreamFogTargetSelector());
}
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
@@ -265,10 +265,12 @@ class MarkOfNatureTargetSelector
public:
MarkOfNatureTargetSelector() { }
- bool operator()(Unit* unit)
+ bool operator()(WorldObject* object) const
{
- // return anyone that isn't tagged or already under the influence of Aura of Nature
- return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE));
+ if (Unit* unit = object->ToUnit())
+ // return anyone that isn't tagged or already under the influence of Aura of Nature
+ return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE));
+ return true;
}
};
@@ -290,9 +292,9 @@ class spell_mark_of_nature : public SpellScriptLoader
return true;
}
- void FilterTargets(std::list<Unit*>& unitList)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- unitList.remove_if (MarkOfNatureTargetSelector());
+ targets.remove_if(MarkOfNatureTargetSelector());
}
void HandleEffect(SpellEffIndex effIndex)
@@ -305,7 +307,7 @@ class spell_mark_of_nature : public SpellScriptLoader
void Register()
{
- OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp
index 2a5d814bfde..fb540c177bc 100755
--- a/src/server/scripts/World/chat_log.cpp
+++ b/src/server/scripts/World/chat_log.cpp
@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
#include "Channel.h"
#include "Guild.h"
#include "Group.h"
@@ -31,25 +31,25 @@ public:
{
case CHAT_MSG_ADDON:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s sends: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s",
player->GetName(), msg.c_str());
break;
case CHAT_MSG_SAY:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
- sLog->outChat("[SAY] Player %s says (language %u): %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s",
player->GetName(), lang, msg.c_str());
break;
case CHAT_MSG_EMOTE:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
- sLog->outChat("[TEXTEMOTE] Player %s emotes: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s",
player->GetName(), msg.c_str());
break;
case CHAT_MSG_YELL:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
- sLog->outChat("[YELL] Player %s yells (language %u): %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s",
player->GetName(), lang, msg.c_str());
break;
}
@@ -58,10 +58,10 @@ public:
void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver)
{
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER))
- sLog->outChat("[WHISPER] Player %s tells %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s",
player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s",
player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg.c_str());
}
@@ -73,52 +73,52 @@ public:
{
case CHAT_MSG_PARTY:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY))
- sLog->outChat("[PARTY] Player %s tells group with leader %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s",
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells group with leader %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s",
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_PARTY_LEADER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY))
- sLog->outChat("[PARTY] Leader %s tells group: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s",
player->GetName(), msg.c_str());
break;
case CHAT_MSG_RAID:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
- sLog->outChat("[RAID] Player %s tells raid with leader %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s",
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells raid with leader %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s",
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_RAID_LEADER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
- sLog->outChat("[RAID] Leader player %s tells raid: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s",
player->GetName(), msg.c_str());
break;
case CHAT_MSG_RAID_WARNING:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
- sLog->outChat("[RAID] Leader player %s warns raid with: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s",
player->GetName(), msg.c_str());
break;
case CHAT_MSG_BATTLEGROUND:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND))
- sLog->outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells battleground with leader %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s",
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_BATTLEGROUND_LEADER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND))
- sLog->outChat("[BATTLEGROUND] Leader player %s tells battleground: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s",
player->GetName(), msg.c_str());
break;
}
@@ -130,16 +130,16 @@ public:
{
case CHAT_MSG_GUILD:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD))
- sLog->outChat("[GUILD] Player %s tells guild %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s",
player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s sends to guild %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s",
player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_OFFICER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD))
- sLog->outChat("[OFFICER] Player %s tells guild %s officers: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s",
player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
break;
}
@@ -154,10 +154,10 @@ public:
channel->HasFlag(CHANNEL_FLAG_LFG));
if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem)
- sLog->outChat("[SYSCHAN] Player %s tells channel %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s",
player->GetName(), channel->GetName().c_str(), msg.c_str());
else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL))
- sLog->outChat("[CHANNEL] Player %s tells channel %s: %s",
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s",
player->GetName(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str());
}
};
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index 60ddf8990a7..3ce136b9737 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -50,7 +50,9 @@ go_large_gjalerbron_cage
go_veil_skith_cage
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*######
## go_cat_figurine
@@ -327,7 +329,7 @@ public:
if (Spell)
creature->CastSpell(player, Spell, false);
else
- sLog->outError("TSCR: go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction());
+ sLog->outError(LOG_FILTER_TSCR, "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction());
}
}
}
@@ -1174,7 +1176,7 @@ class go_gjalerbron_cage : public GameObjectScript
player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0);
prisoner->AI()->Talk(SAY_FREE);
- prisoner->ForcedDespawn(6000);
+ prisoner->DespawnOrUnsummon(6000);
}
}
return true;
@@ -1201,7 +1203,7 @@ class go_large_gjalerbron_cage : public GameObjectScript
{
go->UseDoorOrButton();
player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, (*itr)->GetGUID());
- (*itr)->ForcedDespawn(6000);
+ (*itr)->DespawnOrUnsummon(6000);
(*itr)->AI()->Talk(SAY_FREE);
}
}
@@ -1235,7 +1237,7 @@ class go_veil_skith_cage : public GameObjectScript
{
go->UseDoorOrButton();
player->KilledMonsterCredit(NPC_CAPTIVE_CHILD, (*itr)->GetGUID());
- (*itr)->ForcedDespawn(5000);
+ (*itr)->DespawnOrUnsummon(5000);
(*itr)->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ());
(*itr)->AI()->Talk(SAY_FREE_0);
(*itr)->GetMotionMaster()->Clear();
@@ -1245,6 +1247,58 @@ class go_veil_skith_cage : public GameObjectScript
}
};
+/*######
+## go_frostblade_shrine
+######*/
+
+enum TheCleansing
+{
+ QUEST_THE_CLEANSING_HORDE = 11317,
+ QUEST_THE_CLEANSING_ALLIANCE = 11322,
+ SPELL_CLEANSING_SOUL = 43351,
+ SPELL_RECENT_MEDITATION = 61720,
+};
+
+class go_frostblade_shrine : public GameObjectScript
+{
+public:
+ go_frostblade_shrine() : GameObjectScript("go_frostblade_shrine") { }
+
+ bool OnGossipHello(Player* player, GameObject* go)
+ {
+ if (!player->HasAura(SPELL_RECENT_MEDITATION))
+ if (player->GetQuestStatus(QUEST_THE_CLEANSING_HORDE) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_THE_CLEANSING_ALLIANCE) == QUEST_STATUS_INCOMPLETE)
+ {
+ go->UseDoorOrButton(10);
+ player->CastSpell(player, SPELL_CLEANSING_SOUL);
+ player->SetStandState(UNIT_STAND_STATE_SIT);
+ }
+ return true;
+ }
+};
+
+/*######
+## go_midsummer_bonfire
+######*/
+
+enum eMidsummerBonfire
+{
+ STAMP_OUT_BONFIRE_QUEST_COMPLETE = 45458,
+};
+
+class go_midsummer_bonfire : public GameObjectScript
+{
+public:
+ go_midsummer_bonfire() : GameObjectScript("go_midsummer_bonfire") { }
+
+ bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/)
+ {
+ player->CastSpell(player, STAMP_OUT_BONFIRE_QUEST_COMPLETE, true);
+ player->CLOSE_GOSSIP_MENU();
+ return false;
+ }
+};
+
void AddSC_go_scripts()
{
new go_cat_figurine;
@@ -1285,4 +1339,6 @@ void AddSC_go_scripts()
new go_gjalerbron_cage;
new go_large_gjalerbron_cage;
new go_veil_skith_cage;
+ new go_frostblade_shrine;
+ new go_midsummer_bonfire;
}
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index e3100522fbe..4b0433fe0c7 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -29,7 +29,8 @@ guard_shattrath_aldor
guard_shattrath_scryer
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "GuardAI.h"
enum GuardGeneric
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index ae69744ea2b..d888e6cb56b 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -30,7 +30,8 @@ item_gor_dreks_ointment(i30175) Protecting Our Own(q10488)
item_only_for_flight Items which should only useable while flying
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "Spell.h"
/*#####
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 208effee61b..be409670f5d 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -23,7 +23,9 @@ SDComment: Should be replaced with core based AI
SDCategory: Creatures
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#define GENERIC_CREATURE_COOLDOWN 5000
diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp
index fb7c0833d22..f57af517db2 100644
--- a/src/server/scripts/World/npc_innkeeper.cpp
+++ b/src/server/scripts/World/npc_innkeeper.cpp
@@ -23,7 +23,10 @@ SDComment: Complete
SDCategory: NPCs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "GameEventMgr.h"
#define HALLOWEEN_EVENTID 12
#define SPELL_TRICK_OR_TREATED 24755
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index 2afa80dd42c..175cfb190d7 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -23,7 +23,9 @@ SDComment: Provides learn/unlearn/relearn-options for professions. Not supported
SDCategory: NPCs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
/*
A few notes for future developement:
@@ -242,7 +244,7 @@ bool EquippedOk(Player* player, uint32 spellId)
if (item && item->GetTemplate()->RequiredSpell == reqSpell)
{
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
+ sLog->outDebug(LOG_FILTER_TSCR, "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
return false;
}
}
diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp
index ceda8e0f6ac..6241978fbd2 100644
--- a/src/server/scripts/World/npc_taxi.cpp
+++ b/src/server/scripts/World/npc_taxi.cpp
@@ -24,7 +24,9 @@ SDCategory: NPCs
EndScriptData
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#define GOSSIP_SUSURRUS "I am ready."
#define GOSSIP_NETHER_DRAKE "I'm ready to fly! Take me up, dragon!"
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 6858827ed8e..5640a84317c 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -42,11 +42,22 @@ npc_locksmith 75% list of keys needs to be confirmed
npc_firework 100% NPC's summoned by rockets and rocket clusters, for making them cast visual
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "World.h"
+#include "PetAI.h"
+#include "PassiveAI.h"
+#include "CombatAI.h"
+#include "GameEventMgr.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "SpellAuras.h"
/*########
# npc_air_force_bots
@@ -130,14 +141,14 @@ public:
}
if (!SpawnAssoc)
- sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
else
{
CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry);
if (!spawnedTemplate)
{
- sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
SpawnAssoc = NULL;
return;
}
@@ -157,7 +168,7 @@ public:
SpawnedGUID = summoned->GetGUID();
else
{
- sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
SpawnAssoc = NULL;
}
@@ -835,7 +846,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff)
patientEntry = HordeSoldierId[rand() % 3];
break;
default:
- sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database");
+ sLog->outError(LOG_FILTER_TSCR, "Invalid entry for Triage doctor. Please check your database");
return;
}
@@ -1975,33 +1986,31 @@ public:
class npc_lightwell : public CreatureScript
{
-public:
- npc_lightwell() : CreatureScript("npc_lightwell") { }
-
- struct npc_lightwellAI : public PassiveAI
- {
- npc_lightwellAI(Creature* creature) : PassiveAI(creature) {}
+ public:
+ npc_lightwell() : CreatureScript("npc_lightwell") { }
- void Reset()
+ struct npc_lightwellAI : public PassiveAI
{
- DoCast(me, 59907, false); // Spell for Lightwell Charges
- }
+ npc_lightwellAI(Creature* creature) : PassiveAI(creature)
+ {
+ DoCast(me, 59907, false);
+ }
- void EnterEvadeMode()
- {
- if (!me->isAlive())
- return;
+ void EnterEvadeMode()
+ {
+ if (!me->isAlive())
+ return;
- me->DeleteThreatList();
- me->CombatStop(true);
- me->ResetPlayerDamageReq();
- }
- };
+ me->DeleteThreatList();
+ me->CombatStop(true);
+ me->ResetPlayerDamageReq();
+ }
+ };
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_lightwellAI(creature);
- }
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_lightwellAI(creature);
+ }
};
enum eTrainingDummy
@@ -2099,34 +2108,28 @@ public:
class npc_shadowfiend : public CreatureScript
{
-public:
- npc_shadowfiend() : CreatureScript("npc_shadowfiend") { }
-
- struct npc_shadowfiendAI : public ScriptedAI
- {
- npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {}
+ public:
+ npc_shadowfiend() : CreatureScript("npc_shadowfiend") { }
- void DamageTaken(Unit* /*killer*/, uint32& damage)
+ struct npc_shadowfiendAI : public PetAI
{
- if (me->isSummon())
- if (Unit* owner = me->ToTempSummon()->GetSummoner())
- if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth())
- owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
- }
+ npc_shadowfiendAI(Creature* creature) : PetAI(creature) {}
- void UpdateAI(uint32 const /*diff*/)
- {
- if (!UpdateVictim())
- return;
+ void JustDied(Unit* killer)
+ {
+ if (me->isSummon())
+ if (Unit* owner = me->ToTempSummon()->GetSummoner())
+ if (owner->HasAura(GLYPH_OF_SHADOWFIEND))
+ owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
- DoMeleeAttackIfReady();
- }
- };
+ PetAI::JustDied(killer);
+ }
+ };
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_shadowfiendAI(creature);
- }
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_shadowfiendAI(creature);
+ }
};
/*######
@@ -2193,7 +2196,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_fire_elementalAI(creature);
}
@@ -2238,7 +2241,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_earth_elementalAI(creature);
}
@@ -2248,78 +2251,111 @@ public:
# npc_wormhole
######*/
-#define GOSSIP_ENGINEERING1 "Borean Tundra."
-#define GOSSIP_ENGINEERING2 "Howling Fjord."
-#define GOSSIP_ENGINEERING3 "Sholazar Basin."
-#define GOSSIP_ENGINEERING4 "Icecrown."
-#define GOSSIP_ENGINEERING5 "Storm Peaks."
+#define GOSSIP_ENGINEERING1 "Borean Tundra"
+#define GOSSIP_ENGINEERING2 "Howling Fjord"
+#define GOSSIP_ENGINEERING3 "Sholazar Basin"
+#define GOSSIP_ENGINEERING4 "Icecrown"
+#define GOSSIP_ENGINEERING5 "Storm Peaks"
+#define GOSSIP_ENGINEERING6 "Underground..."
-enum eWormhole
+enum WormholeSpells
{
- SPELL_HOWLING_FJORD = 67838,
+ SPELL_BOREAN_TUNDRA = 67834,
SPELL_SHOLAZAR_BASIN = 67835,
SPELL_ICECROWN = 67836,
SPELL_STORM_PEAKS = 67837,
+ SPELL_HOWLING_FJORD = 67838,
+ SPELL_UNDERGROUND = 68081,
+
+ TEXT_WORMHOLE = 907,
- TEXT_WORMHOLE = 907
+ DATA_SHOW_UNDERGROUND = 1,
};
class npc_wormhole : public CreatureScript
{
-public:
- npc_wormhole() : CreatureScript("npc_wormhole") { }
+ public:
+ npc_wormhole() : CreatureScript("npc_wormhole") {}
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isSummon())
+ struct npc_wormholeAI : public PassiveAI
+ {
+ npc_wormholeAI(Creature* creature) : PassiveAI(creature) {}
+
+ void InitializeAI()
+ {
+ _showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though
+ }
+
+ uint32 GetData(uint32 type)
+ {
+ return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0;
+ }
+
+ private:
+ bool _showUnderground;
+ };
+
+ bool OnGossipHello(Player* player, Creature* creature)
{
- if (player == creature->ToTempSummon()->GetSummoner())
+ if (creature->isSummon())
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
+ if (player == creature->ToTempSummon()->GetSummoner())
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
+
+ if (creature->AI()->GetData(DATA_SHOW_UNDERGROUND))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
- player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID());
+ player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID());
+ }
}
+
+ return true;
}
- return true;
- }
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- bool roll = urand(0, 1);
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ {
+ player->PlayerTalkClass->ClearMenus();
- switch (action)
+ switch (action)
+ {
+ case GOSSIP_ACTION_INFO_DEF + 1: // Borean Tundra
+ player->CLOSE_GOSSIP_MENU();
+ creature->CastSpell(player, SPELL_BOREAN_TUNDRA, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 2: // Howling Fjord
+ player->CLOSE_GOSSIP_MENU();
+ creature->CastSpell(player, SPELL_HOWLING_FJORD, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 3: // Sholazar Basin
+ player->CLOSE_GOSSIP_MENU();
+ creature->CastSpell(player, SPELL_SHOLAZAR_BASIN, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 4: // Icecrown
+ player->CLOSE_GOSSIP_MENU();
+ creature->CastSpell(player, SPELL_ICECROWN, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 5: // Storm peaks
+ player->CLOSE_GOSSIP_MENU();
+ creature->CastSpell(player, SPELL_STORM_PEAKS, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 6: // Underground
+ player->CLOSE_GOSSIP_MENU();
+ creature->CastSpell(player, SPELL_UNDERGROUND, false);
+ break;
+ }
+
+ return true;
+ }
+
+ CreatureAI* GetAI(Creature* creature) const
{
- case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra
- player->CLOSE_GOSSIP_MENU();
- if (roll) //At the moment we don't have chance on spell_target_position table so we hack this
- player->TeleportTo(571, 4305.505859f, 5450.839844f, 63.005806f, 0.627286f);
- else
- player->TeleportTo(571, 3201.936279f, 5630.123535f, 133.658798f, 3.855272f);
- break;
- case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_HOWLING_FJORD, true);
- break;
- case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_SHOLAZAR_BASIN, true);
- break;
- case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_ICECROWN, true);
- break;
- case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_STORM_PEAKS, true);
- break;
+ return new npc_wormholeAI(creature);
}
- return true;
- }
};
/*######
@@ -2400,6 +2436,9 @@ enum eLockSmith
QUEST_HOTTER_THAN_HELL_H = 10764,
QUEST_RETURN_TO_KHAGDAR = 9837,
QUEST_CONTAINMENT = 13159,
+ QUEST_ETERNAL_VIGILANCE = 11011,
+ QUEST_KEY_TO_THE_FOCUSING_IRIS = 13372,
+ QUEST_HC_KEY_TO_THE_FOCUSING_IRIS = 13375,
ITEM_ARCATRAZ_KEY = 31084,
ITEM_SHADOWFORGE_KEY = 11000,
@@ -2407,21 +2446,28 @@ enum eLockSmith
ITEM_SHATTERED_HALLS_KEY = 28395,
ITEM_THE_MASTERS_KEY = 24490,
ITEM_VIOLET_HOLD_KEY = 42482,
+ ITEM_ESSENCE_INFUSED_MOONSTONE = 32449,
+ ITEM_KEY_TO_THE_FOCUSING_IRIS = 44582,
+ ITEM_HC_KEY_TO_THE_FOCUSING_IRIS = 44581,
SPELL_ARCATRAZ_KEY = 54881,
SPELL_SHADOWFORGE_KEY = 54882,
SPELL_SKELETON_KEY = 54883,
SPELL_SHATTERED_HALLS_KEY = 54884,
SPELL_THE_MASTERS_KEY = 54885,
- SPELL_VIOLET_HOLD_KEY = 67253
+ SPELL_VIOLET_HOLD_KEY = 67253,
+ SPELL_ESSENCE_INFUSED_MOONSTONE = 40173,
};
-#define GOSSIP_LOST_ARCATRAZ_KEY "I've lost my key to the Arcatraz."
-#define GOSSIP_LOST_SHADOWFORGE_KEY "I've lost my key to the Blackrock Depths."
-#define GOSSIP_LOST_SKELETON_KEY "I've lost my key to the Scholomance."
-#define GOSSIP_LOST_SHATTERED_HALLS_KEY "I've lost my key to the Shattered Halls."
-#define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan."
-#define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold."
+#define GOSSIP_LOST_ARCATRAZ_KEY "I've lost my key to the Arcatraz."
+#define GOSSIP_LOST_SHADOWFORGE_KEY "I've lost my key to the Blackrock Depths."
+#define GOSSIP_LOST_SKELETON_KEY "I've lost my key to the Scholomance."
+#define GOSSIP_LOST_SHATTERED_HALLS_KEY "I've lost my key to the Shattered Halls."
+#define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan."
+#define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold."
+#define GOSSIP_LOST_ESSENCE_INFUSED_MOONSTONE "I've lost my Essence-Infused Moonstone."
+#define GOSSIP_LOST_KEY_TO_THE_FOCUSING_IRIS "I've lost my Key to the Focusing Iris."
+#define GOSSIP_LOST_HC_KEY_TO_THE_FOCUSING_IRIS "I've lost my Heroic Key to the Focusing Iris."
class npc_locksmith : public CreatureScript
{
@@ -2456,6 +2502,18 @@ public:
if (player->GetQuestRewardStatus(QUEST_CONTAINMENT) && !player->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
+ // Essence-Infused Moonstone
+ if (player->GetQuestRewardStatus(QUEST_ETERNAL_VIGILANCE) && !player->HasItemCount(ITEM_ESSENCE_INFUSED_MOONSTONE, 1, true))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ESSENCE_INFUSED_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
+
+ // Key to the Focusing Iris
+ if (player->GetQuestRewardStatus(QUEST_KEY_TO_THE_FOCUSING_IRIS) && !player->HasItemCount(ITEM_KEY_TO_THE_FOCUSING_IRIS, 1, true))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_KEY_TO_THE_FOCUSING_IRIS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8);
+
+ // Heroic Key to the Focusing Iris
+ if (player->GetQuestRewardStatus(QUEST_HC_KEY_TO_THE_FOCUSING_IRIS) && !player->HasItemCount(ITEM_HC_KEY_TO_THE_FOCUSING_IRIS, 1, true))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_HC_KEY_TO_THE_FOCUSING_IRIS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
+
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
@@ -2490,171 +2548,17 @@ public:
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_VIOLET_HOLD_KEY, false);
break;
- }
- return true;
- }
-};
-
-/*######
-## npc_tabard_vendor
-######*/
-
-enum
-{
- QUEST_TRUE_MASTERS_OF_LIGHT = 9737,
- QUEST_THE_UNWRITTEN_PROPHECY = 9762,
- QUEST_INTO_THE_BREACH = 10259,
- QUEST_BATTLE_OF_THE_CRIMSON_WATCH = 10781,
- QUEST_SHARDS_OF_AHUNE = 11972,
-
- ACHIEVEMENT_EXPLORE_NORTHREND = 45,
- ACHIEVEMENT_TWENTYFIVE_TABARDS = 1021,
- ACHIEVEMENT_THE_LOREMASTER_A = 1681,
- ACHIEVEMENT_THE_LOREMASTER_H = 1682,
-
- ITEM_TABARD_OF_THE_HAND = 24344,
- ITEM_TABARD_OF_THE_BLOOD_KNIGHT = 25549,
- ITEM_TABARD_OF_THE_PROTECTOR = 28788,
- ITEM_OFFERING_OF_THE_SHATAR = 31408,
- ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 31404,
- ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 31405,
- ITEM_TABARD_OF_THE_SUMMER_SKIES = 35279,
- ITEM_TABARD_OF_THE_SUMMER_FLAMES = 35280,
- ITEM_TABARD_OF_THE_ACHIEVER = 40643,
- ITEM_LOREMASTERS_COLORS = 43300,
- ITEM_TABARD_OF_THE_EXPLORER = 43348,
-
- SPELL_TABARD_OF_THE_BLOOD_KNIGHT = 54974,
- SPELL_TABARD_OF_THE_HAND = 54976,
- SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI = 54977,
- SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI = 54982,
- SPELL_TABARD_OF_THE_ACHIEVER = 55006,
- SPELL_TABARD_OF_THE_PROTECTOR = 55008,
- SPELL_LOREMASTERS_COLORS = 58194,
- SPELL_TABARD_OF_THE_EXPLORER = 58224,
- SPELL_TABARD_OF_SUMMER_SKIES = 62768,
- SPELL_TABARD_OF_SUMMER_FLAMES = 62769
-};
-
-#define GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT "I've lost my Tabard of Blood Knight."
-#define GOSSIP_LOST_TABARD_OF_THE_HAND "I've lost my Tabard of the Hand."
-#define GOSSIP_LOST_TABARD_OF_THE_PROTECTOR "I've lost my Tabard of the Protector."
-#define GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Green Trophy Tabard of the Illidari."
-#define GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI "I've lost my Purple Trophy Tabard of the Illidari."
-#define GOSSIP_LOST_TABARD_OF_SUMMER_SKIES "I've lost my Tabard of Summer Skies."
-#define GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES "I've lost my Tabard of Summer Flames."
-#define GOSSIP_LOST_LOREMASTERS_COLORS "I've lost my Loremaster's Colors."
-#define GOSSIP_LOST_TABARD_OF_THE_EXPLORER "I've lost my Tabard of the Explorer."
-#define GOSSIP_LOST_TABARD_OF_THE_ACHIEVER "I've lost my Tabard of the Achiever."
-
-class npc_tabard_vendor : public CreatureScript
-{
-public:
- npc_tabard_vendor() : CreatureScript("npc_tabard_vendor") { }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- bool lostBloodKnight = false;
- bool lostHand = false;
- bool lostProtector = false;
- bool lostIllidari = false;
- bool lostSummer = false;
-
- //Tabard of the Blood Knight
- if (player->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !player->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true))
- lostBloodKnight = true;
-
- //Tabard of the Hand
- if (player->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !player->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true))
- lostHand = true;
-
- //Tabard of the Protector
- if (player->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !player->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true))
- lostProtector = true;
-
- //Green Trophy Tabard of the Illidari
- //Purple Trophy Tabard of the Illidari
- if (player->GetQuestRewardStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) &&
- (!player->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) &&
- !player->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) &&
- !player->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true)))
- lostIllidari = true;
-
- //Tabard of Summer Skies
- //Tabard of Summer Flames
- if (player->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) &&
- !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) &&
- !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true))
- lostSummer = true;
-
- if (lostBloodKnight || lostHand || lostProtector || lostIllidari || lostSummer)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
-
- if (lostBloodKnight)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
-
- if (lostHand)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
-
- if (lostProtector)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
-
- if (lostIllidari)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
- }
-
- if (lostSummer)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
- }
-
- player->SEND_GOSSIP_MENU(13583, creature->GetGUID());
- }
- else
- player->GetSession()->SendListInventory(creature->GetGUID());
-
- return true;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_TRADE:
- player->GetSession()->SendListInventory(creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF + 1:
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 2:
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_TABARD_OF_THE_HAND, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 3:
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_TABARD_OF_THE_PROTECTOR, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 4:
- player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 5:
+ case GOSSIP_ACTION_INFO_DEF + 7:
player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false);
+ player->CastSpell(player, SPELL_ESSENCE_INFUSED_MOONSTONE, false);
break;
- case GOSSIP_ACTION_INFO_DEF + 6:
+ case GOSSIP_ACTION_INFO_DEF + 8:
player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_TABARD_OF_SUMMER_SKIES, false);
+ player->AddItem(ITEM_KEY_TO_THE_FOCUSING_IRIS,1);
break;
- case GOSSIP_ACTION_INFO_DEF + 7:
+ case GOSSIP_ACTION_INFO_DEF + 9:
player->CLOSE_GOSSIP_MENU();
- player->CastSpell(player, SPELL_TABARD_OF_SUMMER_FLAMES, false);
+ player->AddItem(ITEM_HC_KEY_TO_THE_FOCUSING_IRIS,1);
break;
}
return true;
@@ -2997,7 +2901,7 @@ public:
}
};
- CreatureAI *GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const
{
return new npc_fireworkAI(creature);
}
@@ -3097,6 +3001,31 @@ public:
};
};
+/*######
+## npc_generic_harpoon_cannon
+######*/
+
+class npc_generic_harpoon_cannon : public CreatureScript
+{
+public:
+ npc_generic_harpoon_cannon() : CreatureScript("npc_generic_harpoon_cannon") { }
+
+ struct npc_generic_harpoon_cannonAI : public ScriptedAI
+ {
+ npc_generic_harpoon_cannonAI(Creature* creature) : ScriptedAI(creature) {}
+
+ void Reset()
+ {
+ me->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_generic_harpoon_cannonAI(creature);
+ }
+};
+
void AddSC_npcs_special()
{
new npc_air_force_bots();
@@ -3124,10 +3053,10 @@ void AddSC_npcs_special()
new npc_wormhole();
new npc_pet_trainer();
new npc_locksmith();
- new npc_tabard_vendor();
new npc_experience();
new npc_fire_elemental();
new npc_earth_elemental();
new npc_firework();
new npc_spring_rabbit();
+ new npc_generic_harpoon_cannon();
}
diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h
index 988c46cc5a2..19f0680c267 100644
--- a/src/server/shared/AutoPtr.h
+++ b/src/server/shared/AutoPtr.h
@@ -27,7 +27,7 @@ namespace Trinity
{
public:
AutoPtr() : ACE_Strong_Bound_Ptr<Pointer, Lock>() {}
-
+
AutoPtr(Pointer* x)
{
ACE_Strong_Bound_Ptr<Pointer, Lock>::reset(x);
diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp
index b82d86cc5d0..e0df22b88ae 100755
--- a/src/server/shared/Configuration/Config.cpp
+++ b/src/server/shared/Configuration/Config.cpp
@@ -80,7 +80,7 @@ std::string GetStringDefault(const char* name, const std::string &def)
{
ACE_TString val;
return GetValueHelper(name, val) ? val.c_str() : def;
-};
+}
bool GetBoolDefault(const char* name, bool def)
{
@@ -91,19 +91,19 @@ bool GetBoolDefault(const char* name, bool def)
return (val == "true" || val == "TRUE" || val == "yes" || val == "YES" ||
val == "1");
-};
+}
int GetIntDefault(const char* name, int def)
{
ACE_TString val;
return GetValueHelper(name, val) ? atoi(val.c_str()) : def;
-};
+}
float GetFloatDefault(const char* name, float def)
{
ACE_TString val;
return GetValueHelper(name, val) ? (float)atof(val.c_str()) : def;
-};
+}
const std::string & GetFilename()
{
diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h
index a870379881b..82e4d9bcce0 100755
--- a/src/server/shared/Configuration/Config.h
+++ b/src/server/shared/Configuration/Config.h
@@ -34,4 +34,3 @@ namespace ConfigMgr
}
#endif
-
diff --git a/src/server/shared/Cryptography/ARC4.cpp b/src/server/shared/Cryptography/ARC4.cpp
index 52a60573eca..5b2cf7a0a93 100755
--- a/src/server/shared/Cryptography/ARC4.cpp
+++ b/src/server/shared/Cryptography/ARC4.cpp
@@ -19,14 +19,14 @@
#include "ARC4.h"
#include <openssl/sha.h>
-ARC4::ARC4(uint8 len)
+ARC4::ARC4(uint8 len) : m_ctx()
{
EVP_CIPHER_CTX_init(&m_ctx);
EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);
EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
}
-ARC4::ARC4(uint8 *seed, uint8 len)
+ARC4::ARC4(uint8 *seed, uint8 len) : m_ctx()
{
EVP_CIPHER_CTX_init(&m_ctx);
EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);
diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.h b/src/server/shared/Cryptography/Authentication/AuthCrypt.h
index 7081b4973d4..b40ce8ac40c 100755
--- a/src/server/shared/Cryptography/Authentication/AuthCrypt.h
+++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.h
@@ -41,4 +41,3 @@ class AuthCrypt
bool _initialized;
};
#endif
-
diff --git a/src/server/shared/Cryptography/WardenKeyGeneration.h b/src/server/shared/Cryptography/WardenKeyGeneration.h
index 9b44ab1832e..f0a9905b6fe 100644
--- a/src/server/shared/Cryptography/WardenKeyGeneration.h
+++ b/src/server/shared/Cryptography/WardenKeyGeneration.h
@@ -21,50 +21,56 @@
#ifndef _WARDEN_KEY_GENERATION_H
#define _WARDEN_KEY_GENERATION_H
-class SHA1Randx {
+class SHA1Randx
+{
public:
- SHA1Randx(uint8 *buff, uint32 size) {
+ SHA1Randx(uint8* buff, uint32 size)
+ {
uint32 taken = size/2;
sh.Initialize();
- sh.UpdateData(buff,taken);
+ sh.UpdateData(buff, taken);
sh.Finalize();
- memcpy(o1,sh.GetDigest(),20);
+ memcpy(o1, sh.GetDigest(), 20);
sh.Initialize();
- sh.UpdateData(buff+taken,size-taken);
+ sh.UpdateData(buff + taken, size - taken);
sh.Finalize();
- memcpy(o2,sh.GetDigest(),20);
+ memcpy(o2, sh.GetDigest(), 20);
- memset(o0,0x00,20);
+ memset(o0, 0x00, 20);
- fillUp();
+ FillUp();
}
- void generate(uint8 *buf, uint32 sz) {
- for(uint32 i=0;i<sz;i++) {
- if(taken == 20) {
- fillUp();
- }
+ void Generate(uint8* buf, uint32 sz)
+ {
+ for (uint32 i = 0; i < sz; ++i)
+ {
+ if (taken == 20)
+ FillUp();
buf[i] = o0[taken];
taken++;
}
}
+
private:
- void fillUp() {
+ void FillUp()
+ {
sh.Initialize();
- sh.UpdateData(o1,20);
- sh.UpdateData(o0,20);
- sh.UpdateData(o2,20);
+ sh.UpdateData(o1, 20);
+ sh.UpdateData(o0, 20);
+ sh.UpdateData(o2, 20);
sh.Finalize();
- memcpy(o0,sh.GetDigest(),20);
+ memcpy(o0, sh.GetDigest(), 20);
taken = 0;
}
+
SHA1Hash sh;
uint32 taken;
uint8 o0[20],o1[20],o2[20];
diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h
index c5b8b6f5a21..9965a5c1d71 100755
--- a/src/server/shared/DataStores/DBCStore.h
+++ b/src/server/shared/DataStores/DBCStore.h
@@ -117,7 +117,7 @@ class DBCStorage
// Check if sql index pos is valid
if (int32(result->GetFieldCount()-1) < sql->sqlIndexPos)
{
- sLog->outError("Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str());
return false;
}
}
@@ -148,7 +148,7 @@ class DBCStorage
uint32 id = fields[sql->sqlIndexPos].GetUInt32();
if (indexTable.asT[id])
{
- sLog->outError("Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str());
return false;
}
indexTable.asT[id]=(T*)&sqlDataTable[offset];
@@ -203,7 +203,7 @@ class DBCStorage
offset+=1;
break;
case FT_STRING:
- sLog->outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
+ sLog->outError(LOG_FILTER_GENERAL, "Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
return false;
case FT_SORT:
break;
@@ -215,13 +215,13 @@ class DBCStorage
}
else
{
- sLog->outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
+ sLog->outError(LOG_FILTER_GENERAL, "Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
return false;
}
}
if (sqlColumnNumber != (result->GetFieldCount()-1))
{
- sLog->outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str());
return false;
}
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index 5fe31006bb2..9d6fabb9dfa 100755
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -64,7 +64,7 @@ class DatabaseWorkerPool
bool res = true;
_connectionInfo = MySQLConnectionInfo(infoString);
- sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
GetDatabaseName(), async_threads, synch_threads);
//! Open asynchronous connections (delayed operations)
@@ -88,21 +88,21 @@ class DatabaseWorkerPool
}
if (res)
- sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
(_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
else
- sLog->outError("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
+ sLog->outError(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
"for specific errors.", GetDatabaseName());
return res;
}
void Close()
{
- sLog->outSQLDriver("Closing down DatabasePool '%s'.", GetDatabaseName());
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName());
//! Shuts down delaythreads for this connection pool by underlying deactivate().
//! The next dequeue attempt in the worker thread tasks will result in an error,
- //! ultimately ending the worker thread task.
+ //! ultimately ending the worker thread task.
_queue->queue()->close();
for (uint8 i = 0; i < _connectionCount[IDX_ASYNC]; ++i)
@@ -114,7 +114,7 @@ class DatabaseWorkerPool
t->Close(); //! Closes the actualy MySQL connection.
}
- sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
GetDatabaseName());
//! Shut down the synchronous connections
@@ -127,7 +127,7 @@ class DatabaseWorkerPool
//! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue
delete _queue;
- sLog->outSQLDriver("All connections on DatabasePool '%s' closed.", GetDatabaseName());
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName());
}
/**
@@ -239,7 +239,7 @@ class DatabaseWorkerPool
va_list ap;
char szQuery[MAX_QUERY_LEN];
- va_start(ap, sql);
+ va_start(ap, conn);
vsnprintf(szQuery, MAX_QUERY_LEN, sql, ap);
va_end(ap);
@@ -351,10 +351,10 @@ class DatabaseWorkerPool
switch (transaction->GetSize())
{
case 0:
- sLog->outSQLDriver("Transaction contains 0 queries. Not executing.");
+ sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing.");
return;
case 1:
- sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
+ sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
break;
default:
break;
diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h
index bfa42dbe574..61e8fb7ccef 100755
--- a/src/server/shared/Database/Field.h
+++ b/src/server/shared/Database/Field.h
@@ -43,7 +43,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
- sLog->outSQLDriver("Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -61,7 +61,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
- sLog->outSQLDriver("Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -79,7 +79,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
- sLog->outSQLDriver("Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -97,7 +97,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
- sLog->outSQLDriver("Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -115,7 +115,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
- sLog->outSQLDriver("Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -133,7 +133,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
- sLog->outSQLDriver("Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -151,7 +151,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
- sLog->outSQLDriver("Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -169,7 +169,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
- sLog->outSQLDriver("Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -187,7 +187,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_FLOAT))
{
- sLog->outSQLDriver("Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
return 0.0f;
}
#endif
@@ -205,7 +205,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_DOUBLE))
{
- sLog->outSQLDriver("Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
return 0.0f;
}
#endif
@@ -223,7 +223,7 @@ class Field
#ifdef TRINITY_DEBUG
if (IsNumeric())
{
- sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
return NULL;
}
#endif
@@ -322,7 +322,7 @@ class Field
MYSQL_TYPE_SET:
*/
default:
- sLog->outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type));
+ sLog->outWarn(LOG_FILTER_SQL, "SQL::SizeForType(): invalid field type %u", uint32(field->type));
return 0;
}
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 772a52b62cf..c7a283c94d7 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -33,6 +33,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHAR_CREATE_INFO, "SELECT level, race, class FROM characters WHERE account = ? LIMIT 0, ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_INS_CHARACTER_BAN, "INSERT INTO character_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_UPD_CHARACTER_BAN, "UPDATE character_banned SET active = 0 WHERE guid = ? AND active != 0", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_CHARACTER_BAN, "DELETE cb FROM character_banned cb INNER JOIN characters c ON c.guid = cb.guid WHERE c.account = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_SEL_BANINFO, "SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid = ? ORDER BY bandate ASC", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_GUID_BY_NAME_FILTER, "SELECT guid, name FROM characters WHERE name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_BANINFO_LIST, "SELECT bandate, unbandate, bannedby, banreason FROM character_banned WHERE guid = ? ORDER BY unbandate", CONNECTION_SYNCH)
@@ -93,7 +94,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_GUILD_MEMBER, "SELECT guildid, rank FROM guild_member WHERE guid = ?", CONNECTION_BOTH)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_CRITERIAPROGRESS, "SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, "
+ PREPARE_STATEMENT(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, "
"item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = ? ORDER BY setindex", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_BGDATA, "SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell FROM character_battleground_data WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_GLYPHS, "SELECT spec, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 FROM character_glyphs WHERE guid = ?", CONNECTION_ASYNC)
@@ -108,7 +109,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? ORDER BY button", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_MAILITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, item_guid, itemEntry, owner_guid FROM mail_items mi JOIN item_instance ii ON mi.item_guid = ii.guid WHERE mail_id = ?", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_AUCTION_ITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, itemguid, itemEntry FROM auctionhouse ah JOIN item_instance ii ON ah.itemguid = ii.guid", CONNECTION_SYNCH)
- PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, auctioneerguid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_AUCTION, "DELETE FROM auctionhouse WHERE id = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_AUCTION_BY_TIME, "SELECT id FROM auctionhouse WHERE time <= ? ORDER BY TIME ASC", CONNECTION_SYNCH);
@@ -234,8 +235,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_DEL_OLD_CHANNELS, "DELETE FROM channels WHERE ownership = 1 AND lastUsed + ? < UNIX_TIMESTAMP()", CONNECTION_ASYNC)
// Equipmentsets
- PREPARE_STATEMENT(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, item0=?, item1=?, item2=?, item3=?, item4=?, item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_INS_EQUIP_SET, "INSERT INTO character_equipmentsets (guid, setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, item4=?, item5=?, item6=?, item7=?, item8=?, item9=?, item10=?, item11=?, item12=?, item13=?, item14=?, item15=?, item16=?, item17=?, item18=? WHERE guid=? AND setguid=? AND setindex=?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_INS_EQUIP_SET, "INSERT INTO character_equipmentsets (guid, setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_EQUIP_SET, "DELETE FROM character_equipmentsets WHERE setguid=?", CONNECTION_ASYNC)
// Auras
@@ -313,18 +314,17 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC)
// Creature respawn
- PREPARE_STATEMENT(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime, instanceId FROM creature_respawn", CONNECTION_SYNCH)
- PREPARE_STATEMENT(CHAR_REP_CREATURE_RESPAWN, "REPLACE INTO creature_respawn (guid, respawnTime, instanceId) VALUES (?, ?, ?)", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN, "DELETE FROM creature_respawn WHERE guid = ? AND instanceId = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_GUID, "DELETE FROM creature_respawn WHERE guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, "DELETE FROM creature_respawn WHERE instanceId = ?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_REP_CREATURE_RESPAWN, "REPLACE INTO creature_respawn (guid, respawnTime, mapId, instanceId) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN, "DELETE FROM creature_respawn WHERE guid = ? AND mapId = ? AND instanceId = ?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, "DELETE FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_MAX_CREATURE_RESPAWNS, "SELECT MAX(respawnTime), instanceId FROM creature_respawn WHERE instanceId > 0 GROUP BY instanceId", CONNECTION_SYNCH)
// Gameobject respawn
- PREPARE_STATEMENT(CHAR_SEL_GO_RESPAWNS, "SELECT guid, respawnTime, instanceId FROM gameobject_respawn", CONNECTION_SYNCH)
- PREPARE_STATEMENT(CHAR_REP_GO_RESPAWN, "REPLACE INTO gameobject_respawn (guid, respawnTime, instanceId) VALUES (?, ?, ?)", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN, "DELETE FROM gameobject_respawn WHERE guid = ? AND instanceId = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE instanceId = ?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_SEL_GO_RESPAWNS, "SELECT guid, respawnTime FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_REP_GO_RESPAWN, "REPLACE INTO gameobject_respawn (guid, respawnTime, mapId, instanceId) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN, "DELETE FROM gameobject_respawn WHERE guid = ? AND mapId = ? AND instanceId = ?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC)
// GM Tickets
PREPARE_STATEMENT(CHAR_SEL_GM_TICKETS, "SELECT ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed FROM gm_tickets", CONNECTION_SYNCH)
@@ -338,7 +338,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_INS_LAG_REPORT, "INSERT INTO lag_reports (guid, lagType, mapId, posX, posY, posZ, latency, createTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
// For loading and deleting expired auctions at startup
- PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH)
// LFG Data
PREPARE_STATEMENT(CHAR_INS_LFG_DATA, "INSERT INTO lfg_data (guid, dungeon, state) VALUES (?, ?, ?)", CONNECTION_ASYNC)
@@ -435,8 +435,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_PET_SPELL, "SELECT spell, active FROM pet_spell WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_COOLDOWN, "SELECT spell, time FROM pet_spell_cooldown WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_PET_DECLINED_NAME, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = ? AND id = ?", CONNECTION_SYNCH);
- PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT characters.guid FROM characters WHERE characters.name = ?", CONNECTION_SYNCH);
- PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_BY_NAME, "SELECT guid FROM characters WHERE name = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA_FROZEN, "DELETE FROM character_aura WHERE spell = 9454 AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM character_inventory ci INNER JOIN item_instance ii ON ii.guid = ci.item WHERE itemEntry = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_MAIL_COUNT_ITEM, "SELECT COUNT(itemEntry) FROM mail_items mi INNER JOIN item_instance ii ON ii.guid = mi.item_guid WHERE itemEntry = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM,"SELECT COUNT(itemEntry) FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE itemEntry = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index d2c9f3b3ac4..e1530f36e44 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -53,6 +53,7 @@ enum CharacterDatabaseStatements
CHAR_SEL_CHAR_CREATE_INFO,
CHAR_INS_CHARACTER_BAN,
CHAR_UPD_CHARACTER_BAN,
+ CHAR_DEL_CHARACTER_BAN,
CHAR_SEL_BANINFO,
CHAR_SEL_GUID_BY_NAME_FILTER,
CHAR_SEL_BANINFO_LIST,
@@ -295,7 +296,6 @@ enum CharacterDatabaseStatements
CHAR_SEL_CREATURE_RESPAWNS,
CHAR_REP_CREATURE_RESPAWN,
CHAR_DEL_CREATURE_RESPAWN,
- CHAR_DEL_CREATURE_RESPAWN_BY_GUID,
CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE,
CHAR_SEL_MAX_CREATURE_RESPAWNS,
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 70d874be31d..31d9f5ec1f6 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -33,6 +33,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH);
PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH);
PREPARE_STATEMENT(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban', 1)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH)
PREPARE_STATEMENT(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_ASYNC)
@@ -58,7 +59,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
- PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
@@ -86,5 +87,4 @@ void LoginDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
-
}
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 2b9d94cbceb..7c2a94eec94 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -51,6 +51,7 @@ enum LoginDatabaseStatements
LOGIN_SEL_ACCOUNT_BANNED_ALL,
LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME,
LOGIN_INS_ACCOUNT_AUTO_BANNED,
+ LOGIN_DEL_ACCOUNT_BANNED,
LOGIN_SEL_SESSIONKEY,
LOGIN_UPD_VS,
LOGIN_UPD_LOGONPROOF,
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index e3455891909..872d9ec415c 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -88,4 +88,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h
index 0580cecec7e..6d7df87cc80 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.h
+++ b/src/server/shared/Database/Implementation/WorldDatabase.h
@@ -109,6 +109,9 @@ enum WorldDatabaseStatements
WORLD_DEL_GAME_EVENT_CREATURE,
WORLD_DEL_GAME_EVENT_MODEL_EQUIP,
WORLD_INS_GAMEOBJECT,
+ WORLD_SEL_DISABLES,
+ WORLD_INS_DISABLES,
+ WORLD_DEL_DISABLES,
MAX_WORLDDATABASE_STATEMENTS,
};
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index 7fb4a4f7025..c6d2a165ca2 100755
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -22,6 +22,8 @@
#include <winsock2.h>
#endif
#include <mysql.h>
+#include <mysqld_error.h>
+#include <errmsg.h>
#include "MySQLConnection.h"
#include "MySQLThreading.h"
@@ -79,7 +81,7 @@ bool MySQLConnection::Open()
mysqlInit = mysql_init(NULL);
if (!mysqlInit)
{
- sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
return false;
}
@@ -123,13 +125,13 @@ bool MySQLConnection::Open()
{
if (!m_reconnecting)
{
- sLog->outSQLDriver("MySQL client library: %s", mysql_get_client_info());
- sLog->outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
+ sLog->outInfo(LOG_FILTER_SQL, "MySQL client library: %s", mysql_get_client_info());
+ sLog->outInfo(LOG_FILTER_SQL, "MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
if (mysql_get_server_version(m_Mysql) != mysql_get_client_version())
- sLog->outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
+ sLog->outInfo(LOG_FILTER_SQL, "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
}
- sLog->outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str());
+ sLog->outInfo(LOG_FILTER_SQL, "Connected to MySQL database at %s", m_connectionInfo.host.c_str());
mysql_autocommit(m_Mysql, 1);
// set connection properties to UTF8 to properly handle locales for different
@@ -139,7 +141,7 @@ bool MySQLConnection::Open()
}
else
{
- sLog->outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
+ sLog->outError(LOG_FILTER_SQL, "Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
mysql_close(mysqlInit);
return false;
}
@@ -159,26 +161,22 @@ bool MySQLConnection::Execute(const char* sql)
return false;
{
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_query(m_Mysql, sql))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL: %s", sql);
- sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
+ sLog->outInfo(LOG_FILTER_SQL, "SQL: %s", sql);
+ sLog->outError(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(sql); // Try again
return false;
}
- else if (sLog->GetSQLDriverQueryLogging())
- {
- sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
- }
+ else
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
}
return true;
@@ -201,14 +199,12 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT();
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(stmt); // Try again
@@ -220,7 +216,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
if (mysql_stmt_execute(msql_STMT))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(stmt); // Try again
@@ -229,8 +225,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
return false;
}
- if (sLog->GetSQLDriverQueryLogging())
- sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
m_mStmt->ClearParameters();
return true;
@@ -254,14 +249,12 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT();
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(stmt, pResult, pRowCount, pFieldCount); // Try again
@@ -273,7 +266,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
if (mysql_stmt_execute(msql_STMT))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s",
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s",
m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
@@ -283,8 +276,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
return false;
}
- if (sLog->GetSQLDriverQueryLogging())
- sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
m_mStmt->ClearParameters();
@@ -319,25 +311,21 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD *
return false;
{
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_query(m_Mysql, sql))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL: %s", sql);
- sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
+ sLog->outInfo(LOG_FILTER_SQL, "SQL: %s", sql);
+ sLog->outError(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again
return false;
}
- else if (sLog->GetSQLDriverQueryLogging())
- {
- sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
- }
+ else
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
*pResult = mysql_store_result(m_Mysql);
*pRowCount = mysql_affected_rows(m_Mysql);
@@ -393,7 +381,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
ASSERT(stmt);
if (!Execute(stmt))
{
- sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
+ sLog->outWarn(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size());
RollbackTransaction();
return false;
}
@@ -405,7 +393,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
ASSERT(sql);
if (!Execute(sql))
{
- sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
+ sLog->outWarn(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size());
RollbackTransaction();
return false;
}
@@ -428,7 +416,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index)
ASSERT(index < m_stmts.size());
MySQLPreparedStatement* ret = m_stmts[index];
if (!ret)
- sLog->outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.",
+ sLog->outError(LOG_FILTER_SQL, "Could not fetch prepared statement %u on database `%s`, connection type: %s.",
index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
return ret;
@@ -449,19 +437,19 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection
return;
}
- MYSQL_STMT * stmt = mysql_stmt_init(m_Mysql);
+ MYSQL_STMT* stmt = mysql_stmt_init(m_Mysql);
if (!stmt)
{
- sLog->outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
- sLog->outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
+ sLog->outError(LOG_FILTER_SQL, "In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
+ sLog->outError(LOG_FILTER_SQL, "%s", mysql_error(m_Mysql));
m_prepareError = true;
}
else
{
if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql))))
{
- sLog->outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
- sLog->outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt));
+ sLog->outError(LOG_FILTER_SQL, "In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
+ sLog->outError(LOG_FILTER_SQL, "%s", mysql_stmt_error(stmt));
mysql_stmt_close(stmt);
m_prepareError = true;
}
@@ -493,19 +481,19 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
{
switch (errNo)
{
- case 2006: // "MySQL server has gone away"
- case 2013: // "Lost connection to MySQL server during query"
- case 2048: // "Invalid connection handle"
- case 2055: // "Lost connection to MySQL server at '%s', system error: %d"
+ case CR_SERVER_GONE_ERROR:
+ case CR_SERVER_LOST:
+ case CR_INVALID_CONN_HANDLE:
+ case CR_SERVER_LOST_EXTENDED:
{
m_reconnecting = true;
uint64 oldThreadId = mysql_thread_id(GetHandle());
mysql_close(GetHandle());
if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements....
{
- sLog->outSQLDriver("Connection to the MySQL server is active.");
+ sLog->outInfo(LOG_FILTER_SQL, "Connection to the MySQL server is active.");
if (oldThreadId != mysql_thread_id(GetHandle()))
- sLog->outSQLDriver("Successfully reconnected to %s @%s:%s (%s).",
+ sLog->outInfo(LOG_FILTER_SQL, "Successfully reconnected to %s @%s:%s (%s).",
m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(),
(m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
@@ -518,21 +506,27 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
return _HandleMySQLErrno(lErrno); // Call self (recursive)
}
- case 1213: // "Deadlock found when trying to get lock; try restarting transaction"
+ case ER_LOCK_DEADLOCK:
return false; // Implemented in TransactionTask::Execute and DatabaseWorkerPool<T>::DirectCommitTransaction
// Query related errors - skip query
- case 1058: // "Column count doesn't match value count"
- case 1062: // "Duplicate entry '%s' for key '%d'"
+ case ER_WRONG_VALUE_COUNT:
+ case ER_DUP_ENTRY:
return false;
// Outdated table or database structure - terminate core
- case 1054: // "Unknown column '%s' in '%s'"
- case 1146: // "Table '%s' doesn't exist"
- WPFatal(!errNo, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
+ case ER_BAD_FIELD_ERROR:
+ case ER_NO_SUCH_TABLE:
+ sLog->outError(LOG_FILTER_SQL, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
+ ACE_OS::sleep(10);
+ std::abort();
+ return false;
+ case ER_PARSE_ERROR:
+ sLog->outError(LOG_FILTER_SQL, "Error while parsing SQL. Core fix required.");
+ ACE_OS::sleep(10);
+ std::abort();
return false;
-
default:
- sLog->outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
+ sLog->outError(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
return false;
}
}
diff --git a/src/server/shared/Database/MySQLThreading.h b/src/server/shared/Database/MySQLThreading.h
index 2004ee9826c..038ec4ee794 100755
--- a/src/server/shared/Database/MySQLThreading.h
+++ b/src/server/shared/Database/MySQLThreading.h
@@ -33,7 +33,7 @@ class MySQL
static void Thread_Init()
{
mysql_thread_init();
- sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] initializing MySQL thread.",
+ sLog->outWarn(LOG_FILTER_SQL, "Core thread with ID ["UI64FMTD"] initializing MySQL thread.",
(uint64)ACE_Based::Thread::currentId());
}
@@ -44,7 +44,7 @@ class MySQL
static void Thread_End()
{
mysql_thread_end();
- sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] shutting down MySQL thread.",
+ sLog->outWarn(LOG_FILTER_SQL, "Core thread with ID ["UI64FMTD"] shutting down MySQL thread.",
(uint64)ACE_Based::Thread::currentId());
}
diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp
index db26dabaee7..a72532e928b 100755
--- a/src/server/shared/Database/PreparedStatement.cpp
+++ b/src/server/shared/Database/PreparedStatement.cpp
@@ -78,7 +78,7 @@ void PreparedStatement::BindParameters()
}
#ifdef _DEBUG
if (i < m_stmt->m_paramCount)
- sLog->outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
+ sLog->outWarn(LOG_FILTER_SQL, "[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
#endif
}
@@ -209,7 +209,7 @@ m_bind(NULL)
MySQLPreparedStatement::~MySQLPreparedStatement()
{
ClearParameters();
- if(m_Mstmt->bind_result_done)
+ if (m_Mstmt->bind_result_done)
{
delete[] m_Mstmt->bind->length;
delete[] m_Mstmt->bind->is_null;
@@ -237,7 +237,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index)
return false;
if (m_paramsSet[index])
- sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
+ sLog->outWarn(LOG_FILTER_SQL, "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
return true;
}
diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp
index a3602531205..99772c7e323 100755
--- a/src/server/shared/Database/QueryHolder.cpp
+++ b/src/server/shared/Database/QueryHolder.cpp
@@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql)
{
if (m_queries.size() <= index)
{
- sLog->outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql);
+ sLog->outError(LOG_FILTER_SQL, "Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql);
return false;
}
@@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
{
if (!format)
{
- sLog->outError("Query (index: %zu) is empty.", index);
+ sLog->outError(LOG_FILTER_SQL, "Query (index: %zu) is empty.", index);
return false;
}
@@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
if (res == -1)
{
- sLog->outError("SQL Query truncated (and not execute) for format: %s", format);
+ sLog->outError(LOG_FILTER_SQL, "SQL Query truncated (and not execute) for format: %s", format);
return false;
}
@@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt)
{
if (m_queries.size() <= index)
{
- sLog->outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size());
+ sLog->outError(LOG_FILTER_SQL, "Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size());
return false;
}
diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp
index 95034387089..cb21c088d00 100755
--- a/src/server/shared/Database/QueryResult.cpp
+++ b/src/server/shared/Database/QueryResult.cpp
@@ -59,7 +59,7 @@ m_length(NULL)
//- This is where we store the (entire) resultset
if (mysql_stmt_store_result(m_stmt))
{
- sLog->outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
+ sLog->outWarn(LOG_FILTER_SQL, "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
return;
}
@@ -86,7 +86,7 @@ m_length(NULL)
//- This is where we bind the bind the buffer to the statement
if (mysql_stmt_bind_result(m_stmt, m_rBind))
{
- sLog->outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
+ sLog->outWarn(LOG_FILTER_SQL, "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
delete[] m_rBind;
delete[] m_isNull;
delete[] m_length;
diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h
index 6927fdb483f..6ce3d926f4c 100755
--- a/src/server/shared/Debugging/Errors.h
+++ b/src/server/shared/Debugging/Errors.h
@@ -24,10 +24,10 @@
#include <ace/Stack_Trace.h>
#include <ace/OS_NS_unistd.h>
-#define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError( "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); ((void(*)())NULL)();} }
-#define WPError( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); }
-#define WPWarning( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); }
-#define WPFatal( assertion, errmsg ) if ( ! (assertion) ) { sLog->outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); ACE_OS::sleep(10); assert( #assertion &&0 ); abort(); }
+#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } }
+#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } }
+#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } }
+#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } }
#define ASSERT WPAssert
#endif
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index 63648f66e29..febc5ef3573 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -195,7 +195,23 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax)
case VER_PLATFORM_WIN32_NT:
// Test for the specific product family.
if (osvi.dwMajorVersion == 6)
- _tcsncat(szVersion, _T("Windows Vista or Windows Server 2008 "), cntMax);
+ {
+ #if WINVER < 0x0500
+ if (osvi.wReserved[1] == VER_NT_WORKSTATION)
+ #else
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ #endif // WINVER < 0x0500
+ {
+ if (osvi.dwMinorVersion == 1)
+ _tcsncat(szVersion, _T("Windows 7 "), cntMax);
+ else
+ _tcsncat(szVersion, _T("Windows Vista "), cntMax);
+ }
+ else if (osvi.dwMinorVersion == 1)
+ _tcsncat(szVersion, _T("Windows Server 2008 R2 "), cntMax);
+ else
+ _tcsncat(szVersion, _T("Windows Server 2008 "), cntMax);
+ }
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
_tcsncat(szVersion, _T("Microsoft Windows Server 2003 "), cntMax);
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
diff --git a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h b/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h
deleted file mode 100755
index 2c065d96d4a..00000000000
--- a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TYPECONTAINER_FUNCTIONS_PTR_H
-#define TYPECONTAINER_FUNCTIONS_PTR_H
-
-/*
- * Here you'll find a list of helper functions to make
- * the TypeContainer usefull. Without it, its hard
- * to access or mutate the container.
- */
-
-#include "Platform/Define.h"
-#include "Utilities/TypeList.h"
-#include <map>
-
-namespace Trinity
-{
- /* ContainerMapList Helpers */
- // count functions
- // template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- // {
- // return elements._element.size();
- // };
- //
- // template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- // {
- // return 0;
- // }
- //
- // template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- // {
- // return 0;
- // }
- //
- // template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T> >&elements, SPECIFIC_TYPE* fake)
- // {
- // return Count(elements._elements, fake);
- // }
- //
- // template<class SPECIFIC_TYPE, class H, class T> size_t Count(const ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE* fake)
- // {
- // return Count(elements._TailElements, fake);
- // }
-
- // non-const find functions
- template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<SPECIFIC_TYPE> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- {
- typename std::map<OBJECT_HANDLE, CountedPtr<SPECIFIC_TYPE> >::iterator iter = elements._element.find(hdl);
- return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL) : iter->second);
- };
-
- template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeNull> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- {
- return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// terminate recursion
- }
-
- template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<T> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- {
- return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// this is a missed
- }
-
- template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(ContainerMapList<TypeList<H, T> >&elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake)
- {
- CountedPtr<SPECIFIC_TYPE> &t = Find(elements._elements, hdl, fake);
- return (!t ? Find(elements._TailElements, hdl, fake) : t);
- }
-
- // const find functions
- template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<SPECIFIC_TYPE> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- {
- typename CountedPtr<SPECIFIC_TYPE>::iterator iter = elements._element.find(hdl);
- return (iter == elements._element.end() ? NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL) : iter->second);
- };
-
- template<class SPECIFIC_TYPE> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeNull> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- {
- return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);
- }
-
- template<class SPECIFIC_TYPE, class T> const CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<T> &elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* /*fake*/)
- {
- return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);
- }
-
- template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Find(const ContainerMapList<TypeList<H, T> >&elements, OBJECT_HANDLE hdl, CountedPtr<SPECIFIC_TYPE>* fake)
- {
- CountedPtr<SPECIFIC_TYPE> &t = Find(elements._elements, hdl, fake);
- if (!t)
- t = Find(elements._TailElement, hdl, fake);
-
- return t;
- }
-
- // non-const insert functions
- template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- elements._element[hdl] = obj;
- return obj;
- };
-
- template<class SPECIFIC_TYPE> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);
- }
-
- // this is a missed
- template<class SPECIFIC_TYPE, class T> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- return NullPtr<SPECIFIC_TYPE>((SPECIFIC_TYPE*)NULL);// a missed
- }
-
- // Recursion
- template<class SPECIFIC_TYPE, class H, class T> CountedPtr<SPECIFIC_TYPE>& Insert(ContainerMapList<TypeList<H, T> >&elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- CountedPtr<SPECIFIC_TYPE> &t= Insert(elements._elements, obj, hdl);
- return (!t ? Insert(elements._TailElements, obj, hdl) : t);
- }
-
- // non-const remove method
- template<class SPECIFIC_TYPE> bool Remove(ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- typename std::map<OBJECT_HANDLE, CountedPtr<SPECIFIC_TYPE> >::iterator iter = elements._element.find(hdl);
- if ( iter != elements._element.end() )
- {
- elements._element.erase(iter);
- return true;
- }
-
- return false; // found... terminate the search
- }
-
- template<class SPECIFIC_TYPE> bool Remove(ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- return false;
- }
-
- // this is a missed
- template<class SPECIFIC_TYPE, class T> bool Remove(ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- return false;
- }
-
- template<class SPECIFIC_TYPE, class T, class H> bool Remove(ContainerMapList<TypeList<H, T> > &elements, CountedPtr<SPECIFIC_TYPE> &obj, OBJECT_HANDLE hdl)
- {
- // The head element is bad
- bool t = Remove(elements._elements, obj, hdl);
- return ( !t ? Remove(elements._TailElements, obj, hdl) : t );
- }
-
-}
-#endif
-
diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp
new file mode 100644
index 00000000000..348ec4b3c7c
--- /dev/null
+++ b/src/server/shared/Logging/Appender.cpp
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2008-2012 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 "Appender.h"
+#include "Common.h"
+
+std::string LogMessage::getTimeStr(time_t time)
+{
+ tm* aTm = localtime(&time);
+ char buf[20];
+ snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec);
+ return std::string(buf);
+}
+
+std::string LogMessage::getTimeStr()
+{
+ return getTimeStr(mtime);
+}
+
+Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */):
+id(_id), name(_name), type(_type), level(_level), flags(_flags)
+{
+}
+
+Appender::~Appender()
+{
+}
+
+uint8 Appender::getId() const
+{
+ return id;
+}
+
+std::string const& Appender::getName() const
+{
+ return name;
+}
+
+AppenderType Appender::getType() const
+{
+ return type;
+}
+
+LogLevel Appender::getLogLevel() const
+{
+ return level;
+}
+
+AppenderFlags Appender::getFlags() const
+{
+ return flags;
+}
+
+void Appender::setLogLevel(LogLevel _level)
+{
+ level = _level;
+}
+
+void Appender::write(LogMessage& message)
+{
+ if (!level || level > message.level)
+ {
+ //fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe
+ return;
+ }
+
+ message.prefix.clear();
+ if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP)
+ message.prefix.append(message.getTimeStr().c_str());
+
+ if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
+ {
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ char text[MAX_QUERY_LEN];
+ snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level));
+ message.prefix.append(text);
+ }
+
+ if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
+ {
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ char text[MAX_QUERY_LEN];
+ snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type));
+ message.prefix.append(text);
+ }
+
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ _write(message);
+}
+
+const char* Appender::getLogLevelString(LogLevel level)
+{
+ switch (level)
+ {
+ case LOG_LEVEL_FATAL:
+ return "FATAL";
+ case LOG_LEVEL_ERROR:
+ return "ERROR";
+ case LOG_LEVEL_WARN:
+ return "WARN";
+ case LOG_LEVEL_INFO:
+ return "INFO";
+ case LOG_LEVEL_DEBUG:
+ return "DEBUG";
+ case LOG_LEVEL_TRACE:
+ return "TRACE";
+ default:
+ return "DISABLED";
+ }
+}
+
+char const* Appender::getLogFilterTypeString(LogFilterType type)
+{
+ switch (type)
+ {
+ case LOG_FILTER_GENERAL:
+ return "GENERAL";
+ case LOG_FILTER_UNITS:
+ return "UNITS";
+ case LOG_FILTER_PETS:
+ return "PETS";
+ case LOG_FILTER_VEHICLES:
+ return "VEHICLES";
+ case LOG_FILTER_TSCR:
+ return "TSCR";
+ case LOG_FILTER_DATABASE_AI:
+ return "DATABASE_AI";
+ case LOG_FILTER_MAPSCRIPTS:
+ return "MAPSCRIPTS";
+ case LOG_FILTER_NETWORKIO:
+ return "NETWORKIO";
+ case LOG_FILTER_SPELLS_AURAS:
+ return "SPELLS_AURAS";
+ case LOG_FILTER_ACHIEVEMENTSYS:
+ return "ACHIEVEMENTSYS";
+ case LOG_FILTER_CONDITIONSYS:
+ return "CONDITIONSYS";
+ case LOG_FILTER_POOLSYS:
+ return "POOLSYS";
+ case LOG_FILTER_AUCTIONHOUSE:
+ return "AUCTIONHOUSE";
+ case LOG_FILTER_BATTLEGROUND:
+ return "BATTLEGROUND";
+ case LOG_FILTER_OUTDOORPVP:
+ return "OUTDOORPVP";
+ case LOG_FILTER_CHATSYS:
+ return "CHATSYS";
+ case LOG_FILTER_LFG:
+ return "LFG";
+ case LOG_FILTER_MAPS:
+ return "MAPS";
+ case LOG_FILTER_PLAYER:
+ return "PLAYER";
+ case LOG_FILTER_PLAYER_LOADING:
+ return "PLAYER LOADING";
+ case LOG_FILTER_PLAYER_ITEMS:
+ return "PLAYER ITEMS";
+ case LOG_FILTER_PLAYER_SKILLS:
+ return "PLAYER SKILLS";
+ case LOG_FILTER_PLAYER_CHATLOG:
+ return "PLAYER CHATLOG";
+ case LOG_FILTER_LOOT:
+ return "LOOT";
+ case LOG_FILTER_GUILD:
+ return "GUILD";
+ case LOG_FILTER_TRANSPORTS:
+ return "TRANSPORTS";
+ case LOG_FILTER_SQL:
+ return "SQL";
+ case LOG_FILTER_GMCOMMAND:
+ return "GMCOMMAND";
+ case LOG_FILTER_REMOTECOMMAND:
+ return "REMOTECOMMAND";
+ case LOG_FILTER_WARDEN:
+ return "WARDEN";
+ case LOG_FILTER_AUTHSERVER:
+ return "AUTHSERVER";
+ case LOG_FILTER_WORLDSERVER:
+ return "WORLDSERVER";
+ case LOG_FILTER_GAMEEVENTS:
+ return "GAMEEVENTS";
+ case LOG_FILTER_CALENDAR:
+ return "CALENDAR";
+ case LOG_FILTER_CHARACTER:
+ return "CHARACTER";
+ case LOG_FILTER_ARENAS:
+ return "ARENAS";
+ case LOG_FILTER_SQL_DRIVER:
+ return "SQL DRIVER";
+ case LOG_FILTER_SQL_DEV:
+ return "SQL DEV";
+ case LOG_FILTER_PLAYER_DUMP:
+ return "PLAYER DUMP";
+ case LOG_FILTER_BATTLEFIELD:
+ return "BATTLEFIELD";
+ case LOG_FILTER_SERVER_LOADING:
+ return "SERVER LOADING";
+ case LOG_FILTER_OPCODES:
+ return "OPCODE";
+ default:
+ break;
+ }
+ return "???";
+}
diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h
new file mode 100644
index 00000000000..c0e03b13db1
--- /dev/null
+++ b/src/server/shared/Logging/Appender.h
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef APPENDER_H
+#define APPENDER_H
+
+#include "Define.h"
+#include <time.h>
+#include <string>
+#include <map>
+
+enum LogFilterType
+{
+ LOG_FILTER_GENERAL, // This one should only be used inside Log.cpp
+ LOG_FILTER_UNITS, // Anything related to units that doesn't fit in other categories. ie. creature formations
+ LOG_FILTER_PETS,
+ LOG_FILTER_VEHICLES,
+ LOG_FILTER_TSCR, // C++ AI, instance scripts, etc.
+ LOG_FILTER_DATABASE_AI, // SmartAI, EventAI, Creature* * AI
+ LOG_FILTER_MAPSCRIPTS,
+ LOG_FILTER_NETWORKIO,
+ LOG_FILTER_SPELLS_AURAS,
+ LOG_FILTER_ACHIEVEMENTSYS,
+ LOG_FILTER_CONDITIONSYS,
+ LOG_FILTER_POOLSYS,
+ LOG_FILTER_AUCTIONHOUSE,
+ LOG_FILTER_BATTLEGROUND,
+ LOG_FILTER_OUTDOORPVP,
+ LOG_FILTER_CHATSYS,
+ LOG_FILTER_LFG,
+ LOG_FILTER_MAPS,
+ LOG_FILTER_PLAYER, // Any player log that does not fit in other player filters
+ LOG_FILTER_PLAYER_LOADING, // Debug output from Player::_Load functions
+ LOG_FILTER_PLAYER_ITEMS,
+ LOG_FILTER_PLAYER_SKILLS,
+ LOG_FILTER_PLAYER_CHATLOG,
+ LOG_FILTER_LOOT,
+ LOG_FILTER_GUILD,
+ LOG_FILTER_TRANSPORTS,
+ LOG_FILTER_SQL,
+ LOG_FILTER_GMCOMMAND,
+ LOG_FILTER_REMOTECOMMAND,
+ LOG_FILTER_WARDEN,
+ LOG_FILTER_AUTHSERVER,
+ LOG_FILTER_WORLDSERVER,
+ LOG_FILTER_GAMEEVENTS,
+ LOG_FILTER_CALENDAR,
+ LOG_FILTER_CHARACTER,
+ LOG_FILTER_ARENAS,
+ LOG_FILTER_SQL_DRIVER,
+ LOG_FILTER_SQL_DEV,
+ LOG_FILTER_PLAYER_DUMP,
+ LOG_FILTER_BATTLEFIELD,
+ LOG_FILTER_SERVER_LOADING,
+ LOG_FILTER_OPCODES
+};
+
+const uint8 MaxLogFilter = uint8(LOG_FILTER_OPCODES) + 1;
+
+// Values assigned have their equivalent in enum ACE_Log_Priority
+enum LogLevel
+{
+ LOG_LEVEL_DISABLED = 0,
+ LOG_LEVEL_TRACE = 1,
+ LOG_LEVEL_DEBUG = 2,
+ LOG_LEVEL_INFO = 3,
+ LOG_LEVEL_WARN = 4,
+ LOG_LEVEL_ERROR = 5,
+ LOG_LEVEL_FATAL = 6,
+};
+
+const uint8 MaxLogLevels = 6;
+
+enum AppenderType
+{
+ APPENDER_NONE,
+ APPENDER_CONSOLE,
+ APPENDER_FILE,
+ APPENDER_DB,
+};
+
+enum AppenderFlags
+{
+ APPENDER_FLAGS_NONE = 0x00,
+ APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01,
+ APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02,
+ APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04,
+ APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender
+ APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender
+};
+
+struct LogMessage
+{
+ LogMessage(LogLevel _level, LogFilterType _type, std::string _text)
+ : level(_level)
+ , type(_type)
+ , text(_text)
+ {
+ mtime = time(NULL);
+ }
+
+ static std::string getTimeStr(time_t time);
+ std::string getTimeStr();
+
+ LogLevel level;
+ LogFilterType type;
+ std::string text;
+ std::string prefix;
+ std::string param1;
+ time_t mtime;
+};
+
+class Appender
+{
+ public:
+ Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE);
+ virtual ~Appender();
+
+ uint8 getId() const;
+ std::string const& getName() const;
+ AppenderType getType() const;
+ LogLevel getLogLevel() const;
+ AppenderFlags getFlags() const;
+
+ void setLogLevel(LogLevel);
+ void write(LogMessage& message);
+ static const char* getLogLevelString(LogLevel level);
+ static const char* getLogFilterTypeString(LogFilterType type);
+
+ private:
+ virtual void _write(LogMessage& /*message*/) = 0;
+
+ uint8 id;
+ std::string name;
+ AppenderType type;
+ LogLevel level;
+ AppenderFlags flags;
+};
+
+typedef std::map<uint8, Appender*> AppenderMap;
+
+#endif
diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp
new file mode 100644
index 00000000000..839f8512ad7
--- /dev/null
+++ b/src/server/shared/Logging/AppenderConsole.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2008-2012 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 "AppenderConsole.h"
+#include "Config.h"
+#include "Util.h"
+
+#include <sstream>
+
+AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags):
+Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false)
+{
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ _colors[i] = ColorTypes(MaxColors);
+}
+
+void AppenderConsole::InitColors(std::string const& str)
+{
+ if (str.empty())
+ {
+ _colored = false;
+ return;
+ }
+
+ int color[MaxLogLevels];
+
+ std::istringstream ss(str);
+
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ {
+ ss >> color[i];
+
+ if (!ss)
+ return;
+
+ if (color[i] < 0 || color[i] >= MaxColors)
+ return;
+ }
+
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ _colors[i] = ColorTypes(color[i]);
+
+ _colored = true;
+}
+
+void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
+{
+ #if PLATFORM == PLATFORWINDOWS
+ static WORD WinColorFG[MaxColors] =
+ {
+ 0, // BLACK
+ FOREGROUND_RED, // RED
+ FOREGROUND_GREEN, // GREEN
+ FOREGROUND_RED | FOREGROUND_GREEN, // BROWN
+ FOREGROUND_BLUE, // BLUE
+ FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA
+ FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE
+ // YELLOW
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
+ // RED_BOLD
+ FOREGROUND_RED | FOREGROUND_INTENSITY,
+ // GREEN_BOLD
+ FOREGROUND_GREEN | FOREGROUND_INTENSITY,
+ FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD
+ // MAGENTA_BOLD
+ FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
+ // CYAN_BOLD
+ FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
+ // WHITE_BOLD
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
+ };
+
+ HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
+ SetConsoleTextAttribute(hConsole, WinColorFG[color]);
+ #else
+ enum ANSITextAttr
+ {
+ TA_NORMAL = 0,
+ TA_BOLD = 1,
+ TA_BLINK = 5,
+ TA_REVERSE = 7
+ };
+
+ enum ANSIFgTextAttr
+ {
+ FG_BLACK = 30,
+ FG_RED,
+ FG_GREEN,
+ FG_BROWN,
+ FG_BLUE,
+ FG_MAGENTA,
+ FG_CYAN,
+ FG_WHITE,
+ FG_YELLOW
+ };
+
+ enum ANSIBgTextAttr
+ {
+ BG_BLACK = 40,
+ BG_RED,
+ BG_GREEN,
+ BG_BROWN,
+ BG_BLUE,
+ BG_MAGENTA,
+ BG_CYAN,
+ BG_WHITE
+ };
+
+ static uint8 UnixColorFG[MaxColors] =
+ {
+ FG_BLACK, // BLACK
+ FG_RED, // RED
+ FG_GREEN, // GREEN
+ FG_BROWN, // BROWN
+ FG_BLUE, // BLUE
+ FG_MAGENTA, // MAGENTA
+ FG_CYAN, // CYAN
+ FG_WHITE, // WHITE
+ FG_YELLOW, // YELLOW
+ FG_RED, // LRED
+ FG_GREEN, // LGREEN
+ FG_BLUE, // LBLUE
+ FG_MAGENTA, // LMAGENTA
+ FG_CYAN, // LCYAN
+ FG_WHITE // LWHITE
+ };
+
+ fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < MaxColors ? ";1" : ""));
+ #endif
+}
+
+void AppenderConsole::ResetColor(bool stdout_stream)
+{
+ #if PLATFORM == PLATFORWINDOWS
+ HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
+ SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
+ #else
+ fprintf((stdout_stream ? stdout : stderr), "\x1b[0m");
+ #endif
+}
+
+void AppenderConsole::_write(LogMessage& message)
+{
+ bool stdout_stream = message.level == LOG_LEVEL_ERROR || message.level == LOG_LEVEL_FATAL;
+
+ if (_colored)
+ {
+ uint8 index;
+ switch (message.level)
+ {
+ case LOG_LEVEL_TRACE:
+ index = 5;
+ break;
+ case LOG_LEVEL_DEBUG:
+ index = 4;
+ break;
+ case LOG_LEVEL_INFO:
+ index = 3;
+ break;
+ case LOG_LEVEL_WARN:
+ index = 2;
+ break;
+ case LOG_LEVEL_FATAL:
+ index = 0;
+ break;
+ case LOG_LEVEL_ERROR: // No break on purpose
+ default:
+ index = 1;
+ break;
+ }
+
+ SetColor(stdout_stream, _colors[index]);
+ utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str());
+ ResetColor(stdout_stream);
+ }
+ else
+ utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str());
+}
diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h
new file mode 100644
index 00000000000..ad7d9543cdb
--- /dev/null
+++ b/src/server/shared/Logging/AppenderConsole.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef APPENDERCONSOLE_H
+#define APPENDERCONSOLE_H
+
+#include "Appender.h"
+#include <string>
+
+enum ColorTypes
+{
+ BLACK,
+ RED,
+ GREEN,
+ BROWN,
+ BLUE,
+ MAGENTA,
+ CYAN,
+ GREY,
+ YELLOW,
+ LRED,
+ LGREEN,
+ LBLUE,
+ LMAGENTA,
+ LCYAN,
+ WHITE
+};
+
+const uint8 MaxColors = uint8(WHITE) + 1;
+
+class AppenderConsole: public Appender
+{
+ public:
+ AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags);
+ void InitColors(const std::string& init_str);
+
+ private:
+ void SetColor(bool stdout_stream, ColorTypes color);
+ void ResetColor(bool stdout_stream);
+ void _write(LogMessage& message);
+ bool _colored;
+ ColorTypes _colors[MaxLogLevels];
+};
+
+#endif
diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp
new file mode 100644
index 00000000000..d85a4db9f7a
--- /dev/null
+++ b/src/server/shared/Logging/AppenderDB.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008-2012 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 "AppenderDB.h"
+#include "Database/DatabaseEnv.h"
+
+AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId):
+Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false)
+{
+}
+
+AppenderDB::~AppenderDB()
+{
+}
+
+void AppenderDB::_write(LogMessage& message)
+{
+ if (!enable)
+ return;
+ switch (message.type)
+ {
+ case LOG_FILTER_SQL:
+ case LOG_FILTER_SQL_DRIVER:
+ case LOG_FILTER_SQL_DEV:
+ break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type
+ default:
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
+ stmt->setUInt64(0, message.mtime);
+ stmt->setUInt32(1, realm);
+ stmt->setUInt8(2, message.type);
+ stmt->setUInt8(3, message.level);
+ stmt->setString(4, message.text);
+ LoginDatabase.Execute(stmt);
+ break;
+ }
+}
+
+void AppenderDB::setEnable(bool _enable)
+{
+ enable = _enable;
+}
diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h
new file mode 100644
index 00000000000..4399195b181
--- /dev/null
+++ b/src/server/shared/Logging/AppenderDB.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef APPENDERDB_H
+#define APPENDERDB_H
+
+#include "Appender.h"
+
+class AppenderDB: public Appender
+{
+ public:
+ AppenderDB(uint8 _id, std::string const& _name, LogLevel level, uint8 realmId);
+ ~AppenderDB();
+ void setEnable(bool enable);
+
+ private:
+ uint8 realm;
+ bool enable;
+ void _write(LogMessage& message);
+};
+
+#endif
diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp
new file mode 100644
index 00000000000..67adff39aae
--- /dev/null
+++ b/src/server/shared/Logging/AppenderFile.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008-2012 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 "AppenderFile.h"
+#include "Common.h"
+
+AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags)
+ : Appender(id, name, APPENDER_FILE, level, _flags)
+ , filename(_filename)
+ , logDir(_logDir)
+ , mode(_mode)
+{
+ dynamicName = std::string::npos != filename.find("%s");
+ backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP;
+
+ logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL;
+}
+
+AppenderFile::~AppenderFile()
+{
+ if (logfile)
+ {
+ fclose(logfile);
+ logfile = NULL;
+ }
+}
+
+void AppenderFile::_write(LogMessage& message)
+{
+ if (dynamicName)
+ {
+ char namebuf[TRINITY_PATH_MAX];
+ snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str());
+ logfile = OpenFile(namebuf, mode, backup);
+ }
+
+ if (logfile)
+ {
+ fprintf(logfile, "%s%s", message.prefix.c_str(), message.text.c_str());
+ fflush(logfile);
+
+ if (dynamicName)
+ {
+ fclose(logfile);
+ logfile = NULL;
+ }
+ }
+}
+
+FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup)
+{
+ if (mode == "w" && backup)
+ {
+ std::string newName(filename);
+ newName.push_back('.');
+ newName.append(LogMessage::getTimeStr(time(NULL)));
+ rename(filename.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore
+ }
+ return fopen((logDir + filename).c_str(), mode.c_str());
+}
diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h
new file mode 100644
index 00000000000..e9cb858f625
--- /dev/null
+++ b/src/server/shared/Logging/AppenderFile.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef APPENDERFILE_H
+#define APPENDERFILE_H
+
+#include "Appender.h"
+
+class AppenderFile: public Appender
+{
+ public:
+ AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags);
+ ~AppenderFile();
+ FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup);
+
+ private:
+ void _write(LogMessage& message);
+ FILE* logfile;
+ std::string filename;
+ std::string logDir;
+ std::string mode;
+ bool dynamicName;
+ bool backup;
+};
+
+#endif
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 79eab053d08..3a24190d8fa 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,1064 +16,497 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "Log.h"
-#include "Configuration/Config.h"
+#include "Common.h"
+#include "Config.h"
#include "Util.h"
+#include "AppenderConsole.h"
+#include "AppenderFile.h"
+#include "AppenderDB.h"
+#include "LogOperation.h"
-#include "Implementation/LoginDatabase.h" // For logging
-extern LoginDatabaseWorkerPool LoginDatabase;
-
-#include <stdarg.h>
-#include <stdio.h>
+#include <cstdarg>
+#include <cstdio>
+#include <sstream>
-Log::Log() :
- raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
- dberLogfile(NULL), chatLogfile(NULL), arenaLogFile(NULL), sqlLogFile(NULL), sqlDevLogFile(NULL), wardenLogFile(NULL),
- m_gmlog_per_account(false), m_enableLogDBLater(false),
- m_enableLogDB(false), m_colored(false)
+Log::Log() : worker(NULL)
{
- Initialize();
+ SetRealmID(0);
+ m_logsTimestamp = "_" + GetTimestampStr();
+ LoadFromConfig();
}
Log::~Log()
{
- if (logfile != NULL)
- fclose(logfile);
- logfile = NULL;
-
- if (gmLogfile != NULL)
- fclose(gmLogfile);
- gmLogfile = NULL;
-
- if (charLogfile != NULL)
- fclose(charLogfile);
- charLogfile = NULL;
-
- if (dberLogfile != NULL)
- fclose(dberLogfile);
- dberLogfile = NULL;
-
- if (raLogfile != NULL)
- fclose(raLogfile);
- raLogfile = NULL;
-
- if (chatLogfile != NULL)
- fclose(chatLogfile);
- chatLogfile = NULL;
-
- if (arenaLogFile != NULL)
- fclose(arenaLogFile);
- arenaLogFile = NULL;
-
- if (sqlLogFile != NULL)
- fclose(sqlLogFile);
- sqlLogFile = NULL;
-
- if (sqlDevLogFile != NULL)
- fclose(sqlDevLogFile);
- sqlDevLogFile = NULL;
-
- if (wardenLogFile != NULL)
- fclose(wardenLogFile);
- wardenLogFile = NULL;
+ Close();
}
-void Log::SetLogLevel(char *Level)
+uint8 Log::NextAppenderId()
{
- int32 NewLevel = atoi((char*)Level);
- if (NewLevel < 0)
- NewLevel = 0;
- m_logLevel = NewLevel;
-
- outString("LogLevel is %u", m_logLevel);
+ return AppenderId++;
}
-void Log::SetLogFileLevel(char *Level)
+int32 GetConfigIntDefault(std::string base, const char* name, int32 value)
{
- int32 NewLevel = atoi((char*)Level);
- if (NewLevel < 0)
- NewLevel = 0;
- m_logFileLevel = NewLevel;
-
- outString("LogFileLevel is %u", m_logFileLevel);
+ base.append(name);
+ return ConfigMgr::GetIntDefault(base.c_str(), value);
}
-void Log::SetDBLogLevel(char *Level)
+std::string GetConfigStringDefault(std::string base, const char* name, const char* value)
{
- int32 NewLevel = atoi((char*)Level);
- if (NewLevel < 0)
- NewLevel = 0;
- m_dbLogLevel = NewLevel;
-
- outString("DBLogLevel is %u", m_dbLogLevel);
+ base.append(name);
+ return ConfigMgr::GetStringDefault(base.c_str(), value);
}
-void Log::Initialize()
+// Returns default logger if the requested logger is not found
+Logger* Log::GetLoggerByType(LogFilterType filter)
{
- /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs
- m_dbChar = ConfigMgr::GetBoolDefault("LogDB.Char", false);
- m_dbRA = ConfigMgr::GetBoolDefault("LogDB.RA", false);
- m_dbGM = ConfigMgr::GetBoolDefault("LogDB.GM", false);
- m_dbChat = ConfigMgr::GetBoolDefault("LogDB.Chat", false);
-
- /// Realm must be 0 by default
- SetRealmID(0);
-
- /// Common log files data
- m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
- if (!m_logsDir.empty())
- if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
- m_logsDir.push_back('/');
-
- m_logsTimestamp = "_" + GetTimestampStr();
-
- /// Open specific log files
- logfile = openLogFile("LogFile", "LogTimestamp", "w");
- InitColors(ConfigMgr::GetStringDefault("LogColors", ""));
-
- m_gmlog_per_account = ConfigMgr::GetBoolDefault("GmLogPerAccount", false);
- if (!m_gmlog_per_account)
- gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a");
- else
- {
- // GM log settings for per account case
- m_gmlog_filename_format = ConfigMgr::GetStringDefault("GMLogFile", "");
- if (!m_gmlog_filename_format.empty())
- {
- bool m_gmlog_timestamp = ConfigMgr::GetBoolDefault("GmLogTimestamp", false);
-
- size_t dot_pos = m_gmlog_filename_format.find_last_of('.');
- if (dot_pos!=m_gmlog_filename_format.npos)
- {
- if (m_gmlog_timestamp)
- m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp);
-
- m_gmlog_filename_format.insert(dot_pos, "_#%u");
- }
- else
- {
- m_gmlog_filename_format += "_#%u";
-
- if (m_gmlog_timestamp)
- m_gmlog_filename_format += m_logsTimestamp;
- }
+ LoggerMap::iterator it = loggers.begin();
+ while (it != loggers.end() && it->second.getType() != filter)
+ ++it;
- m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
- }
- }
-
- charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
- dberLogfile = openLogFile("DBErrorLogFile", NULL, "a");
- raLogfile = openLogFile("RaLogFile", NULL, "a");
- chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
- arenaLogFile = openLogFile("ArenaLogFile", NULL, "a");
- sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a");
- sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a");
- wardenLogFile = openLogFile("Warden.LogFile",NULL,"a");
-
- // Main log file settings
- m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL);
- m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL);
- m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL);
- m_sqlDriverQueryLogging = ConfigMgr::GetBoolDefault("SQLDriverQueryLogging", false);
-
- m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE));
-
- // Char log settings
- m_charLog_Dump = ConfigMgr::GetBoolDefault("CharLogDump", false);
- m_charLog_Dump_Separate = ConfigMgr::GetBoolDefault("CharLogDump.Separate", false);
- if (m_charLog_Dump_Separate)
- {
- m_dumpsDir = ConfigMgr::GetStringDefault("CharLogDump.SeparateDir", "");
- if (!m_dumpsDir.empty())
- if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
- m_dumpsDir.push_back('/');
- }
-}
-
-void Log::ReloadConfig()
-{
- m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL);
- m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL);
- m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL);
-
- m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE));
+ return it == loggers.end() ? &(loggers[0]) : &(it->second);
}
-FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode)
+Appender* Log::GetAppenderByName(std::string const& name)
{
- std::string logfn=ConfigMgr::GetStringDefault(configFileName, "");
- if (logfn.empty())
- return NULL;
-
- if (configTimeStampFlag && ConfigMgr::GetBoolDefault(configTimeStampFlag, false))
- {
- size_t dot_pos = logfn.find_last_of(".");
- if (dot_pos!=logfn.npos)
- logfn.insert(dot_pos, m_logsTimestamp);
- else
- logfn += m_logsTimestamp;
- }
+ AppenderMap::iterator it = appenders.begin();
+ while (it != appenders.end() && it->second && it->second->getName() != name)
+ ++it;
- return fopen((m_logsDir+logfn).c_str(), mode);
+ return it == appenders.end() ? NULL : it->second;
}
-FILE* Log::openGmlogPerAccount(uint32 account)
+void Log::CreateAppenderFromConfig(const char* name)
{
- if (m_gmlog_filename_format.empty())
- return NULL;
+ if (!name || *name == '\0')
+ return;
- char namebuf[TRINITY_PATH_MAX];
- snprintf(namebuf, TRINITY_PATH_MAX, m_gmlog_filename_format.c_str(), account);
- return fopen(namebuf, "a");
-}
+ // Format=type,level,flags,optional1,optional2
+ // if type = File. optional1 = file and option2 = mode
+ // if type = Console. optional1 = Color
+ std::string options = "Appender.";
+ options.append(name);
+ options = ConfigMgr::GetStringDefault(options.c_str(), "");
+ Tokens tokens(options, ',');
+ Tokens::iterator iter = tokens.begin();
-void Log::outTimestamp(FILE* file)
-{
- time_t t = time(NULL);
- tm* aTm = localtime(&t);
- // YYYY year
- // MM month (2 digits 01-12)
- // DD day (2 digits 01-31)
- // HH hour (2 digits 00-23)
- // MM minutes (2 digits 00-59)
- // SS seconds (2 digits 00-59)
- fprintf(file, "%-4d-%02d-%02d %02d:%02d:%02d ", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec);
-}
-
-void Log::InitColors(const std::string& str)
-{
- if (str.empty())
+ if (tokens.size() < 2)
{
- m_colored = false;
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str());
return;
}
- int color[4];
-
- std::istringstream ss(str);
-
- for (uint8 i = 0; i < LogLevels; ++i)
+ AppenderFlags flags = APPENDER_FLAGS_NONE;
+ AppenderType type = AppenderType(atoi(*iter));
+ ++iter;
+ LogLevel level = LogLevel(atoi(*iter));
+ if (level > LOG_LEVEL_FATAL)
{
- ss >> color[i];
-
- if (!ss)
- return;
-
- if (color[i] < 0 || color[i] >= Colors)
- return;
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %u for appender %s\n", level, name);
+ return;
}
- for (uint8 i = 0; i < LogLevels; ++i)
- m_colors[i] = ColorTypes(color[i]);
+ if (++iter != tokens.end())
+ flags = AppenderFlags(atoi(*iter));
- m_colored = true;
-}
-
-void Log::SetColor(bool stdout_stream, ColorTypes color)
-{
- #if PLATFORM == PLATFORM_WINDOWS
- static WORD WinColorFG[Colors] =
+ switch (type)
{
- 0, // BLACK
- FOREGROUND_RED, // RED
- FOREGROUND_GREEN, // GREEN
- FOREGROUND_RED | FOREGROUND_GREEN, // BROWN
- FOREGROUND_BLUE, // BLUE
- FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA
- FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE
- // YELLOW
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
- // RED_BOLD
- FOREGROUND_RED | FOREGROUND_INTENSITY,
- // GREEN_BOLD
- FOREGROUND_GREEN | FOREGROUND_INTENSITY,
- FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD
- // MAGENTA_BOLD
- FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- // CYAN_BOLD
- FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- // WHITE_BOLD
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
- };
-
- HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE );
- SetConsoleTextAttribute(hConsole, WinColorFG[color]);
- #else
- enum ANSITextAttr
- {
- TA_NORMAL=0,
- TA_BOLD=1,
- TA_BLINK=5,
- TA_REVERSE=7
- };
+ case APPENDER_CONSOLE:
+ {
+ AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags);
+ appenders[appender->getId()] = appender;
+ if (++iter != tokens.end())
+ appender->InitColors(*iter);
+ //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe
+ break;
+ }
+ case APPENDER_FILE:
+ {
+ std::string filename;
+ std::string mode = "a";
- enum ANSIFgTextAttr
- {
- FG_BLACK=30, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE,
- FG_MAGENTA, FG_CYAN, FG_WHITE, FG_YELLOW
- };
+ if (++iter == tokens.end())
+ {
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name);
+ return;
+ }
- enum ANSIBgTextAttr
- {
- BG_BLACK=40, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE,
- BG_MAGENTA, BG_CYAN, BG_WHITE
- };
+ filename = *iter;
- static uint8 UnixColorFG[Colors] =
- {
- FG_BLACK, // BLACK
- FG_RED, // RED
- FG_GREEN, // GREEN
- FG_BROWN, // BROWN
- FG_BLUE, // BLUE
- FG_MAGENTA, // MAGENTA
- FG_CYAN, // CYAN
- FG_WHITE, // WHITE
- FG_YELLOW, // YELLOW
- FG_RED, // LRED
- FG_GREEN, // LGREEN
- FG_BLUE, // LBLUE
- FG_MAGENTA, // LMAGENTA
- FG_CYAN, // LCYAN
- FG_WHITE // LWHITE
- };
-
- fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < Colors ? ";1" : ""));
- #endif
-}
+ if (++iter != tokens.end())
+ mode = *iter;
-void Log::ResetColor(bool stdout_stream)
-{
- #if PLATFORM == PLATFORM_WINDOWS
- HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE );
- SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED );
- #else
- fprintf(( stdout_stream ? stdout : stderr ), "\x1b[0m");
- #endif
-}
+ if (flags & APPENDER_FLAGS_USE_TIMESTAMP)
+ {
+ size_t dot_pos = filename.find_last_of(".");
+ if (dot_pos != filename.npos)
+ filename.insert(dot_pos, m_logsTimestamp);
+ else
+ filename += m_logsTimestamp;
+ }
-std::string Log::GetTimestampStr()
-{
- time_t t = time(NULL);
- tm* aTm = localtime(&t);
- // YYYY year
- // MM month (2 digits 01-12)
- // DD day (2 digits 01-31)
- // HH hour (2 digits 00-23)
- // MM minutes (2 digits 00-59)
- // SS seconds (2 digits 00-59)
- char buf[20];
- snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec);
- return std::string(buf);
+ uint8 id = NextAppenderId();
+ appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags);
+ //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe
+ break;
+ }
+ case APPENDER_DB:
+ {
+ uint8 id = NextAppenderId();
+ appenders[id] = new AppenderDB(id, name, level, realm);
+ break;
+ }
+ default:
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %u for appender %s\n", type, name);
+ break;
+ }
}
-void Log::outDB(LogTypes type, const char * str)
+void Log::CreateLoggerFromConfig(const char* name)
{
- if (!str || type >= MAX_LOG_TYPES)
- return;
-
- std::string logStr(str);
- if (logStr.empty())
+ if (!name || *name == '\0')
return;
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
-
- stmt->setInt32(0, realm);
- stmt->setUInt8(1, uint8(type));
- stmt->setString(2, logStr);
+ LogLevel level = LOG_LEVEL_DISABLED;
+ int32 type = -1;
- LoginDatabase.Execute(stmt);
-}
+ std::string options = "Logger.";
+ options.append(name);
+ options = ConfigMgr::GetStringDefault(options.c_str(), "");
-void Log::outString(const char * str, ...)
-{
- if (!str)
- return;
-
- if (m_enableLogDB)
+ if (options.empty())
{
- // we don't want empty strings in the DB
- std::string s(str);
- if (s.empty() || s == " ")
- return;
-
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_STRING, nnew_str);
- va_end(ap2);
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name);
+ return;
}
- if (m_colored)
- SetColor(true, m_colors[LOGL_NORMAL]);
+ Tokens tokens(options, ',');
+ Tokens::iterator iter = tokens.begin();
- va_list ap;
-
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
-
- printf("\n");
- if (logfile)
+ if (tokens.size() != 3)
{
- outTimestamp(logfile);
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- fprintf(logfile, "\n");
- va_end(ap);
-
- fflush(logfile);
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str());
+ return;
}
- fflush(stdout);
-}
-void Log::outString()
-{
- printf("\n");
- if (logfile)
+ type = atoi(*iter);
+ if (type > MaxLogFilter)
{
- outTimestamp(logfile);
- fprintf(logfile, "\n");
- fflush(logfile);
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name);
+ return;
}
- fflush(stdout);
-}
-void Log::outCrash(const char * err, ...)
-{
- if (!err)
+ Logger& logger = loggers[type];
+ if (!logger.getName().empty())
+ {
+ fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name);
return;
+ }
- if (m_enableLogDB)
+ ++iter;
+ level = LogLevel(atoi(*iter));
+ if (level > LOG_LEVEL_FATAL)
{
- va_list ap2;
- va_start(ap2, err);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2);
- outDB(LOG_TYPE_CRASH, nnew_str);
- va_end(ap2);
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name);
+ return;
}
- if (m_colored)
- SetColor(false, LRED);
-
- va_list ap;
-
- va_start(ap, err);
- vutf8printf(stderr, err, &ap);
- va_end(ap);
+ logger.Create(name, LogFilterType(type), level);
+ //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe
- if (m_colored)
- ResetColor(false);
+ ++iter;
+ std::istringstream ss(*iter);
+ std::string str;
- fprintf(stderr, "\n");
- if (logfile)
+ ss >> str;
+ while (ss)
{
- outTimestamp(logfile);
- fprintf(logfile, "CRASH ALERT: ");
-
- va_start(ap, err);
- vfprintf(logfile, err, ap);
- va_end(ap);
-
- fprintf(logfile, "\n");
- fflush(logfile);
+ if (Appender* appender = GetAppenderByName(str))
+ {
+ logger.addAppender(appender->getId(), appender);
+ //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name); // DEBUG - RemoveMe
+ }
+ else
+ fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name);
+ ss >> str;
}
- fflush(stderr);
}
-void Log::outError(const char * err, ...)
+void Log::ReadAppendersFromConfig()
{
- if (!err)
- return;
+ std::istringstream ss(ConfigMgr::GetStringDefault("Appenders", ""));
+ std::string name;
- if (m_enableLogDB)
+ do
{
- va_list ap2;
- va_start(ap2, err);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2);
- outDB(LOG_TYPE_ERROR, nnew_str);
- va_end(ap2);
+ ss >> name;
+ CreateAppenderFromConfig(name.c_str());
+ name = "";
}
+ while (ss);
+}
- if (m_colored)
- SetColor(false, LRED);
-
- va_list ap;
-
- va_start(ap, err);
- vutf8printf(stderr, err, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(false);
+void Log::ReadLoggersFromConfig()
+{
+ std::istringstream ss(ConfigMgr::GetStringDefault("Loggers", ""));
+ std::string name;
- fprintf( stderr, "\n");
- if (logfile)
+ do
{
- outTimestamp(logfile);
- fprintf(logfile, "ERROR: ");
+ ss >> name;
+ CreateLoggerFromConfig(name.c_str());
+ name = "";
+ }
+ while (ss);
- va_start(ap, err);
- vfprintf(logfile, err, ap);
- va_end(ap);
+ LoggerMap::const_iterator it = loggers.begin();
- fprintf(logfile, "\n");
- fflush(logfile);
- }
- fflush(stderr);
+ while (it != loggers.end() && it->first)
+ ++it;
+
+ // root logger must exist. Marking as disabled as its not configured
+ if (it == loggers.end())
+ loggers[0].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED);
}
-void Log::outArena(const char * str, ...)
+void Log::EnableDBAppenders()
{
- if (!str)
- return;
-
- if (arenaLogFile)
- {
- va_list ap;
- outTimestamp(arenaLogFile);
- va_start(ap, str);
- vfprintf(arenaLogFile, str, ap);
- fprintf(arenaLogFile, "\n");
- va_end(ap);
- fflush(arenaLogFile);
- }
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ if (it->second && it->second->getType() == APPENDER_DB)
+ ((AppenderDB *)it->second)->setEnable(true);
}
-void Log::outSQLDriver(const char* str, ...)
+void Log::log(LogFilterType filter, LogLevel level, char const* str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, level))
return;
va_list ap;
va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- printf("\n");
- if (sqlLogFile)
- {
- outTimestamp(sqlLogFile);
-
- va_list apSQL;
- va_start(apSQL, str);
- vfprintf(sqlLogFile, str, apSQL);
- va_end(apSQL);
-
- fprintf(sqlLogFile, "\n");
- fflush(sqlLogFile);
- }
+ vlog(filter, level, str, ap);
- fflush(stdout);
+ va_end(ap);
}
-void Log::outErrorDb(const char * err, ...)
+void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list argptr)
{
- if (!err)
- return;
-
- if (m_colored)
- SetColor(false, LRED);
-
- va_list ap;
+ char text[MAX_QUERY_LEN];
+ vsnprintf(text, MAX_QUERY_LEN, str, argptr);
+ write(new LogMessage(level, filter, text));
+}
- va_start(ap, err);
- vutf8printf(stderr, err, &ap);
- va_end(ap);
+void Log::write(LogMessage* msg)
+{
+ msg->text.append("\n");
+ Logger* logger = GetLoggerByType(msg->type);
+ worker->enqueue(new LogOperation(logger, msg));
+}
- if (m_colored)
- ResetColor(false);
+std::string Log::GetTimestampStr()
+{
+ time_t t = time(NULL);
+ tm* aTm = localtime(&t);
+ // YYYY year
+ // MM month (2 digits 01-12)
+ // DD day (2 digits 01-31)
+ // HH hour (2 digits 00-23)
+ // MM minutes (2 digits 00-59)
+ // SS seconds (2 digits 00-59)
+ char buf[20];
+ snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec);
+ return std::string(buf);
+}
- fprintf( stderr, "\n" );
+bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */)
+{
+ LogLevel newLevel = LogLevel(atoi(newLevelc));
+ if (newLevel < 0)
+ return false;
- if (logfile)
+ if (isLogger)
{
- outTimestamp(logfile);
- fprintf(logfile, "ERROR: " );
+ LoggerMap::iterator it = loggers.begin();
+ while (it != loggers.end() && it->second.getName() != name)
+ ++it;
- va_start(ap, err);
- vfprintf(logfile, err, ap);
- va_end(ap);
+ if (it == loggers.end())
+ return false;
- fprintf(logfile, "\n" );
- fflush(logfile);
+ it->second.setLogLevel(newLevel);
}
-
- if (dberLogfile)
+ else
{
- outTimestamp(dberLogfile);
- va_start(ap, err);
- vfprintf(dberLogfile, err, ap);
- va_end(ap);
+ Appender* appender = GetAppenderByName(name);
+ if (!appender)
+ return false;
- fprintf(dberLogfile, "\n" );
- fflush(dberLogfile);
+ appender->setLogLevel(newLevel);
}
- fflush(stderr);
+ return true;
}
-void Log::outBasic(const char * str, ...)
+bool Log::ShouldLog(LogFilterType type, LogLevel level) const
{
- if (!str)
- return;
+ LoggerMap::const_iterator it = loggers.begin();
+ while (it != loggers.end() && it->second.getType() != type)
+ ++it;
- if (m_enableLogDB && m_dbLogLevel > LOGL_NORMAL)
+ if (it != loggers.end())
{
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_BASIC, nnew_str);
- va_end(ap2);
+ LogLevel loggerLevel = it->second.getLogLevel();
+ return loggerLevel && loggerLevel <= level;
}
- if (m_logLevel > LOGL_NORMAL)
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_BASIC]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
+ if (type != LOG_FILTER_GENERAL)
+ return ShouldLog(LOG_FILTER_GENERAL, level);
- printf("\n");
-
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- fprintf(logfile, "\n" );
- va_end(ap2);
- fflush(logfile);
- }
- }
- fflush(stdout);
+ return false;
}
-void Log::outDetail(const char * str, ...)
+void Log::outTrace(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_TRACE))
return;
- if (m_enableLogDB && m_dbLogLevel > LOGL_BASIC)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_DETAIL, nnew_str);
- va_end(ap2);
- }
-
- if (m_logLevel > LOGL_BASIC)
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_DETAIL]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
-
- printf("\n");
+ va_list ap;
+ va_start(ap, str);
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
-
- fprintf(logfile, "\n");
- fflush(logfile);
- }
- }
+ vlog(filter, LOG_LEVEL_TRACE, str, ap);
- fflush(stdout);
+ va_end(ap);
}
-void Log::outDebugInLine(const char * str, ...)
+void Log::outDebug(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_DEBUG))
return;
- if (m_logLevel > LOGL_DETAIL)
- {
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
+ va_list ap;
+ va_start(ap, str);
- //if (m_colored)
- // ResetColor(true);
+ vlog(filter, LOG_LEVEL_DEBUG, str, ap);
- if (logfile)
- {
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
- }
- }
+ va_end(ap);
}
-void Log::outSQLDev(const char* str, ...)
+void Log::outInfo(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_INFO))
return;
va_list ap;
va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- printf("\n");
- if (sqlDevLogFile)
- {
- va_list ap2;
- va_start(ap2, str);
- vfprintf(sqlDevLogFile, str, ap2);
- va_end(ap2);
-
- fprintf(sqlDevLogFile, "\n");
- fflush(sqlDevLogFile);
- }
+ vlog(filter, LOG_LEVEL_INFO, str, ap);
- fflush(stdout);
+ va_end(ap);
}
-void Log::outDebug(DebugLogFilters f, const char * str, ...)
+void Log::outWarn(LogFilterType filter, const char * str, ...)
{
- if (!(m_DebugLogMask & f))
- return;
-
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_WARN))
return;
- if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_DEBUG, nnew_str);
- va_end(ap2);
- }
-
- if ( m_logLevel > LOGL_DETAIL )
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_DEBUG]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
+ va_list ap;
+ va_start(ap, str);
- printf( "\n" );
+ vlog(filter, LOG_LEVEL_WARN, str, ap);
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
-
- fprintf(logfile, "\n" );
- fflush(logfile);
- }
- }
- fflush(stdout);
+ va_end(ap);
}
-void Log::outStaticDebug(const char * str, ...)
+void Log::outError(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_ERROR))
return;
- if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_DEBUG, nnew_str);
- va_end(ap2);
- }
-
- if ( m_logLevel > LOGL_DETAIL )
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_DEBUG]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
+ va_list ap;
+ va_start(ap, str);
- printf( "\n" );
+ vlog(filter, LOG_LEVEL_ERROR, str, ap);
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
-
- fprintf(logfile, "\n" );
- fflush(logfile);
- }
- }
- fflush(stdout);
+ va_end(ap);
}
-void Log::outStringInLine(const char * str, ...)
+void Log::outFatal(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_FATAL))
return;
va_list ap;
-
va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
- if (logfile)
- {
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- va_end(ap);
- }
+ vlog(filter, LOG_LEVEL_FATAL, str, ap);
+
+ va_end(ap);
}
-void Log::outCommand(uint32 account, const char * str, ...)
+void Log::outCharDump(const char* param, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO))
return;
- // TODO: support accountid
- if (m_enableLogDB && m_dbGM)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_GM, nnew_str);
- va_end(ap2);
- }
-
- if (m_logLevel > LOGL_NORMAL)
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_BASIC]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
-
- printf("\n");
+ va_list ap;
+ va_start(ap, str);
+ char text[MAX_QUERY_LEN];
+ vsnprintf(text, MAX_QUERY_LEN, str, ap);
+ va_end(ap);
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- fprintf(logfile, "\n" );
- va_end(ap2);
- fflush(logfile);
- }
- }
+ LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, text);
+ msg->param1 = param;
- if (m_gmlog_per_account)
- {
- if (FILE* per_file = openGmlogPerAccount (account))
- {
- outTimestamp(per_file);
- va_list ap;
- va_start(ap, str);
- vfprintf(per_file, str, ap);
- fprintf(per_file, "\n" );
- va_end(ap);
- fclose(per_file);
- }
- }
- else if (gmLogfile)
- {
- outTimestamp(gmLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(gmLogfile, str, ap);
- fprintf(gmLogfile, "\n" );
- va_end(ap);
- fflush(gmLogfile);
- }
-
- fflush(stdout);
+ write(msg);
}
-void Log::outChar(const char * str, ...)
+void Log::outCommand(uint32 account, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO))
return;
- if (m_enableLogDB && m_dbChar)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_CHAR, nnew_str);
- va_end(ap2);
- }
+ va_list ap;
+ va_start(ap, str);
+ char text[MAX_QUERY_LEN];
+ vsnprintf(text, MAX_QUERY_LEN, str, ap);
+ va_end(ap);
- if (charLogfile)
- {
- outTimestamp(charLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(charLogfile, str, ap);
- fprintf(charLogfile, "\n" );
- va_end(ap);
- fflush(charLogfile);
- }
-}
+ LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text);
-void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name)
-{
- FILE* file = NULL;
- if (m_charLog_Dump_Separate)
- {
- char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0
- snprintf(fileName, 29, "%d_%s.log", guid, name);
- std::string sFileName(m_dumpsDir);
- sFileName.append(fileName);
- file = fopen((m_logsDir + sFileName).c_str(), "w");
- }
- else
- file = charLogfile;
- if (file)
- {
- fprintf(file, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n",
- account_id, guid, name, str);
- fflush(file);
- if (m_charLog_Dump_Separate)
- fclose(file);
- }
+ std::ostringstream ss;
+ ss << account;
+ msg->param1 = ss.str();
+
+ write(msg);
}
-void Log::outRemote(const char * str, ...)
+void Log::SetRealmID(uint32 id)
{
- if (!str)
- return;
-
- if (m_enableLogDB && m_dbRA)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_RA, nnew_str);
- va_end(ap2);
- }
-
- if (raLogfile)
- {
- outTimestamp(raLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(raLogfile, str, ap);
- fprintf(raLogfile, "\n" );
- va_end(ap);
- fflush(raLogfile);
- }
+ realm = id;
}
-void Log::outChat(const char * str, ...)
+void Log::Close()
{
- if (!str)
- return;
-
- if (m_enableLogDB && m_dbChat)
+ delete worker;
+ worker = NULL;
+ loggers.clear();
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
{
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_CHAT, nnew_str);
- va_end(ap2);
- }
-
- if (chatLogfile)
- {
- outTimestamp(chatLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(chatLogfile, str, ap);
- fprintf(chatLogfile, "\n" );
- fflush(chatLogfile);
- va_end(ap);
+ delete it->second;
+ it->second = NULL;
}
+ appenders.clear();
}
-void Log::outErrorST(const char * str, ...)
+void Log::LoadFromConfig()
{
- va_list ap;
- va_start(ap, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap);
- va_end(ap);
-
- ACE_Stack_Trace st;
- outError("%s [Stacktrace: %s]", nnew_str, st.c_str());
-}
-
-void Log::outWarden(const char * str, ...)
-{
- if (!str)
- return;
-
- if (wardenLogFile)
- {
- outTimestamp(wardenLogFile);
- va_list ap;
- va_start(ap, str);
- vfprintf(wardenLogFile, str, ap);
- fprintf(wardenLogFile, "\n" );
- fflush(wardenLogFile);
- va_end(ap);
- }
+ Close();
+ AppenderId = 0;
+ m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
+ if (!m_logsDir.empty())
+ if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
+ m_logsDir.push_back('/');
+ ReadAppendersFromConfig();
+ ReadLoggersFromConfig();
+ worker = new LogWorker();
}
diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h
index 296c13d86c9..cd1e9dc80df 100755
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -19,196 +19,71 @@
#ifndef TRINITYCORE_LOG_H
#define TRINITYCORE_LOG_H
-#include "Common.h"
-#include <ace/Singleton.h>
-
-class Config;
-
-enum DebugLogFilters
-{
- LOG_FILTER_NONE = 0x00000000,
- LOG_FILTER_UNITS = 0x00000001, // Anything related to units that doesn't fit in other categories. ie. creature formations
- LOG_FILTER_PETS = 0x00000002,
- LOG_FILTER_VEHICLES = 0x00000004,
- LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc.
- LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI
- LOG_FILTER_MAPSCRIPTS = 0x00000020,
- LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related
- LOG_FILTER_SPELLS_AURAS = 0x00000080,
- LOG_FILTER_ACHIEVEMENTSYS = 0x00000100,
- LOG_FILTER_CONDITIONSYS = 0x00000200,
- LOG_FILTER_POOLSYS = 0x00000400,
- LOG_FILTER_AUCTIONHOUSE = 0x00000800,
- LOG_FILTER_BATTLEGROUND = 0x00001000, // Anything related to arena's and battlegrounds
- LOG_FILTER_OUTDOORPVP = 0x00002000,
- LOG_FILTER_CHATSYS = 0x00004000,
- LOG_FILTER_LFG = 0x00008000,
- LOG_FILTER_MAPS = 0x00010000, // Maps, instances, grids, cells, visibility
- LOG_FILTER_PLAYER_LOADING = 0x00020000, // Debug output from Player::_Load functions
- LOG_FILTER_PLAYER_ITEMS = 0x00040000, // Anything item related
- LOG_FILTER_PLAYER_SKILLS = 0x00080000, // Skills related
- LOG_FILTER_LOOT = 0x00100000, // Loot related
- LOG_FILTER_GUILD = 0x00200000, // Guild related
- LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related
- LOG_FILTER_WARDEN = 0x00800000, // Warden related
-};
-
-enum LogTypes
-{
- LOG_TYPE_STRING = 0,
- LOG_TYPE_ERROR = 1,
- LOG_TYPE_BASIC = 2,
- LOG_TYPE_DETAIL = 3,
- LOG_TYPE_DEBUG = 4,
- LOG_TYPE_CHAR = 5,
- LOG_TYPE_WORLD = 6,
- LOG_TYPE_RA = 7,
- LOG_TYPE_GM = 8,
- LOG_TYPE_CRASH = 9,
- LOG_TYPE_CHAT = 10,
- MAX_LOG_TYPES
-};
-
-enum LogLevel
-{
- LOGL_NORMAL = 0,
- LOGL_BASIC,
- LOGL_DETAIL,
- LOGL_DEBUG
-};
-
-const int LogLevels = int(LOGL_DEBUG)+1;
+#include "Define.h"
+#include "Appender.h"
+#include "LogWorker.h"
+#include "Logger.h"
-enum ColorTypes
-{
- BLACK,
- RED,
- GREEN,
- BROWN,
- BLUE,
- MAGENTA,
- CYAN,
- GREY,
- YELLOW,
- LRED,
- LGREEN,
- LBLUE,
- LMAGENTA,
- LCYAN,
- WHITE
-};
+#include <ace/Singleton.h>
-const int Colors = int(WHITE)+1;
+#include <string>
+#include <set>
class Log
{
friend class ACE_Singleton<Log, ACE_Thread_Mutex>;
+ typedef std::map<uint8, Logger> LoggerMap;
+
private:
Log();
~Log();
public:
- void Initialize();
-
- void ReloadConfig();
-
- void InitColors(const std::string& init_str);
- void SetColor(bool stdout_stream, ColorTypes color);
- void ResetColor(bool stdout_stream);
-
- void outErrorST(const char * err, ...) ATTR_PRINTF(2, 3);
- void outDB(LogTypes type, const char * str);
- void outString(const char * str, ...) ATTR_PRINTF(2, 3);
- void outString();
- void outStringInLine(const char * str, ...) ATTR_PRINTF(2, 3);
- void outError(const char * err, ...) ATTR_PRINTF(2, 3);
- void outCrash(const char * err, ...) ATTR_PRINTF(2, 3);
- void outBasic(const char * str, ...) ATTR_PRINTF(2, 3);
- void outDetail(const char * str, ...) ATTR_PRINTF(2, 3);
- void outSQLDev(const char * str, ...) ATTR_PRINTF(2, 3);
- void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4);
- void outStaticDebug(const char * str, ...) ATTR_PRINTF(2, 3);
- void outDebugInLine(const char * str, ...) ATTR_PRINTF(2, 3);
- void outErrorDb(const char * str, ...) ATTR_PRINTF(2, 3);
- void outChar(const char * str, ...) ATTR_PRINTF(2, 3);
- void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4);
- void outRemote(const char * str, ...) ATTR_PRINTF(2, 3);
- void outChat(const char * str, ...) ATTR_PRINTF(2, 3);
- void outArena(const char * str, ...) ATTR_PRINTF(2, 3);
- void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3);
- void outWarden(const char * str, ...) ATTR_PRINTF(2, 3);
- void outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name);
-
- static void outTimestamp(FILE* file);
+ void LoadFromConfig();
+ void Close();
+ bool ShouldLog(LogFilterType type, LogLevel level) const;
+ bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true);
+
+ void log(LogFilterType f, LogLevel level, char const* str, ...) ATTR_PRINTF(4,5);
+
+ void outTrace(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outDebug(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outInfo(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outWarn(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outError(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outFatal(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+
+ void EnableDBAppenders();
+ void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4);
+ void outCharDump(const char* param, const char* str, ...) ATTR_PRINTF(3, 4);
static std::string GetTimestampStr();
- void SetLogLevel(char * Level);
- void SetLogFileLevel(char * Level);
- void SetDBLogLevel(char * Level);
- void SetSQLDriverQueryLogging(bool newStatus) { m_sqlDriverQueryLogging = newStatus; }
- void SetRealmID(uint32 id) { realm = id; }
-
- bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
- bool IsOutCharDump() const { return m_charLog_Dump; }
+ void SetRealmID(uint32 id);
- bool GetLogDB() const { return m_enableLogDB; }
- bool GetLogDBLater() const { return m_enableLogDBLater; }
- void SetLogDB(bool enable) { m_enableLogDB = enable; }
- void SetLogDBLater(bool value) { m_enableLogDBLater = value; }
- bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; }
private:
- FILE* openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode);
- FILE* openGmlogPerAccount(uint32 account);
-
- FILE* raLogfile;
- FILE* logfile;
- FILE* gmLogfile;
- FILE* charLogfile;
- FILE* dberLogfile;
- FILE* chatLogfile;
- FILE* arenaLogFile;
- FILE* sqlLogFile;
- FILE* sqlDevLogFile;
- FILE* wardenLogFile;
-
- // cache values for after initilization use (like gm log per account case)
+ void vlog(LogFilterType f, LogLevel level, char const* str, va_list argptr);
+ void write(LogMessage* msg);
+
+ Logger* GetLoggerByType(LogFilterType filter);
+ Appender* GetAppenderByName(std::string const& name);
+ uint8 NextAppenderId();
+ void CreateAppenderFromConfig(const char* name);
+ void CreateLoggerFromConfig(const char* name);
+ void ReadAppendersFromConfig();
+ void ReadLoggersFromConfig();
+
+ AppenderMap appenders;
+ LoggerMap loggers;
+ uint8 AppenderId;
+
std::string m_logsDir;
std::string m_logsTimestamp;
- // gm log control
- bool m_gmlog_per_account;
- std::string m_gmlog_filename_format;
-
- bool m_enableLogDBLater;
- bool m_enableLogDB;
uint32 realm;
-
- // log coloring
- bool m_colored;
- ColorTypes m_colors[4];
-
- // log levels:
- // false: errors only, true: full query logging
- bool m_sqlDriverQueryLogging;
-
- // log levels:
- // 0 minimum/string, 1 basic/error, 2 detail, 3 full/debug
- uint8 m_dbLogLevel;
- uint8 m_logLevel;
- uint8 m_logFileLevel;
- bool m_dbChar;
- bool m_dbRA;
- bool m_dbGM;
- bool m_dbChat;
- bool m_charLog_Dump;
- bool m_charLog_Dump_Separate;
- std::string m_dumpsDir;
-
- DebugLogFilters m_DebugLogMask;
+ LogWorker* worker;
};
#define sLog ACE_Singleton<Log, ACE_Thread_Mutex>::instance()
#endif
-
diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp
new file mode 100644
index 00000000000..b36dd3a8b1e
--- /dev/null
+++ b/src/server/shared/Logging/LogOperation.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008-2012 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 "LogOperation.h"
+#include "Logger.h"
+
+LogOperation::~LogOperation()
+{
+ delete msg;
+}
+
+int LogOperation::call()
+{
+ if (logger && msg)
+ logger->write(*msg);
+ return 0;
+}
diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h
new file mode 100644
index 00000000000..d872670d756
--- /dev/null
+++ b/src/server/shared/Logging/LogOperation.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LOGOPERATION_H
+#define LOGOPERATION_H
+
+class Logger;
+struct LogMessage;
+
+class LogOperation
+{
+ public:
+ LogOperation(Logger* _logger, LogMessage* _msg)
+ : logger(_logger)
+ , msg(_msg)
+ { }
+
+ ~LogOperation();
+
+ int call();
+
+ protected:
+ Logger *logger;
+ LogMessage *msg;
+};
+
+#endif
diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp
new file mode 100644
index 00000000000..a12faaf224c
--- /dev/null
+++ b/src/server/shared/Logging/LogWorker.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008-2012 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 "LogWorker.h"
+
+LogWorker::LogWorker()
+ : m_queue(HIGH_WATERMARK, LOW_WATERMARK)
+{
+ ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1);
+}
+
+LogWorker::~LogWorker()
+{
+ m_queue.deactivate();
+ wait();
+}
+
+int LogWorker::enqueue(LogOperation* op)
+{
+ return m_queue.enqueue(op);
+}
+
+int LogWorker::svc()
+{
+ while (1)
+ {
+ LogOperation* request;
+ if (m_queue.dequeue(request) == -1)
+ break;
+
+ request->call();
+ delete request;
+ }
+
+ return 0;
+}
diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h
new file mode 100644
index 00000000000..ea1744f9790
--- /dev/null
+++ b/src/server/shared/Logging/LogWorker.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LOGWORKER_H
+#define LOGWORKER_H
+
+#include "LogOperation.h"
+
+#include <ace/Task.h>
+#include <ace/Activation_Queue.h>
+
+class LogWorker: protected ACE_Task_Base
+{
+ public:
+ LogWorker();
+ ~LogWorker();
+
+ typedef ACE_Message_Queue_Ex<LogOperation, ACE_MT_SYNCH> LogMessageQueueType;
+
+ enum
+ {
+ HIGH_WATERMARK = 8 * 1024 * 1024,
+ LOW_WATERMARK = 8 * 1024 * 1024
+ };
+
+ int enqueue(LogOperation *op);
+
+ private:
+ virtual int svc();
+ LogMessageQueueType m_queue;
+};
+
+#endif
diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp
new file mode 100644
index 00000000000..10276eb3acb
--- /dev/null
+++ b/src/server/shared/Logging/Logger.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2008-2012 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 "Logger.h"
+
+Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED)
+{
+}
+
+void Logger::Create(std::string const& _name, LogFilterType _type, LogLevel _level)
+{
+ name = _name;
+ type = _type;
+ level = _level;
+}
+
+Logger::~Logger()
+{
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ it->second = NULL;
+ appenders.clear();
+}
+
+std::string const& Logger::getName() const
+{
+ return name;
+}
+
+LogFilterType Logger::getType() const
+{
+ return type;
+}
+
+LogLevel Logger::getLogLevel() const
+{
+ return level;
+}
+
+void Logger::addAppender(uint8 id, Appender* appender)
+{
+ appenders[id] = appender;
+}
+
+void Logger::delAppender(uint8 id)
+{
+ AppenderMap::iterator it = appenders.find(id);
+ if (it != appenders.end())
+ {
+ it->second = NULL;
+ appenders.erase(it);
+ }
+}
+
+void Logger::setLogLevel(LogLevel _level)
+{
+ level = _level;
+}
+
+void Logger::write(LogMessage& message)
+{
+ if (!level || level > message.level || message.text.empty())
+ {
+ //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), messge.level, message.text.c_str(), .message.level); // DEBUG - RemoveMe
+ return;
+ }
+
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ if (it->second)
+ it->second->write(message);
+}
diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h
new file mode 100644
index 00000000000..9d13f08620f
--- /dev/null
+++ b/src/server/shared/Logging/Logger.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include "Appender.h"
+
+class Logger
+{
+ public:
+ Logger();
+ ~Logger();
+
+ void Create(std::string const& name, LogFilterType type, LogLevel level);
+ void addAppender(uint8 type, Appender *);
+ void delAppender(uint8 type);
+
+ std::string const& getName() const;
+ LogFilterType getType() const;
+ LogLevel getLogLevel() const;
+ void setLogLevel(LogLevel level);
+ void write(LogMessage& message);
+
+ private:
+ std::string name;
+ LogFilterType type;
+ LogLevel level;
+ AppenderMap appenders;
+};
+
+#endif
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index fb2fdf09583..760fcfd48d9 100755
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -50,8 +50,10 @@ class ByteBufferPositionException : public ByteBufferException
protected:
void PrintError() const
{
- sLog->outError("Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " ,
- (_add ? "put" : "get"), ValueSize, Pos, Size);
+ ACE_Stack_Trace trace;
+
+ sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stacktrace: %s]" ,
+ (_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str());
}
private:
@@ -70,8 +72,10 @@ class ByteBufferSourceException : public ByteBufferException
protected:
void PrintError() const
{
- sLog->outError("Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")",
- (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size);
+ ACE_Stack_Trace trace;
+
+ sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")\n[Stacktrace: %s]",
+ (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str());
}
};
@@ -185,8 +189,7 @@ class ByteBuffer
ByteBuffer &operator<<(const char *str)
{
- size_t len = 0;
- if (str && (len = strlen(str)))
+ if (size_t len = (str ? strlen(str) : 0))
append((uint8 const*)str, len);
append((uint8)0);
return *this;
@@ -448,79 +451,65 @@ class ByteBuffer
void print_storage() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() );
+ std::ostringstream o;
+ o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
- sLog->outDebugInLine("%u - ", read<uint8>(i) );
- sLog->outDebug(LOG_FILTER_NETWORKIO, " ");
+ o << read<uint8>(i) << " - ";
+ o << " ";
+
+ sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void textlike() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() );
+ std::ostringstream o;
+ o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
- sLog->outDebugInLine("%c", read<uint8>(i) );
- sLog->outDebug(LOG_FILTER_NETWORKIO, " ");
+ {
+ char buf[1];
+ snprintf(buf, 1, "%c", read<uint8>(i));
+ o << buf;
+ }
+ o << " ";
+ sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void hexlike() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
uint32 j = 1, k = 1;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() );
+
+ std::ostringstream o;
+ o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
{
+ char buf[3];
+ snprintf(buf, 1, "%2X ", read<uint8>(i));
if ((i == (j * 8)) && ((i != (k * 16))))
{
- if (read<uint8>(i) < 0x10)
- {
- sLog->outDebugInLine("| 0%X ", read<uint8>(i) );
- }
- else
- {
- sLog->outDebugInLine("| %X ", read<uint8>(i) );
- }
+ o << "| ";
++j;
}
else if (i == (k * 16))
{
- if (read<uint8>(i) < 0x10)
- {
- sLog->outDebugInLine("\n");
-
- sLog->outDebugInLine("0%X ", read<uint8>(i) );
- }
- else
- {
- sLog->outDebugInLine("\n");
-
- sLog->outDebugInLine("%X ", read<uint8>(i) );
- }
-
+ o << "\n";
++k;
++j;
}
- else
- {
- if (read<uint8>(i) < 0x10)
- {
- sLog->outDebugInLine("0%X ", read<uint8>(i) );
- }
- else
- {
- sLog->outDebugInLine("%X ", read<uint8>(i) );
- }
- }
+
+ o << buf;
}
- sLog->outDebugInLine("\n");
+ o << " ";
+ sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
protected:
diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp
index f2887a4d1bd..c6e9d385be3 100755
--- a/src/server/shared/Utilities/ServiceWin32.cpp
+++ b/src/server/shared/Utilities/ServiceWin32.cpp
@@ -257,7 +257,7 @@ bool WinServiceRun()
if (!StartServiceCtrlDispatcher(serviceTable))
{
- sLog->outError("StartService Failed. Error [%u]", ::GetLastError());
+ sLog->outError(LOG_FILTER_GENERAL, "StartService Failed. Error [%u]", ::GetLastError());
return false;
}
return true;
diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index a6d8c3cfecd..45442123258 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -81,7 +81,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
- ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp
index e85a3e1870d..23eeca11f66 100755
--- a/src/server/worldserver/CommandLine/CliRunnable.cpp
+++ b/src/server/worldserver/CommandLine/CliRunnable.cpp
@@ -116,458 +116,6 @@ void commandFinished(void*, bool /*success*/)
fflush(stdout);
}
-/**
- * Collects all GUIDs (and related info) from deleted characters which are still in the database.
- *
- * @param foundList a reference to an std::list which will be filled with info data
- * @param searchString the search string which either contains a player GUID or a part fo the character-name
- * @return returns false if there was a problem while selecting the characters (e.g. player name not normalizeable)
- */
-bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString)
-{
- PreparedQueryResult result;
- PreparedStatement* stmt;
- if (!searchString.empty())
- {
- // search by GUID
- if (isNumeric(searchString.c_str()))
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID);
-
- stmt->setUInt32(0, uint32(atoi(searchString.c_str())));
-
- result = CharacterDatabase.Query(stmt);
- }
- // search by name
- else
- {
- if (!normalizePlayerName(searchString))
- return false;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
-
- stmt->setString(0, searchString);
-
- result = CharacterDatabase.Query(stmt);
- }
- }
- else
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
-
- result = CharacterDatabase.Query(stmt);
- }
-
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
-
- DeletedInfo info;
-
- info.lowguid = fields[0].GetUInt32();
- info.name = fields[1].GetString();
- info.accountId = fields[2].GetUInt32();
-
- // account name will be empty for not existed account
- AccountMgr::GetName(info.accountId, info.accountName);
-
- info.deleteDate = time_t(fields[3].GetUInt32());
-
- foundList.push_back(info);
- } while (result->NextRow());
- }
-
- return true;
-}
-
-/**
- * Generate WHERE guids list by deleted info in way preventing return too long where list for existed query string length limit.
- *
- * @param itr a reference to an deleted info list iterator, it updated in function for possible next function call if list to long
- * @param itr_end a reference to an deleted info list iterator end()
- * @return returns generated where list string in form: 'guid IN (gui1, guid2, ...)'
- */
-std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end)
-{
- std::ostringstream wherestr;
- wherestr << "guid IN ('";
- for (; itr != itr_end; ++itr)
- {
- wherestr << itr->lowguid;
-
- if (wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query
- {
- ++itr;
- break;
- }
-
- DeletedInfoList::const_iterator itr2 = itr;
- if (++itr2 != itr_end)
- wherestr << "', '";
- }
- wherestr << "')";
- return wherestr.str();
-}
-
-/**
- * Shows all deleted characters which matches the given search string, expected non empty list
- *
- * @see ChatHandler::HandleCharacterDeletedListCommand
- * @see ChatHandler::HandleCharacterDeletedRestoreCommand
- * @see ChatHandler::HandleCharacterDeletedDeleteCommand
- * @see ChatHandler::DeletedInfoList
- *
- * @param foundList contains a list with all found deleted characters
- */
-void ChatHandler::HandleCharacterDeletedListHelper(DeletedInfoList const& foundList)
-{
- if (!m_session)
- {
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER);
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
- }
-
- for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
- {
- std::string dateStr = TimeToTimestampStr(itr->deleteDate);
-
- if (!m_session)
- PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
- itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
- itr->accountId, dateStr.c_str());
- else
- PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
- itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
- itr->accountId, dateStr.c_str());
- }
-
- if (!m_session)
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
-}
-
-/**
- * Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string
- *
- * @see ChatHandler::HandleCharacterDeletedListHelper
- * @see ChatHandler::HandleCharacterDeletedRestoreCommand
- * @see ChatHandler::HandleCharacterDeletedDeleteCommand
- * @see ChatHandler::DeletedInfoList
- *
- * @param args the search string which either contains a player GUID or a part fo the character-name
- */
-bool ChatHandler::HandleCharacterDeletedListCommand(const char* args)
-{
- DeletedInfoList foundList;
- if (!GetDeletedCharacterInfoList(foundList, args))
- return false;
-
- // if no characters have been found, output a warning
- if (foundList.empty())
- {
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
- return false;
- }
-
- HandleCharacterDeletedListHelper(foundList);
- return true;
-}
-
-/**
- * Restore a previously deleted character
- *
- * @see ChatHandler::HandleCharacterDeletedListHelper
- * @see ChatHandler::HandleCharacterDeletedRestoreCommand
- * @see ChatHandler::HandleCharacterDeletedDeleteCommand
- * @see ChatHandler::DeletedInfoList
- *
- * @param delInfo the informations about the character which will be restored
- */
-void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo)
-{
- if (delInfo.accountName.empty()) // account not exist
- {
- PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
- return;
- }
-
- // check character count
- uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
- if (charcount >= 10)
- {
- PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
- return;
- }
-
- if (sObjectMgr->GetPlayerGUIDByName(delInfo.name))
- {
- PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
- return;
- }
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
-
- stmt->setString(0, delInfo.name);
- stmt->setUInt32(1, delInfo.accountId);
- stmt->setUInt32(2, delInfo.lowguid);
-
- CharacterDatabase.Execute(stmt);
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
- stmt->setUInt32(0, delInfo.lowguid);
- if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
- sWorld->AddCharacterNameData(delInfo.lowguid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8());
-}
-
-/**
- * Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string
- *
- * The command automatically calls '.character deleted list' command with the search string to show all restored characters.
- *
- * @see ChatHandler::HandleCharacterDeletedRestoreHelper
- * @see ChatHandler::HandleCharacterDeletedListCommand
- * @see ChatHandler::HandleCharacterDeletedDeleteCommand
- *
- * @param args the search string which either contains a player GUID or a part of the character-name
- */
-bool ChatHandler::HandleCharacterDeletedRestoreCommand(const char* args)
-{
- // It is required to submit at least one argument
- if (!*args)
- return false;
-
- std::string searchString;
- std::string newCharName;
- uint32 newAccount = 0;
-
- // GCC by some strange reason fail build code without temporary variable
- std::istringstream params(args);
- params >> searchString >> newCharName >> newAccount;
-
- DeletedInfoList foundList;
- if (!GetDeletedCharacterInfoList(foundList, searchString))
- return false;
-
- if (foundList.empty())
- {
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
- return false;
- }
-
- SendSysMessage(LANG_CHARACTER_DELETED_RESTORE);
- HandleCharacterDeletedListHelper(foundList);
-
- if (newCharName.empty())
- {
- // Drop not existed account cases
- for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
- HandleCharacterDeletedRestoreHelper(*itr);
- }
- else if (foundList.size() == 1 && normalizePlayerName(newCharName))
- {
- DeletedInfo delInfo = foundList.front();
-
- // update name
- delInfo.name = newCharName;
-
- // if new account provided update deleted info
- if (newAccount && newAccount != delInfo.accountId)
- {
- delInfo.accountId = newAccount;
- AccountMgr::GetName(newAccount, delInfo.accountName);
- }
-
- HandleCharacterDeletedRestoreHelper(delInfo);
- }
- else
- SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
-
- return true;
-}
-
-/**
- * Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string
- *
- * @see Player::GetDeletedCharacterGUIDs
- * @see Player::DeleteFromDB
- * @see ChatHandler::HandleCharacterDeletedListCommand
- * @see ChatHandler::HandleCharacterDeletedRestoreCommand
- *
- * @param args the search string which either contains a player GUID or a part fo the character-name
- */
-bool ChatHandler::HandleCharacterDeletedDeleteCommand(const char* args)
-{
- // It is required to submit at least one argument
- if (!*args)
- return false;
-
- DeletedInfoList foundList;
- if (!GetDeletedCharacterInfoList(foundList, args))
- return false;
-
- if (foundList.empty())
- {
- SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
- return false;
- }
-
- SendSysMessage(LANG_CHARACTER_DELETED_DELETE);
- HandleCharacterDeletedListHelper(foundList);
-
- // Call the appropriate function to delete them (current account for deleted characters is 0)
- for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
- Player::DeleteFromDB(itr->lowguid, 0, false, true);
-
- return true;
-}
-
-/**
- * Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago
- *
- * @see Player::DeleteOldCharacters
- * @see Player::DeleteFromDB
- * @see ChatHandler::HandleCharacterDeletedDeleteCommand
- * @see ChatHandler::HandleCharacterDeletedListCommand
- * @see ChatHandler::HandleCharacterDeletedRestoreCommand
- *
- * @param args the search string which either contains a player GUID or a part fo the character-name
- */
-bool ChatHandler::HandleCharacterDeletedOldCommand(const char* args)
-{
- int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
-
- char* px = strtok((char*)args, " ");
- if (px)
- {
- if (!isNumeric(px))
- return false;
-
- keepDays = atoi(px);
- if (keepDays < 0)
- return false;
- }
- // config option value 0 -> disabled and can't be used
- else if (keepDays <= 0)
- return false;
-
- Player::DeleteOldCharacters((uint32)keepDays);
- return true;
-}
-
-bool ChatHandler::HandleCharacterEraseCommand(const char* args){
- if (!*args)
- return false;
-
- char *character_name_str = strtok((char*)args, " ");
- if (!character_name_str)
- return false;
-
- std::string character_name = character_name_str;
- if (!normalizePlayerName(character_name))
- return false;
-
- uint64 character_guid;
- uint32 account_id;
-
- Player* player = sObjectAccessor->FindPlayerByName(character_name.c_str());
- if (player)
- {
- character_guid = player->GetGUID();
- account_id = player->GetSession()->GetAccountId();
- player->GetSession()->KickPlayer();
- }
- else
- {
- character_guid = sObjectMgr->GetPlayerGUIDByName(character_name);
- if (!character_guid)
- {
- PSendSysMessage(LANG_NO_PLAYER, character_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- account_id = sObjectMgr->GetPlayerAccountIdByGUID(character_guid);
- }
-
- std::string account_name;
- AccountMgr::GetName (account_id, account_name);
-
- Player::DeleteFromDB(character_guid, account_id, true, true);
- PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id);
- return true;
-}
-
-/// Exit the realm
-bool ChatHandler::HandleServerExitCommand(const char* /*args*/)
-{
- SendSysMessage(LANG_COMMAND_EXIT);
- World::StopNow(SHUTDOWN_EXIT_CODE);
- return true;
-}
-
-/// Set the level of logging
-bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char *NewLevel = strtok((char*)args, " ");
- if (!NewLevel)
- return false;
-
- sLog->SetLogFileLevel(NewLevel);
- return true;
-}
-
-/// Set the level of logging
-bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char *NewLevel = strtok((char*)args, " ");
- if (!NewLevel)
- return false;
-
- sLog->SetLogLevel(NewLevel);
- return true;
-}
-
-/// set diff time record interval
-bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char *NewTimeStr = strtok((char*)args, " ");
- if (!NewTimeStr)
- return false;
-
- int32 NewTime =atoi(NewTimeStr);
- if (NewTime < 0)
- return false;
-
- sWorld->SetRecordDiffInterval(NewTime);
- printf( "Record diff every %u ms\n", NewTime);
- return true;
-}
-
-/// toggle sql driver query logging
-bool ChatHandler::HandleServerToggleQueryLogging(const char* /* args */)
-{
- sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging());
- if (sLog->GetSQLDriverQueryLogging())
- PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED);
- else
- PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED);
-
- return true;
-}
-
-/// @}
-
#ifdef linux
// Non-blocking keypress detector, when return pressed, return 1, else always return 0
int kb_hit_return()
@@ -587,7 +135,7 @@ int kb_hit_return()
void CliRunnable::run()
{
///- Display the list of available CLI functions then beep
- //sLog->outString("");
+ //sLog->outInfo(LOG_FILTER_WORLDSERVER, "");
#if PLATFORM != PLATFORM_WINDOWS
rl_attempted_completion_function = cli_completion;
rl_event_hook = cli_hook_func;
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 04820f59355..862ed28f2d3 100755
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -58,7 +58,7 @@ uint32 realmID; ///< Id of the realm
/// Print out the usage string for this program on the console.
void usage(const char *prog)
{
- sLog->outString("Usage: \n %s [<options>]\n"
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r"
#ifdef _WIN32
" Running as service functions:\n\r"
@@ -81,7 +81,7 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError("Runtime-Error: -c option requires an input argument");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
@@ -97,25 +97,25 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError("Runtime-Error: -s option requires an input argument");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: -s option requires an input argument");
usage(argv[0]);
return 1;
}
if (strcmp(argv[c], "install") == 0)
{
if (WinServiceInstall())
- sLog->outString("Installing service");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Installing service");
return 1;
}
else if (strcmp(argv[c], "uninstall") == 0)
{
if (WinServiceUninstall())
- sLog->outString("Uninstalling service");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Uninstalling service");
return 1;
}
else
{
- sLog->outError("Runtime-Error: unsupported option %s", argv[c]);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: unsupported option %s", argv[c]);
usage(argv[0]);
return 1;
}
@@ -131,14 +131,14 @@ extern int main(int argc, char **argv)
if (!ConfigMgr::Load(cfg_file))
{
- sLog->outError("Invalid or missing configuration file : %s", cfg_file);
- sLog->outError("Verify that the file exists and has \'[worldserver]' written in the top of the file!");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Invalid or missing configuration file : %s", cfg_file);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Verify that the file exists and has \'[worldserver]' written in the top of the file!");
return 1;
}
- sLog->outString("Using configuration file %s.", cfg_file);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using configuration file %s.", cfg_file);
- sLog->outString("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
- sLog->outString("Using ACE version: %s", ACE_VERSION);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using ACE version: %s", ACE_VERSION);
///- and run the 'Master'
/// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 03b2859c514..7587a9d1904 100755
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -84,7 +84,7 @@ public:
{
if (!_delaytime)
return;
- sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000);
m_loops = 0;
w_loops = 0;
m_lastchange = 0;
@@ -102,11 +102,11 @@ public:
// possible freeze
else if (getMSTimeDiff(w_lastchange, curtime) > _delaytime)
{
- sLog->outError("World Thread hangs, kicking out server!");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "World Thread hangs, kicking out server!");
ASSERT(false);
}
}
- sLog->outString("Anti-freeze thread exiting without problems.");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Anti-freeze thread exiting without problems.");
}
};
@@ -124,18 +124,18 @@ int Master::Run()
BigNumber seed1;
seed1.SetRand(16 * 8);
- sLog->outString("%s (worldserver-daemon)", _FULLVERSION);
- sLog->outString("<Ctrl-C> to stop.\n");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon)", _FULLVERSION);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "<Ctrl-C> to stop.\n");
- sLog->outString(" ______ __");
- sLog->outString("/\\__ _\\ __ __/\\ \\__");
- sLog->outString("\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
- sLog->outString(" \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
- sLog->outString(" \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
- sLog->outString(" \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
- sLog->outString(" \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
- sLog->outString(" C O R E /\\___/");
- sLog->outString("http://TrinityCore.org \\/__/\n");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " ______ __");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "/\\__ _\\ __ __/\\ \\__");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " C O R E /\\___/");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "http://TrinityCore.org \\/__/\n");
/// worldserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
@@ -144,11 +144,11 @@ int Master::Run()
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
- sLog->outError("Cannot create PID file %s.\n", pidfile.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
- sLog->outString("Daemon PID: %u\n", pid);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid);
}
///- Start the databases
@@ -161,13 +161,13 @@ int Master::Run()
///- Initialize the World
sWorld->SetInitialWorldSettings();
- // Initialise the signal handlers
+ ///- Initialize the signal handlers
WorldServerSignalHandler SignalINT, SignalTERM;
#ifdef _WIN32
WorldServerSignalHandler SignalBREAK;
#endif /* _WIN32 */
- // Register worldserver's signal handlers
+ ///- Register worldserver's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
@@ -210,17 +210,16 @@ int Master::Run()
if (!curAff)
{
- sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
}
else
{
if (SetProcessAffinityMask(hProcess, curAff))
- sLog->outString("Using processors (bitmask, hex): %x", curAff);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff);
else
- sLog->outError("Can't set used processors (hex): %x", curAff);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff);
}
}
- sLog->outString("");
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
@@ -229,10 +228,9 @@ int Master::Run()
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
- sLog->outString("worldserver process priority class set to HIGH");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH");
else
- sLog->outError("Can't set worldserver process priority class.");
- sLog->outString("");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class.");
}
}
#endif
@@ -242,7 +240,7 @@ int Master::Run()
if (ConfigMgr::GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable* runnable = new TCSoapRunnable();
- runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), ConfigMgr::GetIntDefault("SOAP.Port", 7878));
+ runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(ConfigMgr::GetIntDefault("SOAP.Port", 7878)));
soap_thread = new ACE_Based::Thread(runnable);
}
@@ -250,7 +248,7 @@ int Master::Run()
if (uint32 freeze_delay = ConfigMgr::GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable();
- fdr->SetDelayTime(freeze_delay*1000);
+ fdr->SetDelayTime(freeze_delay * 1000);
ACE_Based::Thread freeze_thread(fdr);
freeze_thread.setPriority(ACE_Based::Highest);
}
@@ -259,9 +257,9 @@ int Master::Run()
uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD);
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
- if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str ()) == -1)
+ if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str()) == -1)
{
- sLog->outError("Failed to start network");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
@@ -269,7 +267,7 @@ int Master::Run()
// set server online (allow connecting now)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
- sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon) ready...", _FULLVERSION);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
@@ -291,7 +289,7 @@ int Master::Run()
_StopDB();
- sLog->outString("Halting process...");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Halting process...");
if (cliThread)
{
@@ -356,21 +354,20 @@ bool Master::_StartDB()
{
MySQL::Library_Init();
- sLog->SetLogDB(false);
std::string dbstring;
uint8 async_threads, synch_threads;
dbstring = ConfigMgr::GetStringDefault("WorldDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("World database not specified in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "World database not specified in configuration file");
return false;
}
async_threads = ConfigMgr::GetIntDefault("WorldDatabase.WorkerThreads", 1);
if (async_threads < 1 || async_threads > 32)
{
- sLog->outError("World database: invalid number of worker threads specified. "
+ sLog->outError(LOG_FILTER_WORLDSERVER, "World database: invalid number of worker threads specified. "
"Please pick a value between 1 and 32.");
return false;
}
@@ -379,7 +376,7 @@ bool Master::_StartDB()
///- Initialise the world database
if (!WorldDatabase.Open(dbstring, async_threads, synch_threads))
{
- sLog->outError("Cannot connect to world database %s", dbstring.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbstring.c_str());
return false;
}
@@ -387,14 +384,14 @@ bool Master::_StartDB()
dbstring = ConfigMgr::GetStringDefault("CharacterDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("Character database not specified in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Character database not specified in configuration file");
return false;
}
async_threads = ConfigMgr::GetIntDefault("CharacterDatabase.WorkerThreads", 1);
if (async_threads < 1 || async_threads > 32)
{
- sLog->outError("Character database: invalid number of worker threads specified. "
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Character database: invalid number of worker threads specified. "
"Please pick a value between 1 and 32.");
return false;
}
@@ -404,7 +401,7 @@ bool Master::_StartDB()
///- Initialise the Character database
if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads))
{
- sLog->outError("Cannot connect to Character database %s", dbstring.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbstring.c_str());
return false;
}
@@ -412,14 +409,14 @@ bool Master::_StartDB()
dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("Login database not specified in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Login database not specified in configuration file");
return false;
}
async_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (async_threads < 1 || async_threads > 32)
{
- sLog->outError("Login database: invalid number of worker threads specified. "
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Login database: invalid number of worker threads specified. "
"Please pick a value between 1 and 32.");
return false;
}
@@ -428,7 +425,7 @@ bool Master::_StartDB()
///- Initialise the login database
if (!LoginDatabase.Open(dbstring, async_threads, synch_threads))
{
- sLog->outError("Cannot connect to login database %s", dbstring.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbstring.c_str());
return false;
}
@@ -436,14 +433,11 @@ bool Master::_StartDB()
realmID = ConfigMgr::GetIntDefault("RealmID", 0);
if (!realmID)
{
- sLog->outError("Realm ID not defined in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Realm ID not defined in configuration file");
return false;
}
- sLog->outString("Realm running as realm ID %d", realmID);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Realm running as realm ID %d", realmID);
- ///- Initialize the DB logging system
- sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
- sLog->SetLogDB(false);
sLog->SetRealmID(realmID);
///- Clean the database before starting
@@ -454,7 +448,7 @@ bool Master::_StartDB()
sWorld->LoadDBVersion();
- sLog->outString("Using World DB: %s", sWorld->GetDBVersion());
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using World DB: %s", sWorld->GetDBVersion());
return true;
}
diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp
index 3f5d7bde736..7a1fff51afd 100644
--- a/src/server/worldserver/RemoteAccess/RARunnable.cpp
+++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp
@@ -67,11 +67,11 @@ void RARunnable::run()
if (acceptor.open(listen_addr, m_Reactor) == -1)
{
- sLog->outError("Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
return;
}
- sLog->outString("Starting Trinity RA on port %d on %s", raport, stringip.c_str());
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raport, stringip.c_str());
while (!World::IsStopped())
{
@@ -82,5 +82,5 @@ void RARunnable::run()
break;
}
- sLog->outStaticDebug("Trinity RA thread exiting");
+ sLog->outDebug(LOG_FILTER_WORLDSERVER, "Trinity RA thread exiting");
}
diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp
index ebc7c7624d9..18c90aa5ba5 100755
--- a/src/server/worldserver/RemoteAccess/RASocket.cpp
+++ b/src/server/worldserver/RemoteAccess/RASocket.cpp
@@ -45,18 +45,18 @@ int RASocket::open(void *)
if (peer().get_remote_addr(remote_addr) == -1)
{
- sLog->outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
+ sLog->outError(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
return -1;
}
- sLog->outRemote("Incoming connection from %s", remote_addr.get_host_addr());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr());
return activate();
}
int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask)
{
- sLog->outRemote("Closing connection");
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Closing connection");
peer().close_reader();
wait();
destroy();
@@ -122,7 +122,7 @@ int RASocket::recv_line(std::string& out_line)
if (recv_line(message_block) == -1)
{
- sLog->outRemote("Recv error %s", ACE_OS::strerror(errno));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Recv error %s", ACE_OS::strerror(errno));
return -1;
}
@@ -136,7 +136,7 @@ int RASocket::process_command(const std::string& command)
if (command.length() == 0)
return 0;
- sLog->outRemote("Got command: %s", command.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Got command: %s", command.c_str());
// handle quit, exit and logout commands to terminate connection
if (command == "quit" || command == "exit" || command == "logout") {
@@ -186,7 +186,7 @@ int RASocket::check_access_level(const std::string& user)
if (!result)
{
- sLog->outRemote("User %s does not exist in database", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str());
return -1;
}
@@ -194,12 +194,12 @@ int RASocket::check_access_level(const std::string& user)
if (fields[1].GetUInt8() < _minLevel)
{
- sLog->outRemote("User %s has no privilege to login", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str());
return -1;
}
else if (fields[2].GetInt32() != -1)
{
- sLog->outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
return -1;
}
@@ -225,7 +225,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass)
if (!result)
{
- sLog->outRemote("Wrong password for user: %s", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str());
return -1;
}
@@ -248,7 +248,7 @@ int RASocket::authenticate()
if (recv_line(pass) == -1)
return -1;
- sLog->outRemote("Login attempt for user: %s", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str());
if (check_access_level(user) == -1)
return -1;
@@ -256,7 +256,7 @@ int RASocket::authenticate()
if (check_password(user, pass) == -1)
return -1;
- sLog->outRemote("User login: %s", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str());
return 0;
}
@@ -290,7 +290,7 @@ int RASocket::subnegotiate()
if (n >= 1024)
{
- sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
return -1;
}
@@ -324,7 +324,7 @@ int RASocket::subnegotiate()
uint8 param = buf[++i];
ss << uint32(param);
- sLog->outRemote(ss.str().c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, ss.str().c_str());
}
++i;
}
@@ -385,7 +385,7 @@ void RASocket::zprint(void* callbackArg, const char * szText)
if (socket->putq(mb, const_cast<ACE_Time_Value*>(&ACE_Time_Value::zero)) == -1)
{
- sLog->outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
mb->release();
}
}
@@ -406,7 +406,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/)
if (socket->putq(mb) == -1)
{
// getting here is bad, command can't be marked as complete
- sLog->outRemote("Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
mb->release();
}
}
diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp
index 26b28b25fbb..3ce4d4f59cb 100755
--- a/src/server/worldserver/TCSoap/TCSoap.cpp
+++ b/src/server/worldserver/TCSoap/TCSoap.cpp
@@ -32,11 +32,11 @@ void TCSoapRunnable::run()
soap.send_timeout = 5;
if (!soap_valid_socket(soap_bind(&soap, m_host.c_str(), m_port, 100)))
{
- sLog->outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
exit(-1);
}
- sLog->outString("TCSoap: bound to http://%s:%d", m_host.c_str(), m_port);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "TCSoap: bound to http://%s:%d", m_host.c_str(), m_port);
while (!World::IsStopped())
{
@@ -119,7 +119,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
int acc = connection.pendingCommands.acquire();
if (acc)
{
- sLog->outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
}
// alright, command finished
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 7366d248950..d412a269291 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -20,6 +20,7 @@
# SERVER RATES
# AUTO BROADCAST
# BATTLEGROUND CONFIG
+# BATTLEFIELD CONFIG
# ARENA CONFIG
# NETWORK CONFIG
# CONSOLE AND REMOTE ACCESS
@@ -419,316 +420,13 @@ PersistentCharacterCleanFlags = 0
PidFile = ""
#
-# LogLevel
-# Description: Server console level of logging
-# Default: 1 - (Basic)
-# 0 - (Minimum)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogLevel = 1
-
-#
-# LogFile
-# Description: Log file for main server log.
-# Default: "Server.log" - (Enabled)
-# "" - (Disabled)
-
-LogFile = "Server.log"
-
-#
-# LogTimestamp
-# Description: Append timestamp to the server log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogTimestamp = 0
-
-#
-# LogFileLevel
-# Description: Server file level of logging
-# Default: 0 - (Minimum)
-# 1 - (Basic)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogFileLevel = 0
-
-#
-# Debug Log Mask
-# Description: Bitmask that determines which debug log output (level 3)
-# will be logged.
-# Possible flags:
-# 1 - Anything related to units that doesn't fit in other
-# categories.
-# 2 - Anything related to pets.
-# 4 - Anything related to vehicles.
-# 8 - Anything related to C++ AI, instance scripts, etc.
-# 16 - Anything related to DB AI, such as SAI, EAI, CreatureAI
-# 32 - Anything related to DB map scripts
-# 64 - Anything related to network input/output,
-# such as packet handlers and netcode logs
-# 128 - Anything related to the spellsystem and aurasystem
-# 256 - Anything related to the achievement system
-# 512 - Anything related to the condition system
-# 1024 - Anything related to the pool system
-# 2048 - Anything related to the auction house
-# 4096 - Anything related to arena's and battlegrounds
-# 8192 - Anything related to outdoor PVP
-# 16384 - Anything related to the chat system
-# 32768 - Anything related to the LFG system
-# 65536 - Anything related to maps, instances (not scripts),
-# grids, cells, visibility, etc.
-# 131072 - Anything related to player loading from DB
-# (Player::_LoadXXX functions)
-# 262144 - Anything related to items
-# 524288 - Anything related to player skills
-# (do not confuse with spells)
-# 1048576 - Anything related to loot
-# 2097152 - Anything related to guilds
-# 4194304 - Anything related to transports
-# 8388608 - Anything related to Warden anti cheat
-#
-# Simply add the values together to create a bitmask.
-# For more info see enum DebugLogFilters in Log.h
-#
-# Default: 0 (nothing)
-
-DebugLogMask = 0
-
-#
-# WorldLogFile
-# Description: Packet logging file for the world server.
-# Example: "World.log" - (Enabled)
-# Default: "" - (Disabled)
-
-WorldLogFile = ""
-
-#
-# DBErrorLogFile
-# Description: Log file for database errors.
-# Default: "DBErrors.log" - (Enabled)
-# "" - (Disabled)
-
-DBErrorLogFile = "DBErrors.log"
-
-#
-# CharLogFile
-# Description: Log file for character operations
-# Default: "Char.log" - (Enabled)
-# "" - (Disabled)
-
-CharLogFile = "Char.log"
-
-#
-# CharLogTimestamp
-# Description: Append timestamp to the character log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-CharLogTimestamp = 0
-
-#
-# CharLogDump
-# Description: Write a character dump in the CharLogFile before deleting it.
-# For restoration, copy character data from log file starting from
-# line == START DUMP == to line == END DUMP == (exclusive)
-# and load it using the "pdump load" command.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-CharLogDump = 0
-
-#
-# CharLogDump.Separate
-# Description: Write character dump to separate files files rather than adding it to the
-# CharLogFile.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-CharLogDump.Separate = 0
-
-#
-# CharLogDump.SeparateDir
-# Description: Write dump files into the sub folder within the log folder.
-# Example: "chardumps" - (Enabled)
-# Default: "" - (Disabled)
-
-CharLogDump.SeparateDir = ""
-
-#
-# GmLogFile
-# Description: Log file for gamemaster commands.
-# Default: "GM.log" - (Enabled)
-# "" - (Disabled)
-
-GmLogFile = "GM.log"
-
-#
-# GmLogTimestamp
-# Description: Append timestamp to the gamemaster log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-GmLogTimestamp = 0
-
-#
-# GmLogPerAccount
-# Description: Create a log file per gamemaster account.
-# Important: Logs not created if GmLogFile is not set.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-GmLogPerAccount = 0
-
-#
-# RaLogFile
-# Description: Log file for Remote Access commands.
-# Default: "RA.log" - (Enabled)
-# "" - (Disabled)
-
-RaLogFile = "RA.log"
-
-#
-# ArenaLogFile
-# Description: Log file for arena fights and arena team creations.
-# Example: "Arena.log" - (Enabled)
-# Default: "" - (Disabled)
-
-ArenaLogFile = ""
-
-#
-# ArenaLog.ExtendedInfo
-# Description: Include extended info to ArenaLogFile for each player after rated arena
-# matches (guid, name, team, IP, healing/damage done, killing blows).
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-ArenaLog.ExtendedInfo = 0
-
-#
-# SQLDeveloperLogFile
-# Description: Log file for core-generated SQL queries/dumps
-# Example: "SQLDev.log" - (Enabled)
-# Default: "" - (Disabled)
-
-SQLDeveloperLogFile = ""
-
-#
-# SQLDriverLogFile
-# Description: Log file for SQL driver events.
-# Example: "SQLDriver.log" - (Enabled)
-# Default: "" - (Disabled)
-
-SQLDriverLogFile = ""
-
-#
-# SQLDriverQueryLogging
-# Description: Log SQL queries to the SQLDriverLogFile and console.
-# Default: 0 - (Disabled, Query errors only)
-# 1 - (Enabled, Full query logging - may have performance impact)
-
-SQLDriverQueryLogging = 0
-
-#
-# LogColors
-# Description: Colors for log messages (Format: "normal basic detail debug").
-# Colors: 0 - Black
-# 1 - Red
-# 2 - Green
-# 3 - Brown
-# 4 - Blue
-# 5 - Magenta
-# 6 - Cyan
-# 7 - Grey
-# 8 - Yellow
-# 9 - Lred
-# 10 - Lgreen
-# 11 - Lblue
-# 12 - Lmagenta
-# 13 - Lcyan
-# 14 - White
-# Example: "13 11 9 5" - (Enabled)
+# PacketLogFile
+# Description: Binary packet logging file for the world server.
+# Filename extension must be .bin to be parsable with WowPacketParser.
+# Example: "World.bin" - (Enabled)
# Default: "" - (Disabled)
-LogColors = ""
-
-#
-# EnableLogDB
-# Description: Write log messages to database (LogDatabaseInfo).
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-EnableLogDB = 0
-
-#
-# DBLogLevel
-# Description: Log level of databases logging.
-# Default: 2 - (Detail)
-# 0 - (Minimum)
-# 1 - (Basic)
-# 3 - (Full/Debug)
-
-DBLogLevel = 2
-
-#
-# LogDB.Char
-# Description: Log character operations to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.Char = 0
-
-#
-# LogDB.GM
-# Description: Log gamemaster commands to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.GM = 0
-
-#
-# LogDB.RA
-# Description: Log remote access events to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.RA = 0
-
-#
-# LogDB.World
-# Description: Log world server packets to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled, May have performance impact)
-
-LogDB.World = 0
-
-#
-# LogDB.Chat
-# Description: Log chat messages to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.Chat = 0
-
-
-# ChatLogFile
-# Description: Log file for chat logs.
-# Default: "Chat.log" - (Enabled)
-# "" - (Disabled)
-
-ChatLogFile = "Chat.log"
-
-# ChatLogTimestamp
-# Description: Append timestamp to the chat log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-ChatLogTimestamp = 0
+PacketLogFile = ""
#
# ChatLogs.Channel
@@ -804,6 +502,7 @@ ChatLogs.Addon = 0
ChatLogs.BattleGround = 0
+# Extended Logging system configuration moved to end of file (on purpose)
#
###################################################################################################
@@ -1475,15 +1174,6 @@ Warden.NumMemChecks = 3
Warden.NumOtherChecks = 7
#
-# Warden.LogFile
-# Description: Client check fails will be logged here.
-# Default: "" - (Disabled)
-# "Warden.log" - (Enabled)
-#
-
-Warden.LogFile = ""
-
-#
# Warden.ClientResponseDelay
# Description: Time (in seconds) before client is getting disconnecting for not responding.
# Default: 600 - (10 Minutes)
@@ -1503,7 +1193,7 @@ Warden.ClientCheckHoldOff = 30
#
# Warden.ClientCheckFailAction
# Description: Default action being taken if a client check failed. Actions can be
-# overwritten for each single check via warden_action table in characters
+# overwritten for each single check via warden_action table in characters
# database.
# Default: 0 - (Disabled, Logging only)
# 1 - (Kick)
@@ -2039,17 +1729,17 @@ Visibility.GroupMode = 1
# Visibility.Distance.Instances
# Visibility.Distance.BGArenas
# Description: Visibility distance to see other players or gameobjects.
-# Visibility on continents on retail ~90 yards. In BG/Arenas ~180.
-# For instances default ~120.
-# Max limited by active player zone: ~ 333
+# Visibility on continents on retail ~90 yards. In BG/Arenas ~533.
+# For instances default ~170.
+# Max limited by grid size: 533.33333
# Min limit is max aggro radius (45) * Rate.Creature.Aggro
# Default: 90 - (Visibility.Distance.Continents)
-# 120 - (Visibility.Distance.Instances)
-# 180 - (Visibility.Distance.BGArenas)
+# 170 - (Visibility.Distance.Instances)
+# 533 - (Visibility.Distance.BGArenas)
Visibility.Distance.Continents = 90
-Visibility.Distance.Instances = 120
-Visibility.Distance.BGArenas = 180
+Visibility.Distance.Instances = 170
+Visibility.Distance.BGArenas = 533
#
# Visibility.Notify.Period.OnContinents
@@ -2266,9 +1956,9 @@ Rate.MoveSpeed = 1
#
# Rate.InstanceResetTime
-# Description: Multiplier for the rate between global raid/heroic instance resets
-# (dbc value). Higher value increases the time between resets,
-# lower value lowers the time, you need clean instance_reset in
+# Description: Multiplier for the rate between global raid/heroic instance resets
+# (dbc value). Higher value increases the time between resets,
+# lower value lowers the time, you need clean instance_reset in
# characters db in order to let new values work.
# Default: 1
@@ -2510,6 +2200,62 @@ Battleground.Random.ResetHour = 6
###################################################################################################
###################################################################################################
+# BATTLEFIELD CONFIG
+#
+# Wintergrasp.Enable
+# Description: Enable the Wintergrasp battlefield.
+# Default: 0 - (Disabled)
+# 1 - (Enabled, Experimental as of still being in development)
+
+Wintergrasp.Enable = 0
+
+#
+# Wintergrasp.PlayerMax
+# Description: Maximum number of players allowed in Wintergrasp.
+# Default: 100
+
+Wintergrasp.PlayerMax = 100
+
+#
+# Wintergrasp.PlayerMin
+# Description: Minimum number of players required for Wintergrasp.
+# Default: 0
+
+Wintergrasp.PlayerMin = 0
+
+#
+# Wintergrasp.PlayerMinLvl
+# Description: Required character level for the Wintergrasp battle.
+# Default: 77
+
+Wintergrasp.PlayerMinLvl = 77
+
+#
+# Wintergrasp.BattleTimer
+# Description: Time (in minutes) for the Wintergrasp battle to last.
+# Default: 30
+
+Wintergrasp.BattleTimer = 30
+
+#
+# Wintergrasp.NoBattleTimer
+# Description: Time (in minutes) between Wintergrasp battles.
+# Default: 150
+
+Wintergrasp.NoBattleTimer = 150
+
+#
+# Wintergrasp.CrashRestartTimer
+# Description: Time (in minutes) to delay the restart of Wintergrasp if the world server
+# crashed during a running battle.
+# Default: 10
+
+Wintergrasp.CrashRestartTimer = 10
+
+#
+###################################################################################################
+
+###################################################################################################
# ARENA CONFIG
#
# Arena.MaxRatingDifference
@@ -2529,6 +2275,13 @@ Arena.MaxRatingDifference = 150
Arena.RatingDiscardTimer = 600000
#
+# Arena.RatedUpdateTimer
+# Description: Time (in milliseconds) between checks for matchups in rated arena
+# Default: 5000 - (5 seconds)
+
+Arena.RatedUpdateTimer = 5000
+
+#
# Arena.AutoDistributePoints
# Description: Automatically distribute arena points.
# Default: 0 - (Disabled)
@@ -2589,6 +2342,15 @@ Arena.ArenaStartPersonalRating = 0
Arena.ArenaStartMatchmakerRating = 1500
#
+# ArenaLog.ExtendedInfo
+# Description: Include extended info to ArenaLogFile for each player after rated arena
+# matches (guid, name, team, IP, healing/damage done, killing blows).
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+ArenaLog.ExtendedInfo = 0
+
+#
###################################################################################################
###################################################################################################
@@ -2895,3 +2657,171 @@ PlayerDump.DisallowOverwrite = 1
#
###################################################################################################
+
+###################################################################################################
+#
+# Logging system options.
+#
+# Appender config values: Given a appender "name"
+# Appender.name
+# Description: Defines 'where to log'
+# Format: Type,LogLevel,Flags,optional1,optional2
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "13 11 9 5 3 1"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+
+Appender.Console=1,3,0
+Appender.Server=2,2,0,Server.log,w
+Appender.GM=2,2,0,GM.log
+Appender.DBErrors=2,2,0,DBErrors.log
+Appender.Char=2,2,0,Char.log,w
+Appender.RA=2,2,0,RA.log
+Appender.Warden=2,4,0,Warden.log
+Appender.Chat=2,2,0,Chat.log
+Appender.CharDump=2,2,0,%s.log
+Appender.Arenas=2,2,0,Arena.log
+Appender.SQLDev=2,2,0,SQLDev.log
+Appender.SQLDriver=2,2,0,SQLDriver.log
+
+# Appenders
+# Description: List of Appenders to read from config
+# (Using spaces as separator).
+# Default: "Console Server GM DBErrors Char RA Warden Chat"
+
+Appenders=Console Server GM DBErrors Char RA Warden Chat
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: Type,LogLevel,AppenderList
+# Type
+# 0 - Default. Each type that has no config will
+# rely on this one. Core will create this logger
+# (disabled) if it's not configured
+# 1 - Units that doesn't fit in other categories
+# 2 - Pets
+# 3 - Vehicles
+# 4 - C++ AI, instance scripts, etc.
+# 5 - DB AI, such as SAI, EAI, CreatureAI
+# 6 - DB map scripts
+# 7 - Network input/output,
+# such as packet handlers and netcode logs
+# 8 - Spellsystem and aurasystem
+# 9 - Achievement system
+# 10 - Condition system
+# 11 - Pool system
+# 12 - Auction house
+# 13 - Arena's and battlegrounds
+# 14 - Outdoor PVP
+# 15 - Chat system
+# 16 - LFG system
+# 17 - Maps, instances (not scripts),
+# grids, cells, visibility, etc.
+# 18 - Player that doesn't fit in other categories.
+# 19 - Player loading from DB
+# (Player::_LoadXXX functions)
+# 20 - Items
+# 21 - Player skills (do not confuse with spells)
+# 22 - Player chat logs
+# 23 - loot
+# 24 - guilds
+# 25 - transports
+# 26 - SQL. DB errors
+# 27 - GM Commands
+# 28 - Remote Access Commands
+# 29 - Warden
+# 30 - Authserver
+# 31 - Worldserver
+# 32 - Game Events
+# 33 - Calendar
+# 34 - Character (Exclusive to log login, logout, create, rename)
+# 35 - Arenas
+# 36 - SQL Driver
+# 37 - SQL Dev
+# 38 - Player Dump
+# 39 - Battlefield
+# 40 - Server Loading
+# 41 - Opcodes (just id and name sent / received)
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+
+Logger.Root=0,5,Console Server
+Logger.Chat=22,3,Chat
+Logger.DBErrors=26,5,Console Server DBErrors
+Logger.GM=27,3,Console Server GM
+Logger.RA=28,3,RA
+Logger.Warden=29,4,Warden
+Logger.WorldServer=31,3,Console Server
+Logger.Character=34,3,Char
+Logger.Arenas=35,3,Arenas
+Logger.SQLDriver=36,5,SQLDriver
+Logger.SQLDev=37,3,SQLDev
+Logger.CharDump=38,3,CharDump
+Logger.Load=40,3,Console Server
+Logger.Opcodes=41,6,Console Server
+
+#
+# Loggers
+# Description: List of Loggers to read from config
+# (Using spaces as separator).
+# Default: "Root Chat DBErrors GM RA Warden Character Load"
+
+Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer Opcodes
+