aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp4
-rw-r--r--src/server/collision/Management/VMapManager2.cpp6
-rwxr-xr-xsrc/server/collision/Management/VMapManager2.h3
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp8
-rwxr-xr-xsrc/server/game/AI/CreatureAI.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp33
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp114
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp70
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h27
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp4
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.h2
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.cpp32
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp278
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.h12
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp46
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.h8
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.cpp145
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAA.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAA.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp16
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp40
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundBE.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundBE.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundDS.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundDS.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.cpp50
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp318
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.h9
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundNA.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundNA.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRB.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRB.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRL.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRL.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRV.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRV.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.cpp74
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.cpp36
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.h4
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.cpp88
-rwxr-xr-xsrc/server/game/Chat/Chat.cpp22
-rwxr-xr-xsrc/server/game/Chat/Chat.h2
-rwxr-xr-xsrc/server/game/Chat/Commands/Level1.cpp28
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp16
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp60
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp17
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp2
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.h1
-rwxr-xr-xsrc/server/game/DataStores/DBCStructure.h24
-rwxr-xr-xsrc/server/game/DataStores/DBCfmt.h3
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp232
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.h12
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp25
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp15
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h4
-rwxr-xr-xsrc/server/game/Entities/Creature/GossipDef.cpp76
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp63
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h1
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp28
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h17
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp14
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp681
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h65
-rwxr-xr-xsrc/server/game/Entities/Player/SocialMgr.cpp12
-rwxr-xr-xsrc/server/game/Entities/Player/SocialMgr.h2
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp47
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp69
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp299
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h34
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp6
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp10
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.h4
-rwxr-xr-xsrc/server/game/Globals/ObjectAccessor.cpp42
-rwxr-xr-xsrc/server/game/Globals/ObjectAccessor.h57
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp484
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h6
-rwxr-xr-xsrc/server/game/Grids/Grid.h31
-rwxr-xr-xsrc/server/game/Grids/GridStates.cpp12
-rwxr-xr-xsrc/server/game/Grids/NGrid.h2
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiers.cpp51
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiers.h10
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiersImpl.h6
-rwxr-xr-xsrc/server/game/Grids/ObjectGridLoader.cpp28
-rwxr-xr-xsrc/server/game/Grids/ObjectGridLoader.h1
-rwxr-xr-xsrc/server/game/Groups/Group.cpp32
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp8
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.h4
-rwxr-xr-xsrc/server/game/Instances/InstanceScript.cpp1
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp34
-rwxr-xr-xsrc/server/game/Maps/Map.cpp180
-rwxr-xr-xsrc/server/game/Maps/Map.h17
-rwxr-xr-xsrc/server/game/Maps/MapInstanced.cpp16
-rwxr-xr-xsrc/server/game/Maps/MapInstanced.h15
-rwxr-xr-xsrc/server/game/Maps/MapManager.cpp41
-rwxr-xr-xsrc/server/game/Maps/MapManager.h21
-rw-r--r--src/server/game/Maps/MapUpdater.cpp6
-rwxr-xr-xsrc/server/game/Miscellaneous/Formulas.h6
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h9
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp31
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp2
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.cpp80
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.h42
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.cpp38
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.h12
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp8
-rwxr-xr-xsrc/server/game/Quests/QuestDef.cpp211
-rwxr-xr-xsrc/server/game/Quests/QuestDef.h174
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp6
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.cpp1
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp19
-rw-r--r--src/server/game/Scripting/ScriptSystem.h1
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/AddonHandler.cpp6
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp62
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CharacterHandler.cpp12
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/ChatHandler.cpp4
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/DuelHandler.cpp14
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/GroupHandler.cpp8
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/LFGHandler.cpp24
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MailHandler.cpp168
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MiscHandler.cpp26
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MovementHandler.cpp8
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/QueryHandler.cpp4
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/QuestHandler.cpp2
-rw-r--r--src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp20
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.cpp2
-rwxr-xr-xsrc/server/game/Server/Protocol/WorldLog.cpp4
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp18
-rwxr-xr-xsrc/server/game/Server/WorldSession.h2
-rwxr-xr-xsrc/server/game/Server/WorldSocketMgr.cpp4
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp85
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp9
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp80
-rwxr-xr-xsrc/server/game/Spells/Spell.h2
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp124
-rw-r--r--src/server/game/Spells/SpellInfo.cpp11
-rw-r--r--src/server/game/Spells/SpellInfo.h1
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp100
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h64
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.cpp8
-rw-r--r--src/server/game/Tools/PlayerDump.cpp13
-rwxr-xr-xsrc/server/game/World/World.cpp22
-rwxr-xr-xsrc/server/game/World/World.h14
-rw-r--r--src/server/scripts/Commands/cs_account.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gps.cpp86
-rw-r--r--src/server/scripts/Commands/cs_honor.cpp11
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp124
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp8
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp16
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp57
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp66
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/eversong_woods.cpp86
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp16
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h)0
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp)0
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp)0
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp)0
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp)0
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp)0
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp (renamed from src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp)0
-rw-r--r--src/server/scripts/Northrend/CMakeLists.txt48
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp21
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp6
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h1
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp7
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp20
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp)24
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp)78
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_mimiron.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/boss_yoggsaron.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h (renamed from src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h)0
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp (renamed from src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp)0
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp3
-rw-r--r--src/server/scripts/Northrend/borean_tundra.cpp2
-rw-r--r--src/server/scripts/Northrend/sholazar_basin.cpp3
-rw-r--r--src/server/scripts/Northrend/zuldrak.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp2
-rw-r--r--src/server/scripts/Outland/nagrand.cpp542
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp3
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp2
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp114
-rw-r--r--src/server/scripts/World/go_scripts.cpp85
-rw-r--r--src/server/scripts/World/npc_professions.cpp4
-rwxr-xr-xsrc/server/shared/Common.h13
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.cpp16
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.h3
-rwxr-xr-xsrc/server/shared/Dynamic/TypeContainer.h10
-rwxr-xr-xsrc/server/shared/Dynamic/TypeContainerFunctions.h51
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp64
-rwxr-xr-xsrc/server/worldserver/Master.cpp1
225 files changed, 3744 insertions, 4057 deletions
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 7b2ad044eb9..c24012efcef 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -616,8 +616,8 @@ bool AuthSocket::_HandleLogonProof()
memcpy(proof.M2, sha.GetDigest(), 20);
proof.cmd = AUTH_LOGON_PROOF;
proof.error = 0;
- proof.unk1 = 0x00800000;
- proof.unk2 = 0x00;
+ proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament)
+ proof.unk2 = 0x00; // SurveyId
proof.unk3 = 0x00;
socket().send((char *)&proof, sizeof(proof));
}
diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp
index 9f32c749c5c..0632542f82e 100644
--- a/src/server/collision/Management/VMapManager2.cpp
+++ b/src/server/collision/Management/VMapManager2.cpp
@@ -247,6 +247,9 @@ namespace VMAP
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename)
{
+ //! Critical section, thread safe access to iLoadedModelFiles
+ TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
+
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{
@@ -267,6 +270,9 @@ namespace VMAP
void VMapManager2::releaseModelInstance(const std::string &filename)
{
+ //! Critical section, thread safe access to iLoadedModelFiles
+ TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
+
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{
diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h
index ac293e2071b..83fec0f0d11 100755
--- a/src/server/collision/Management/VMapManager2.h
+++ b/src/server/collision/Management/VMapManager2.h
@@ -22,6 +22,7 @@
#include "IVMapManager.h"
#include "Dynamic/UnorderedMap.h"
#include "Define.h"
+#include <ace/Thread_Mutex.h>
//===========================================================
@@ -71,6 +72,8 @@ namespace VMAP
// Tree to check collision
ModelFileMap iLoadedModelFiles;
InstanceTreeMap iInstanceMapTrees;
+ // Mutex for iLoadedModelFiles
+ ACE_Thread_Mutex LoadedModelFilesLock;
bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY);
/* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index 594e1a9382b..533a7ca825c 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -500,10 +500,10 @@ namespace VMAP
{
model.setGroupModels(groupsArray);
- std::string filename(iSrcDir);
- filename.push_back('/');
- filename.append(pModelFilename).append(".vmo");
- success = model.writeFile(filename);
+ std::string worldModelFileName(iSrcDir);
+ worldModelFileName.push_back('/');
+ worldModelFileName.append(pModelFilename).append(".vmo");
+ success = model.writeFile(worldModelFileName);
}
//std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl;
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 329a2d004a5..5752fcede7b 100755
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -59,8 +59,8 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
- if (Unit* target = creature->SelectNearestTarget(maxRangeToNearestTarget))
- creature->AI()->AttackStart(target);
+ if (Unit* nearTarget = creature->SelectNearestTarget(maxRangeToNearestTarget))
+ creature->AI()->AttackStart(nearTarget);
else if (creature->isSummon())
{
if (Unit* summoner = creature->ToTempSummon()->GetSummoner())
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 0b77dd03e87..afa7e9c2932 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -450,12 +450,14 @@ void SmartAI::EnterEvadeMode()
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
- } else if (mFollowGuid){
+ }
+ else if (mFollowGuid)
+ {
if (Unit* target = me->GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
- } else {
- me->GetMotionMaster()->MoveTargetedHome();
}
+ else
+ me->GetMotionMaster()->MoveTargetedHome();
Reset();
}
@@ -705,12 +707,24 @@ void SmartAI::SetRun(bool run)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
+ me->SendMovementFlagUpdate();
mRun = run;
}
void SmartAI::SetFly(bool fly)
{
+ if (fly)
+ {
+ me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01);
+ }
+ else
+ {
+ me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01);
+ }
me->SetFlying(fly);
+ me->SendMovementFlagUpdate();
}
void SmartAI::SetSwim(bool swim)
@@ -719,6 +733,7 @@ void SmartAI::SetSwim(bool swim)
me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
else
me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
+ me->SendMovementFlagUpdate();
}
void SmartAI::sGossipHello(Player* player)
@@ -781,8 +796,8 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
return;
SetRun(mRun);
mFollowGuid = target->GetGUID();
- mFollowDist = dist;
- mFollowAngle = angle;
+ mFollowDist = dist ? dist : PET_FOLLOW_DIST;
+ mFollowAngle = angle ? angle : me->GetFollowAngle();
mFollowArrivedTimer = 1000;
mFollowCredit = credit;
mFollowArrivedEntry = end;
@@ -902,13 +917,13 @@ class SmartTrigger : public AreaTriggerScript
{
public:
- SmartTrigger()
- : AreaTriggerScript("SmartTrigger")
- {
- }
+ SmartTrigger() : AreaTriggerScript("SmartTrigger") {}
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
{
+ if (!player->isAlive())
+ return false;
+
sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->id);
SmartScript script;
script.OnInitialize(NULL, trigger);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 143cb1f0ec1..ffe21536de4 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -32,6 +32,7 @@
#include "SmartAI.h"
#include "Group.h"
#include "Vehicle.h"
+#include "ScriptedGossip.h"
SmartScript::SmartScript()
{
@@ -139,6 +140,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
ObjectList* targets = GetTargets(e, unit);
Creature* talker = me;
+ Player* targetPlayer = NULL;
if (targets)
{
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
@@ -148,14 +150,26 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
talker = (*itr)->ToCreature();
break;
}
+ else if (IsPlayer((*itr)))
+ {
+ targetPlayer = (*itr)->ToPlayer();
+ break;
+ }
}
delete targets;
}
+
mTalkerEntry = talker->GetEntry();
mLastTextID = e.action.talk.textGroupID;
mTextTimer = e.action.talk.duration;
- mTextGUID = IsPlayer(GetLastInvoker()) ? GetLastInvoker()->GetGUID() : 0;//invoker, used for $vars in texts
+ if (IsPlayer(GetLastInvoker())) // used for $vars in texts and whisper target
+ mTextGUID = GetLastInvoker()->GetGUID();
+ else if (targetPlayer)
+ mTextGUID = targetPlayer->GetGUID();
+ else
+ mTextGUID = 0;
+
mUseTextTimer = true;
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u",
@@ -210,7 +224,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
- if (IsPlayer(*itr))
+ if (IsUnit(*itr))
{
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.range > 0 ? true : false);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
@@ -1323,7 +1337,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsCreature(*itr))
(*itr)->ToCreature()->Respawn();
else if (IsGameObject(*itr))
- (*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.GoRespawnTime);
+ (*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.goRespawnTime);
}
delete targets;
@@ -1458,28 +1472,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
case SMART_ACTION_CALL_SCRIPT_RESET:
OnReset();
break;
- case SMART_ACTION_ENTER_VEHICLE:
- {
- if (!me)
- return;
-
- ObjectList* targets = GetTargets(e, unit);
- if (!targets)
- return;
-
- for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); ++itr)
- {
- if (IsUnit(*itr) && (*itr)->ToUnit()->GetVehicleKit())
- {
- me->EnterVehicle((*itr)->ToUnit(), e.action.enterVehicle.seat);
- delete targets;
- return;
- }
- }
-
- delete targets;
- break;
- }
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
{
if (e.GetTargetType() == SMART_TARGET_NONE)
@@ -1498,9 +1490,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsSmart(target))
CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
}
- else if (GameObject* target = (*itr)->ToGameObject())
+ else if (GameObject* goTarget = (*itr)->ToGameObject())
{
- if (IsSmartGO(target))
+ if (IsSmartGO(goTarget))
CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
}
}
@@ -1615,9 +1607,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsSmart(target))
CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker());
}
- else if (GameObject* target = (*itr)->ToGameObject())
+ else if (GameObject* goTarget = (*itr)->ToGameObject())
{
- if (IsSmartGO(target))
+ if (IsSmartGO(goTarget))
CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, id, GetLastInvoker());
}
}
@@ -1645,9 +1637,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsSmart(target))
CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker());
}
- else if (GameObject* target = (*itr)->ToGameObject())
+ else if (GameObject* goTarget = (*itr)->ToGameObject())
{
- if (IsSmartGO(target))
+ if (IsSmartGO(goTarget))
CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, id, GetLastInvoker());
}
}
@@ -1781,7 +1773,38 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_JUMP_TO_POS:
{
+ if (!me)
+ return;
+
+ me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
+ // TODO: Resume path when reached jump location
+ break;
+ }
+ case SMART_ACTION_SEND_GOSSIP_MENU:
+ {
+ if (!GetBaseObject())
+ return;
+
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossip_option_id %d",
+ e.action.sendGossipMenu.gossipMenuId, e.action.sendGossipMenu.gossipOptionId);
+
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
+ return;
+
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (Player* player = (*itr)->ToPlayer())
+ {
+ if (e.action.sendGossipMenu.gossipMenuId)
+ player->PrepareGossipMenu(GetBaseObject(), e.action.sendGossipMenu.gossipMenuId, true);
+ else
+ player->PlayerTalkClass->ClearMenus();
+
+ player->SEND_GOSSIP_MENU(e.action.sendGossipMenu.gossipOptionId, GetBaseObject()->GetGUID());
+ }
+
+ delete targets;
break;
}
default:
@@ -2122,6 +2145,16 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
l->push_back(target);
break;
}
+ case SMART_TARGET_CLOSEST_PLAYER:
+ {
+ if (me)
+ {
+ Player* target = me->SelectNearestPlayer((float)e.target.playerDistance.dist);
+ if (target)
+ l->push_back(target);
+ }
+ break;
+ }
case SMART_TARGET_OWNER_OR_SUMMONER:
{
if (me)
@@ -2265,10 +2298,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
if (!me || !me->isInCombat())
return;
- Unit* unit = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
- if (!unit)
+ Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
+ if (!target)
return;
- ProcessAction(e, unit);
+ ProcessAction(e, target);
RecalcTimer(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax);
break;
}
@@ -2608,6 +2641,19 @@ void SmartScript::UpdateTimer(SmartScriptHolder& e, uint32 const diff)
if (e.timer < diff)
{
+ // delay spell cast event if another spell is being casted
+ if (e.GetActionType() == SMART_ACTION_CAST)
+ {
+ if (!(e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS))
+ {
+ if (me && me->HasUnitState(UNIT_STAT_CASTING))
+ {
+ e.timer = 1;
+ return;
+ }
+ }
+ }
+
e.active = true;//activate events with cooldown
switch (e.GetEventType())//process ONLY timed events
{
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 03d04f4b3df..7ebe8ca500f 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -222,7 +222,7 @@ class SmartScript
}
void DecPhase(int32 p = 1) { mEventPhase -= (mEventPhase < (uint32)p ? (uint32)p - mEventPhase : (uint32)p); }
- bool IsInPhase(uint32 p) const { return mEventPhase & p; }
+ bool IsInPhase(uint32 p) const { return (1 << (mEventPhase - 1)) & p; }
void SetPhase(uint32 p = 0) { mEventPhase = p; }
SmartAIEventList mEvents;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index fab2a6b7722..011ed75205d 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -68,10 +68,12 @@ void SmartWaypointMgr::LoadFromDB()
path = new WPPath;
last_id = 1;
}
+
if (last_id != id)
{
sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
}
+
last_id++;
(*path)[id] = wp;
@@ -158,7 +160,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
continue;
}
- }else
+ }
+ else
{
if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
{
@@ -166,6 +169,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
continue;
}
}
+
temp.source_type = source_type;
temp.event_id = fields[2].GetUInt16();
temp.link = fields[3].GetUInt16();
@@ -224,41 +228,50 @@ void SmartAIMgr::LoadSmartAIFromDB()
bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.GetActionType() == SMART_ACTION_INSTALL_AI_TEMPLATE)
- return true; //AI template has special handling
+ return true; // AI template has special handling
switch (e.GetTargetType())
{
case SMART_TARGET_CREATURE_DISTANCE:
case SMART_TARGET_CREATURE_RANGE:
+ {
+ if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
{
- 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);
- return false;
- }
- break;
+ 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);
+ return false;
}
+ break;
+ }
case SMART_TARGET_GAMEOBJECT_DISTANCE:
case SMART_TARGET_GAMEOBJECT_RANGE:
+ {
+ if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
{
- 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);
- return false;
- }
- break;
+ 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);
+ return false;
}
+ break;
+ }
case SMART_TARGET_CREATURE_GUID:
- {
- if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry)) return false;
- break;
- }
+ {
+ if (e.target.unitGUID.entry && !IsCreatureValid(e, e.target.unitGUID.entry)) return false;
+ break;
+ }
case SMART_TARGET_GAMEOBJECT_GUID:
+ {
+ if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) return false;
+ break;
+ }
+ case SMART_TARGET_PLAYER_DISTANCE:
+ case SMART_TARGET_CLOSEST_PLAYER:
+ {
+ if (e.target.playerDistance.dist == 0)
{
- if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) return false;
- break;
+ 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());
+ return false;
}
+ break;
+ }
case SMART_TARGET_PLAYER_RANGE:
- case SMART_TARGET_PLAYER_DISTANCE:
case SMART_TARGET_SELF:
case SMART_TARGET_VICTIM:
case SMART_TARGET_HOSTILE_SECOND_AGGRO:
@@ -268,12 +281,11 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_ACTION_INVOKER:
case SMART_TARGET_POSITION:
case SMART_TARGET_NONE:
- case SMART_TARGET_CLOSEST_CREATURE:
- case SMART_TARGET_CLOSEST_GAMEOBJECT:
- case SMART_TARGET_CLOSEST_PLAYER:
case SMART_TARGET_ACTION_INVOKER_VEHICLE:
case SMART_TARGET_OWNER_OR_SUMMONER:
case SMART_TARGET_THREAT_LIST:
+ case SMART_TARGET_CLOSEST_GAMEOBJECT:
+ case SMART_TARGET_CLOSEST_CREATURE:
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());
@@ -394,7 +406,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_EVENT_ACCEPTED_QUEST:
case SMART_EVENT_REWARD_QUEST:
- if (!IsQuestValid(e, e.event.quest.quest)) return false;
+ if (e.event.quest.quest && !IsQuestValid(e, e.event.quest.quest))
+ return false;
break;
case SMART_EVENT_RECEIVE_EMOTE:
{
@@ -526,7 +539,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_SOUND:
- if (!IsSoundValid(e, e.action.sound.sound)) return false;
+ if (!IsSoundValid(e, e.action.sound.sound))
+ 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);
@@ -539,7 +553,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_ACTION_FAIL_QUEST:
case SMART_ACTION_ADD_QUEST:
- if (e.action.quest.quest && !IsQuestValid(e, e.action.quest.quest)) return false;
+ if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) return false;
break;
case SMART_ACTION_ACTIVATE_TAXI:
{
@@ -755,7 +769,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_RESET_SCRIPT_BASE_OBJECT:
case SMART_ACTION_ACTIVATE_GOBJECT:
case SMART_ACTION_CALL_SCRIPT_RESET:
- case SMART_ACTION_ENTER_VEHICLE:
case SMART_ACTION_NONE:
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
case SMART_ACTION_SET_NPC_FLAG:
@@ -775,6 +788,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_ADD_DYNAMIC_FLAG:
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
case SMART_ACTION_JUMP_TO_POS:
+ case SMART_ACTION_SEND_GOSSIP_MENU:
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);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 327d03d31ff..ba986ae310d 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -387,7 +387,7 @@ enum SMART_ACTION
SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID
SMART_ACTION_CALL_CASTEDCREATUREORGO = 27, // CreatureId, SpellId
SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid
- SMART_ACTION_FOLLOW = 29, // Distance, Angle, EndCreatureEntry, credit, creditType (0monsterkill, 1event)
+ 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
SMART_ACTION_RESET_GOBJECT = 32, //
@@ -439,7 +439,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
- SMART_ACTION_ENTER_VEHICLE = 79, // seatID
+ // Unused = 79,
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
@@ -450,20 +450,17 @@ enum SMART_ACTION
SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST = 87, // script9 ids 1-9
SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST = 88, // script9 id min, max
SMART_ACTION_RANDOM_MOVE = 89, // maxDist
-
SMART_ACTION_SET_UNIT_FIELD_BYTES_1 = 90, // bytes, target
SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 = 91, // bytes, target
-
SMART_ACTION_INTERRUPT_SPELL = 92,
-
SMART_ACTION_SEND_GO_CUSTOM_ANIM = 93, // anim id
-
SMART_ACTION_SET_DYNAMIC_FLAG = 94, // Flags
SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // Flags
SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // Flags
SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ
+ SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
- SMART_ACTION_END = 98,
+ SMART_ACTION_END = 99,
};
struct SmartAction
@@ -859,8 +856,14 @@ struct SmartAction
struct
{
- uint32 GoRespawnTime;
+ uint32 goRespawnTime;
} RespawnTarget;
+
+ struct
+ {
+ uint32 gossipMenuId;
+ uint32 gossipOptionId;
+ } sendGossipMenu;
struct
{
@@ -906,9 +909,9 @@ enum SMARTAI_TARGETS
SMART_TARGET_INVOKER_PARTY = 16, // invoker's party members
SMART_TARGET_PLAYER_RANGE = 17, // min, max
SMART_TARGET_PLAYER_DISTANCE = 18, // maxDist
- SMART_TARGET_CLOSEST_CREATURE = 19, // CreatureEntry(0any)
- SMART_TARGET_CLOSEST_GAMEOBJECT = 20, // entry(0any)
- SMART_TARGET_CLOSEST_PLAYER = 21, // none
+ SMART_TARGET_CLOSEST_CREATURE = 19, // CreatureEntry(0any), maxDist, dead?
+ SMART_TARGET_CLOSEST_GAMEOBJECT = 20, // entry(0any), maxDist
+ SMART_TARGET_CLOSEST_PLAYER = 21, // maxDist
SMART_TARGET_ACTION_INVOKER_VEHICLE = 22, // Unit's vehicle who caused this Event to occur
SMART_TARGET_OWNER_OR_SUMMONER = 23, // Unit's owner or summoner
SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list
@@ -1124,7 +1127,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] =
{SMART_EVENT_JUST_CREATED, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GOSSIP_HELLO, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_FOLLOW_COMPLETED, SMART_SCRIPT_TYPE_MASK_CREATURE },
- {SMART_EVENT_DUMMY_EFFECT, SMART_SCRIPT_TYPE_MASK_CREATURE },
+ {SMART_EVENT_DUMMY_EFFECT, SMART_SCRIPT_TYPE_MASK_SPELL },
{SMART_EVENT_IS_BEHIND_TARGET, SMART_SCRIPT_TYPE_MASK_CREATURE }
};
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 30f66925060..8967446f199 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -46,8 +46,8 @@ namespace Trinity
class AchievementChatBuilder
{
public:
- AchievementChatBuilder(Player const& pl, ChatMsg msgtype, int32 textId, uint32 ach_id)
- : i_player(pl), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {}
+ AchievementChatBuilder(Player const& player, ChatMsg msgtype, int32 textId, uint32 ach_id)
+ : i_player(player), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {}
void operator()(WorldPacket& data, LocaleConstant loc_idx)
{
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h
index df5631c5bc6..7f66565622f 100755
--- a/src/server/game/Achievements/AchievementMgr.h
+++ b/src/server/game/Achievements/AchievementMgr.h
@@ -244,7 +244,7 @@ class WorldPacket;
class AchievementMgr
{
public:
- AchievementMgr(Player* pl);
+ AchievementMgr(Player* player);
~AchievementMgr();
void Reset();
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 18d1946f0b6..b9fb5a13980 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -433,8 +433,8 @@ void ArenaTeam::NotifyStatsChanged()
// This is called after a rated match ended
// Updates arena team stats for every member of the team (not only the ones who participated!)
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(itr->Guid))
- SendStats(plr->GetSession());
+ if (Player* player = ObjectAccessor::FindPlayer(itr->Guid))
+ SendStats(player->GetSession());
}
void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
@@ -455,17 +455,17 @@ void ArenaTeam::Inspect(WorldSession* session, uint64 guid)
session->SendPacket(&data);
}
-void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
+void ArenaTeamMember::ModifyPersonalRating(Player* player, int32 mod, uint32 slot)
{
if (int32(PersonalRating) + mod < 0)
PersonalRating = 0;
else
PersonalRating += mod;
- if (plr)
+ if (player)
{
- plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, PersonalRating);
- plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING, PersonalRating, slot);
+ player->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, PersonalRating);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING, PersonalRating, slot);
}
}
@@ -716,16 +716,16 @@ int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int3
return mod;
}
-void ArenaTeam::MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
+void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// Called for each participant of a match after losing
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
- if (itr->Guid == plr->GetGUID())
+ if (itr->Guid == player->GetGUID())
{
// Update personal rating
int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, false);
- itr->ModifyPersonalRating(plr, mod, GetSlot());
+ itr->ModifyPersonalRating(player, mod, GetSlot());
// Update matchmaker rating
itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());
@@ -735,8 +735,8 @@ void ArenaTeam::MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 Ma
itr->SeasonGames +=1;
// update the unit fields
- plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
- plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
+ player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
+ player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
return;
}
}
@@ -764,16 +764,16 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i
}
}
-void ArenaTeam::MemberWon(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
+void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// called for each participant after winning a match
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
- if (itr->Guid == plr->GetGUID())
+ if (itr->Guid == player->GetGUID())
{
// update personal rating
int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, true);
- itr->ModifyPersonalRating(plr, mod, GetSlot());
+ itr->ModifyPersonalRating(player, mod, GetSlot());
// update matchmaker rating
itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());
@@ -784,8 +784,8 @@ void ArenaTeam::MemberWon(Player* plr, uint32 againstMatchmakerRating, int32 Mat
itr->SeasonWins += 1;
itr->WeekWins += 1;
// update unit fields
- plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
- plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
+ player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
+ player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
return;
}
}
diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h
index 4f013f72e5c..dce8c5776b7 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.h
+++ b/src/server/game/Battlegrounds/ArenaTeam.h
@@ -97,7 +97,7 @@ struct ArenaTeamMember
uint16 PersonalRating;
uint16 MatchMakerRating;
- void ModifyPersonalRating(Player* plr, int32 mod, uint32 slot);
+ void ModifyPersonalRating(Player* player, int32 mod, uint32 slot);
void ModifyMatchmakerRating(int32 mod, uint32 slot);
};
@@ -172,9 +172,9 @@ class ArenaTeam
int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
- void MemberWon(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
+ void MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange);
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change);
- void MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
+ void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 38fa2643601..af350ac39d6 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -75,7 +75,7 @@ namespace Trinity
data << uint64(target_guid);
data << uint32(strlen(text) + 1);
data << text;
- data << uint8 (_source ? _source->chatTag() : uint8(0));
+ data << uint8 (_source ? _source->GetChatTag() : 0);
}
ChatMsg _msgtype;
@@ -108,7 +108,7 @@ namespace Trinity
data << uint64(target_guid);
data << uint32(strlen(str) + 1);
data << str;
- data << uint8 (_source ? _source->chatTag() : uint8(0));
+ data << uint8 (_source ? _source->GetChatTag() : uint8(0));
}
private:
@@ -124,8 +124,8 @@ template<class Do>
void Battleground::BroadcastWorker(Do& _do)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
- _do(plr);
+ if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
+ _do(player);
}
Battleground::Battleground()
@@ -333,13 +333,13 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
Creature* sh = NULL;
for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
{
- Player* plr = ObjectAccessor::FindPlayer(*itr2);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(*itr2);
+ if (!player)
continue;
- if (!sh && plr->IsInWorld())
+ if (!sh && player->IsInWorld())
{
- sh = plr->GetMap()->GetCreature(itr->first);
+ sh = player->GetMap()->GetCreature(itr->first);
// only for visual effect
if (sh)
// Spirit Heal, effect 117
@@ -347,7 +347,7 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
}
// Resurrection visual
- plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true);
+ player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
m_ResurrectQueue.push_back(*itr2);
}
(itr->second).clear();
@@ -364,12 +364,12 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
{
for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
{
- Player* plr = ObjectAccessor::FindPlayer(*itr);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(*itr);
+ if (!player)
continue;
- plr->ResurrectPlayer(1.0f);
- plr->CastSpell(plr, 6962, true);
- plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
+ player->ResurrectPlayer(1.0f);
+ player->CastSpell(player, 6962, true);
+ player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
sObjectAccessor->ConvertCorpseForPlayer(*itr);
}
m_ResurrectQueue.clear();
@@ -429,8 +429,8 @@ inline void Battleground::_ProcessJoin(uint32 diff)
{
m_ResetStatTimer = 0;
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
- plr->ResetAllPowers();
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ player->ResetAllPowers();
}
if (!(m_Events & BG_STARTING_EVENT_1))
@@ -484,19 +484,19 @@ inline void Battleground::_ProcessJoin(uint32 diff)
{
// TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
{
// BG Status packet
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
- uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
+ uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType());
- plr->GetSession()->SendPacket(&status);
+ player->GetSession()->SendPacket(&status);
- plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
- plr->ResetAllPowers();
+ player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
+ player->ResetAllPowers();
// remove auras with duration lower than 30s
- Unit::AuraApplicationMap & auraMap = plr->GetAppliedAuras();
+ Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
{
AuraApplication * aurApp = iter->second;
@@ -506,7 +506,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
&& aurApp->IsPositive()
&& (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
- plr->RemoveAura(iter);
+ player->RemoveAura(iter);
else
++iter;
}
@@ -519,10 +519,10 @@ inline void Battleground::_ProcessJoin(uint32 diff)
PlaySoundToAll(SOUND_BG_START);
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
{
- plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
- plr->ResetAllPowers();
+ player->RemoveAurasDueToSpell(SPELL_PREPARATION);
+ player->ResetAllPowers();
}
// Announce BG starting
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
@@ -788,28 +788,28 @@ void Battleground::EndBattleground(uint32 winner)
continue;
}
- Player* plr = _GetPlayer(itr, "EndBattleground");
- if (!plr)
+ Player* player = _GetPlayer(itr, "EndBattleground");
+ if (!player)
continue;
// should remove spirit of redemption
- if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
- plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
+ if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
- if (!plr->isAlive())
+ if (!player->isAlive())
{
- plr->ResurrectPlayer(1.0f);
- plr->SpawnCorpseBones();
+ player->ResurrectPlayer(1.0f);
+ player->SpawnCorpseBones();
}
else
{
//needed cause else in av some creatures will kill the players at the end
- plr->CombatStop();
- plr->getHostileRefManager().deleteReferences();
+ player->CombatStop();
+ player->getHostileRefManager().deleteReferences();
}
//this line is obsolete - team is set ALWAYS
- //if (!team) team = plr->GetTeam();
+ //if (!team) team = player->GetTeam();
// per player calculation
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
@@ -817,57 +817,57 @@ void Battleground::EndBattleground(uint32 winner)
if (team == winner)
{
// update achievement BEFORE personal rating update
- ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetGUID());
+ ArenaTeamMember* member = winner_arena_team->GetMember(player->GetGUID());
if (member)
- plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->PersonalRating);
+ player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->PersonalRating);
- winner_arena_team->MemberWon(plr, loser_matchmaker_rating, winner_matchmaker_change);
+ winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change);
}
else
{
- loser_arena_team->MemberLost(plr, winner_matchmaker_rating, loser_matchmaker_change);
+ loser_arena_team->MemberLost(player, winner_matchmaker_rating, loser_matchmaker_change);
// Arena lost => reset the win_rated_arena having the "no_lose" condition
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
}
}
- uint32 winner_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
- uint32 loser_kills = plr->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
- uint32 winner_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
+ uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
+ uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
+ uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
// Reward winner team
if (team == winner)
{
if (IsRandom() || BattlegroundMgr::IsBGWeekend(GetTypeID()))
{
- UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
+ UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
if (CanAwardArenaPoints())
- plr->ModifyArenaPoints(winner_arena);
- if (!plr->GetRandomWinner())
- plr->SetRandomWinner(true);
+ player->ModifyArenaPoints(winner_arena);
+ if (!player->GetRandomWinner())
+ player->SetRandomWinner(true);
}
- plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
+ player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
}
else
{
if (IsRandom() || BattlegroundMgr::IsBGWeekend(GetTypeID()))
- UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loser_kills));
+ UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loser_kills));
}
- plr->ResetAllPowers();
- plr->CombatStopWithPets(true);
+ player->ResetAllPowers();
+ player->CombatStopWithPets(true);
- BlockMovement(plr);
+ BlockMovement(player);
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, plr->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
- plr->GetSession()->SendPacket(&data);
- plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
+ player->GetSession()->SendPacket(&data);
+ player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
}
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
@@ -908,9 +908,9 @@ uint32 Battleground::GetBattlemasterEntry() const
}
}
-void Battleground::BlockMovement(Player* plr)
+void Battleground::BlockMovement(Player* player)
{
- plr->SetClientControl(plr, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
+ player->SetClientControl(player, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
}
void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket)
@@ -936,32 +936,32 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
RemovePlayerFromResurrectQueue(guid);
- Player* plr = ObjectAccessor::FindPlayer(guid);
+ Player* player = ObjectAccessor::FindPlayer(guid);
// should remove spirit of redemption
- if (plr)
+ if (player)
{
- if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
- plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
+ if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
- if (!plr->isAlive()) // resurrect on exit
+ if (!player->isAlive()) // resurrect on exit
{
- plr->ResurrectPlayer(1.0f);
- plr->SpawnCorpseBones();
+ player->ResurrectPlayer(1.0f);
+ player->SpawnCorpseBones();
}
}
- RemovePlayer(plr, guid, team); // BG subclass specific code
+ RemovePlayer(player, guid, team); // BG subclass specific code
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
{
BattlegroundTypeId bgTypeId = GetTypeID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
- if (plr)
+ if (player)
{
- plr->ClearAfkReports();
+ player->ClearAfkReports();
- if (!team) team = plr->GetTeam();
+ if (!team) team = player->GetTeam();
// if arena, remove the specific arena auras
if (isArena())
@@ -969,8 +969,8 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
// unsummon current and summon old pet if there was one and there isn't a current pet
- plr->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT);
- plr->ResummonPetTemporaryUnSummonedIfAny();
+ player->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT);
+ player->ResummonPetTemporaryUnSummonedIfAny();
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
@@ -978,18 +978,18 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
ArenaTeam* winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
ArenaTeam* loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
- loser_arena_team->MemberLost(plr, GetArenaMatchmakerRating(GetOtherTeam(team)));
+ loser_arena_team->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
}
}
if (SendPacket)
{
WorldPacket data;
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, plr->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
- plr->GetSession()->SendPacket(&data);
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
+ player->GetSession()->SendPacket(&data);
}
// this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg
- plr->RemoveBattlegroundQueueId(bgQueueTypeId);
+ player->RemoveBattlegroundQueueId(bgQueueTypeId);
}
else
// removing offline participant
@@ -1023,20 +1023,20 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
// Let others know
WorldPacket data;
sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, guid);
- SendPacketToTeam(team, &data, plr, false);
+ SendPacketToTeam(team, &data, player, false);
}
- if (plr)
+ if (player)
{
// Do next only if found in battleground
- plr->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
+ player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
// reset destination bg team
- plr->SetBGTeam(0);
+ player->SetBGTeam(0);
if (Transport)
- plr->TeleportToBGEntryPoint();
+ player->TeleportToBGEntryPoint();
- sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", plr->GetName());
+ sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", player->GetName());
}
//battleground object will be deleted next Battleground::Update() call
@@ -1087,16 +1087,16 @@ void Battleground::StartBattleground()
sLog->outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
-void Battleground::AddPlayer(Player* plr)
+void Battleground::AddPlayer(Player* player)
{
// remove afk from player
- if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
- plr->ToggleAFK();
+ if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
+ player->ToggleAFK();
// score struct must be created in inherited class
- uint64 guid = plr->GetGUID();
- uint32 team = plr->GetBGTeam();
+ uint64 guid = player->GetGUID();
+ uint32 team = player->GetBGTeam();
BattlegroundPlayer bp;
bp.OfflineRemoveTime = 0;
@@ -1108,74 +1108,74 @@ void Battleground::AddPlayer(Player* plr)
UpdatePlayersCountByTeam(team, false); // +1 player
WorldPacket data;
- sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, plr);
- SendPacketToTeam(team, &data, plr, false);
+ sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player);
+ SendPacketToTeam(team, &data, player, false);
// BG Status packet
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
- uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
+ uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), isArena() ? 0 : 1);
- plr->GetSession()->SendPacket(&status);
+ player->GetSession()->SendPacket(&status);
- plr->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
// add arena specific auras
if (isArena())
{
- plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
+ player->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
if (team == ALLIANCE) // gold
{
- if (plr->GetTeam() == HORDE)
- plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG, true);
+ if (player->GetTeam() == HORDE)
+ player->CastSpell(player, SPELL_HORDE_GOLD_FLAG, true);
else
- plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG, true);
+ player->CastSpell(player, SPELL_ALLIANCE_GOLD_FLAG, true);
}
else // green
{
- if (plr->GetTeam() == HORDE)
- plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG, true);
+ if (player->GetTeam() == HORDE)
+ player->CastSpell(player, SPELL_HORDE_GREEN_FLAG, true);
else
- plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG, true);
+ player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true);
}
- plr->DestroyConjuredItems(true);
- plr->UnsummonPetTemporaryIfAny();
+ player->DestroyConjuredItems(true);
+ player->UnsummonPetTemporaryIfAny();
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
- plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
- plr->ResetAllPowers();
+ player->CastSpell(player, SPELL_ARENA_PREPARATION, true);
+ player->ResetAllPowers();
}
WorldPacket teammate;
teammate.Initialize(SMSG_ARENA_OPPONENT_UPDATE, 8);
- teammate << uint64(plr->GetGUID());
- SendPacketToTeam(team, &teammate, plr, false);
+ teammate << uint64(player->GetGUID());
+ SendPacketToTeam(team, &teammate, player, false);
}
else
{
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
- plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
+ player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
// setup BG group membership
- PlayerAddedToBGCheckIfBGIsRunning(plr);
- AddOrSetPlayerToCorrectBgGroup(plr, team);
+ PlayerAddedToBGCheckIfBGIsRunning(player);
+ AddOrSetPlayerToCorrectBgGroup(player, team);
// Log
- sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
+ sLog->outDetail("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
@@ -1385,11 +1385,11 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
{
m_ReviveQueue[npc_guid].push_back(player_guid);
- Player* plr = ObjectAccessor::FindPlayer(player_guid);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(player_guid);
+ if (!player)
return;
- plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true);
+ player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
}
void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
@@ -1401,8 +1401,8 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
if (*itr2 == player_guid)
{
(itr->second).erase(itr2);
- if (Player* plr = ObjectAccessor::FindPlayer(player_guid))
- plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
+ if (Player* player = ObjectAccessor::FindPlayer(player_guid))
+ player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
return;
}
}
@@ -1680,9 +1680,9 @@ void Battleground::SendWarningToAll(int32 entry, ...)
data << msg.c_str();
data << (uint8)0;
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
- if (plr->GetSession())
- plr->GetSession()->SendPacket(&data);
+ if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
+ if (player->GetSession())
+ player->GetSession()->SendPacket(&data);
}
void Battleground::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2)
@@ -1759,12 +1759,12 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer)
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
- Player* plr = ObjectAccessor::FindPlayer(itr->first);
- if (!plr || plr == killer)
+ Player* creditedPlayer = ObjectAccessor::FindPlayer(itr->first);
+ if (!creditedPlayer || creditedPlayer == killer)
continue;
- if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player))
- UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1);
+ if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(player))
+ UpdatePlayerScore(creditedPlayer, SCORE_HONORABLE_KILLS, 1);
}
}
@@ -1799,7 +1799,7 @@ bool Battleground::IsPlayerInBattleground(uint64 guid) const
return false;
}
-void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
+void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player)
{
if (GetStatus() != STATUS_WAIT_LEAVE)
return;
@@ -1807,13 +1807,13 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
WorldPacket data;
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
- BlockMovement(plr);
+ BlockMovement(player);
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, plr->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType());
- plr->GetSession()->SendPacket(&data);
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType());
+ player->GetSession()->SendPacket(&data);
}
uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
@@ -1823,8 +1823,8 @@ uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
{
if (itr->second.Team == Team)
{
- Player* pl = ObjectAccessor::FindPlayer(itr->first);
- if (pl && pl->isAlive() && !pl->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
+ Player* player = ObjectAccessor::FindPlayer(itr->first);
+ if (player && player->isAlive() && !player->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
++count;
}
}
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index d5921e4bf37..9856312c337 100755
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -329,7 +329,7 @@ class Battleground
{
}
- virtual void DestroyGate(Player* /*pl*/, GameObject* /*go*/) {}
+ virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
/* achievement req. */
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
@@ -463,7 +463,7 @@ class Battleground
void UpdateWorldState(uint32 Field, uint32 Value);
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source);
void EndBattleground(uint32 winner);
- void BlockMovement(Player* plr);
+ void BlockMovement(Player* player);
void SendWarningToAll(int32 entry, ...);
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
@@ -515,7 +515,7 @@ class Battleground
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {}
void EventPlayerLoggedIn(Player* player);
void EventPlayerLoggedOut(Player* player);
- virtual void EventPlayerDamagedGO(Player* /*plr*/, GameObject* /*go*/, uint32 /*eventType*/) {}
+ virtual void EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/) {}
virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/){}
// this function can be used by spell to interact with the BG map
@@ -526,7 +526,7 @@ class Battleground
// Death related
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
- virtual void AddPlayer(Player* plr); // must be implemented in BG subclass
+ virtual void AddPlayer(Player* player); // must be implemented in BG subclass
void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team);
@@ -554,7 +554,7 @@ class Battleground
//to be removed
const char* GetTrinityString(int32 entry);
- virtual bool HandlePlayerUnderMap(Player* /*plr*/) { return false; }
+ virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
uint32 GetPlayerTeam(uint64 guid) const;
@@ -575,7 +575,7 @@ class Battleground
protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
void EndNow();
- void PlayerAddedToBGCheckIfBGIsRunning(Player* plr);
+ void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
Player* _GetPlayer(uint64 guid, bool offlineRemove, const char* context) const;
Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context);
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index e00abb03320..a9acced82ae 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -291,10 +291,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
}
else
{
- Player* plr = ObjectAccessor::FindPlayer(itr2->first);
+ Player* player = ObjectAccessor::FindPlayer(itr2->first);
uint32 team = bg->GetPlayerTeam(itr2->first);
- if (!team && plr)
- team = plr->GetBGTeam();
+ if (!team && player)
+ team = player->GetBGTeam();
*data << uint8(team == ALLIANCE ? 1 : 0); // green or yellow
}
*data << uint32(itr2->second->DamageDone); // damage done
@@ -422,10 +422,10 @@ void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint6
*data << uint64(guid);
}
-void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* plr)
+void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
- *data << uint64(plr->GetGUID());
+ *data << uint64(player->GetGUID());
}
Battleground* BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId)
@@ -804,17 +804,17 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Automatic Arena Point Distribution initialized.");
}
-void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere)
+void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
{
- if (!plr)
+ if (!player)
return;
- uint32 winner_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
- uint32 winner_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
- uint32 loser_kills = plr->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
+ uint32 winner_kills = player->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
+ uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
+ uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
- winner_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), float(winner_kills));
- loser_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), float(loser_kills));
+ winner_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills));
+ loser_kills = Trinity::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills));
data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << uint64(guid); // battlemaster guid
@@ -824,7 +824,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
*data << uint8(0); // unk
// Rewards
- *data << uint8(plr->GetRandomWinner()); // 3.3.3 hasWin
+ *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
*data << uint32(winner_kills); // 3.3.3 winHonor
*data << uint32(winner_arena); // 3.3.3 winArena
*data << uint32(loser_kills); // 3.3.3 lossHonor
@@ -835,7 +835,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
if (isRandom)
{
// Rewards (random)
- *data << uint8(plr->GetRandomWinner()); // 3.3.3 hasWin_Random
+ *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
*data << uint32(winner_kills); // 3.3.3 winHonor_Random
*data << uint32(winner_arena); // 3.3.3 winArena_Random
*data << uint32(loser_kills); // 3.3.3 lossHonor_Random
@@ -853,7 +853,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
if (Battleground* bgTemplate = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId))
{
// expected bracket entry
- if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), plr->getLevel()))
+ if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), player->getLevel()))
{
uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
@@ -868,35 +868,35 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
}
}
-void BattlegroundMgr::SendToBattleground(Player* pl, uint32 instanceId, BattlegroundTypeId bgTypeId)
+void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
{
Battleground* bg = GetBattleground(instanceId, bgTypeId);
if (bg)
{
uint32 mapid = bg->GetMapId();
float x, y, z, O;
- uint32 team = pl->GetBGTeam();
+ uint32 team = player->GetBGTeam();
if (team == 0)
- team = pl->GetTeam();
+ 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", pl->GetName(), mapid, x, y, z, O);
- pl->TeleportTo(mapid, 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);
+ player->TeleportTo(mapid, x, y, z, O);
}
else
{
- sLog->outError("player %u is trying to port to non-existent bg instance %u", pl->GetGUIDLow(), instanceId);
+ sLog->outError("player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
}
}
-void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid)
+void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
if (time_ == uint32(-1))
time_ = 0;
data << guid << time_;
- pl->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index 7f35e5366a5..989509111bb 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -65,15 +65,15 @@ class BattlegroundMgr
void Update(uint32 diff);
/* Packet Building */
- void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* plr);
+ void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* player);
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid);
- void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere);
+ void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
- void SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid);
+ void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
/* Battlegrounds */
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
@@ -91,7 +91,7 @@ class BattlegroundMgr
void CreateInitialBattlegrounds();
void DeleteAllBattlegrounds();
- void SendToBattleground(Player* pl, uint32 InstanceID, BattlegroundTypeId bgTypeId);
+ void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
/* Battleground queues */
//these queues are instantiated when creating BattlegroundMrg
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 67cea3e7be1..0d76759e1be 100755
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -285,7 +285,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
//remove player from queue and from group info, if group info is empty then remove it too
void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
- //Player* plr = ObjectAccessor::FindPlayer(guid);
+ //Player* player = ObjectAccessor::FindPlayer(guid);
int32 bracket_id = -1; // signed for proper for-loop finish
QueuedPlayersMap::iterator itr;
@@ -362,8 +362,8 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
- if (Player* plr = ObjectAccessor::FindPlayer(guid))
- at->MemberLost(plr, group->OpponentsMatchmakerRating);
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ at->MemberLost(player, group->OpponentsMatchmakerRating);
else
at->OfflineMemberLost(guid, group->OpponentsMatchmakerRating);
at->SaveToDB();
@@ -442,36 +442,36 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
// get the player
- Player* plr = ObjectAccessor::FindPlayer(itr->first);
+ Player* player = ObjectAccessor::FindPlayer(itr->first);
// if offline, skip him, this should not happen - player is removed from queue when he logs out
- if (!plr)
+ if (!player)
continue;
// invite the player
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id);
- //sBattlegroundMgr->InvitePlayer(plr, bg, ginfo->Team);
+ //sBattlegroundMgr->InvitePlayer(player, bg, ginfo->Team);
// set invited player counters
bg->IncreaseInvitedCount(ginfo->Team);
- plr->SetInviteForBattlegroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
+ player->SetInviteForBattlegroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
// create remind invite events
- BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
+ BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
m_events.AddEvent(inviteEvent, m_events.CalculateTime(INVITATION_REMIND_TIME));
// create automatic remove events
- BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
+ BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
m_events.AddEvent(removeEvent, m_events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));
WorldPacket data;
- uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
+ uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited plr %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", plr->GetName(), plr->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
return true;
}
@@ -911,68 +911,51 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
uint32 discardTime = getMSTime() - sBattlegroundMgr->GetRatingDiscardTimer();
// we need to find 2 teams which will play next game
+ GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT];
+ uint8 found = 0;
+ uint8 team = 0;
- GroupsQueueType::iterator itr_team[BG_TEAMS_COUNT];
-
- //optimalization : --- we dont need to use selection_pools - each update we select max 2 groups
- for (uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
+ for (uint8 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
{
// take the group that joined first
- itr_team[i] = m_QueuedGroups[bracket_id][i].begin();
- for (; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i]))
+ GroupsQueueType::iterator itr2 = m_QueuedGroups[bracket_id][i].begin();
+ for (; itr2 != m_QueuedGroups[bracket_id][i].end(); ++itr2)
{
// if group match conditions, then add it to pool
- if (!(*itr_team[i])->IsInvitedToBGInstanceGUID
- && (((*itr_team[i])->ArenaMatchmakerRating >= arenaMinRating && (*itr_team[i])->ArenaMatchmakerRating <= arenaMaxRating)
- || (*itr_team[i])->JoinTime < discardTime))
+ if (!(*itr2)->IsInvitedToBGInstanceGUID
+ && (((*itr2)->ArenaMatchmakerRating >= arenaMinRating && (*itr2)->ArenaMatchmakerRating <= arenaMaxRating)
+ || (*itr2)->JoinTime < discardTime))
{
- m_SelectionPools[i].AddGroup((*itr_team[i]), MaxPlayersPerTeam);
- // break for cycle to be able to start selecting another group from same faction queue
+ itr_teams[found++] = itr2;
+ team = i;
break;
}
}
}
- // now we are done if we have 2 groups - ali vs horde!
- // if we don't have, we must try to continue search in same queue
- // tmp variables are correctly set
- // this code isn't much userfriendly - but it is supposed to continue search for mathing group in HORDE queue
- if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
- {
- itr_team[BG_TEAM_ALLIANCE] = itr_team[BG_TEAM_HORDE];
- ++itr_team[BG_TEAM_ALLIANCE];
- for (; itr_team[BG_TEAM_ALLIANCE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++(itr_team[BG_TEAM_ALLIANCE]))
- {
- if (!(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
- && (((*itr_team[BG_TEAM_ALLIANCE])->ArenaMatchmakerRating >= arenaMinRating && (*itr_team[BG_TEAM_ALLIANCE])->ArenaMatchmakerRating <= arenaMaxRating)
- || (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime))
- {
- m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*itr_team[BG_TEAM_ALLIANCE]), MaxPlayersPerTeam);
- break;
- }
- }
- }
+ if (!found)
+ return;
- // this code isn't much userfriendly - but it is supposed to continue search for mathing group in ALLIANCE queue
- if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
+ if (found == 1)
{
- itr_team[BG_TEAM_HORDE] = itr_team[BG_TEAM_ALLIANCE];
- ++itr_team[BG_TEAM_HORDE];
- for (; itr_team[BG_TEAM_HORDE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++(itr_team[BG_TEAM_HORDE]))
+ for (GroupsQueueType::iterator itr3 = itr_teams[0]; itr3 != m_QueuedGroups[bracket_id][team].end(); ++itr3)
{
- if (!(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
- && (((*itr_team[BG_TEAM_HORDE])->ArenaMatchmakerRating >= arenaMinRating && (*itr_team[BG_TEAM_HORDE])->ArenaMatchmakerRating <= arenaMaxRating)
- || (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime))
+ if (!(*itr3)->IsInvitedToBGInstanceGUID
+ && (((*itr3)->ArenaMatchmakerRating >= arenaMinRating && (*itr3)->ArenaMatchmakerRating <= arenaMaxRating)
+ || (*itr3)->JoinTime < discardTime)
+ && (*itr_teams[0])->ArenaTeamId != (*itr3)->ArenaTeamId)
{
- m_SelectionPools[BG_TEAM_HORDE].AddGroup((*itr_team[BG_TEAM_HORDE]), MaxPlayersPerTeam);
+ itr_teams[found++] = itr3;
break;
}
}
}
//if we have 2 teams, then start new arena and invite players!
- if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
+ if (found == 2)
{
+ GroupQueueInfo* aTeam = *itr_teams[BG_TEAM_ALLIANCE];
+ GroupQueueInfo* hTeam = *itr_teams[BG_TEAM_HORDE];
Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true);
if (!arena)
{
@@ -980,35 +963,31 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
return;
}
- (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamRating;
- (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsMatchmakerRating = (*(itr_team[BG_TEAM_HORDE]))->ArenaMatchmakerRating;
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamId, (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsTeamRating);
- (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamRating;
- (*(itr_team[BG_TEAM_HORDE]))->OpponentsMatchmakerRating = (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaMatchmakerRating;
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamId, (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating);
+ aTeam->OpponentsTeamRating = hTeam->ArenaTeamRating;
+ hTeam->OpponentsTeamRating = aTeam->ArenaTeamRating;
+ aTeam->OpponentsMatchmakerRating = hTeam->ArenaMatchmakerRating;
+ hTeam->OpponentsMatchmakerRating = aTeam->ArenaMatchmakerRating;
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", aTeam->ArenaTeamId, aTeam->OpponentsTeamRating);
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", hTeam->ArenaTeamId, hTeam->OpponentsTeamRating);
+
// now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer
- if ((*(itr_team[BG_TEAM_ALLIANCE]))->Team != ALLIANCE)
+ if (aTeam->Team != ALLIANCE)
{
- // add to alliance queue
- m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(*(itr_team[BG_TEAM_ALLIANCE]));
- // erase from horde queue
- m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_team[BG_TEAM_ALLIANCE]);
- itr_team[BG_TEAM_ALLIANCE] = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin();
+ m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(aTeam);
+ m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[BG_TEAM_ALLIANCE]);
}
- if ((*(itr_team[BG_TEAM_HORDE]))->Team != HORDE)
+ if (hTeam->Team != HORDE)
{
- m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(*(itr_team[BG_TEAM_HORDE]));
- m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_team[BG_TEAM_HORDE]);
- itr_team[BG_TEAM_HORDE] = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin();
+ m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam);
+ m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[BG_TEAM_HORDE]);
}
- arena->SetArenaMatchmakerRating(ALLIANCE, (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaMatchmakerRating);
- arena->SetArenaMatchmakerRating(HORDE, (*(itr_team[BG_TEAM_HORDE]))->ArenaMatchmakerRating);
- InviteGroupToBG(*(itr_team[BG_TEAM_ALLIANCE]), arena, ALLIANCE);
- InviteGroupToBG(*(itr_team[BG_TEAM_HORDE]), arena, HORDE);
+ arena->SetArenaMatchmakerRating(ALLIANCE, aTeam->ArenaMatchmakerRating);
+ arena->SetArenaMatchmakerRating( HORDE, hTeam->ArenaMatchmakerRating);
+ InviteGroupToBG(aTeam, arena, ALLIANCE);
+ InviteGroupToBG(hTeam, arena, HORDE);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Starting rated arena match!");
-
arena->StartBattleground();
}
}
@@ -1020,9 +999,9 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
- Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
+ Player* player = ObjectAccessor::FindPlayer(m_PlayerGuid);
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
- if (!plr)
+ if (!player)
return true;
Battleground* bg = sBattlegroundMgr->GetBattleground(m_BgInstanceGUID, m_BgTypeId);
@@ -1031,7 +1010,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
return true;
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
- uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
+ uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground
{
// check if player is invited to this bg
@@ -1041,7 +1020,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
WorldPacket data;
//we must send remaining time in queue
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
}
return true; //event will be deleted
@@ -1063,8 +1042,8 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
*/
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
- Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(m_PlayerGuid);
+ if (!player)
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
return true;
@@ -1072,16 +1051,16 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
//battleground can be deleted already when we are removing queue info
//bg pointer can be NULL! so use it carefully!
- uint32 queueSlot = plr->GetBattlegroundQueueIndex(m_BgQueueTypeId);
+ uint32 queueSlot = player->GetBattlegroundQueueIndex(m_BgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
{
// check if player is in queue for this BG and if we are removing his invite event
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[m_BgQueueTypeId];
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
{
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", plr->GetGUIDLow(), m_BgInstanceGUID);
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", player->GetGUIDLow(), m_BgInstanceGUID);
- plr->RemoveBattlegroundQueueId(m_BgQueueTypeId);
+ player->RemoveBattlegroundQueueId(m_BgQueueTypeId);
bgQueue.RemovePlayer(m_PlayerGuid, true);
//update queues if battleground isn't ended
if (bg && bg->isBattleground() && bg->GetStatus() != STATUS_WAIT_LEAVE)
@@ -1089,7 +1068,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp
index 7c7a6262c58..1e8973edf10 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp
@@ -47,16 +47,16 @@ void BattlegroundAA::StartingEventOpenDoors()
{
}
-void BattlegroundAA::AddPlayer(Player* plr)
+void BattlegroundAA::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundAAScore* sc = new BattlegroundAAScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
}
-void BattlegroundAA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h
index 33e193bd4ef..bdf1ad7eedd 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h
@@ -35,11 +35,11 @@ class BattlegroundAA : public Battleground
~BattlegroundAA();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index e2a39ff4666..028773c5229 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -204,16 +204,16 @@ void BattlegroundAB::StartingEventOpenDoors()
DoorOpen(BG_AB_OBJECT_GATE_H);
}
-void BattlegroundAB::AddPlayer(Player* plr)
+void BattlegroundAB::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in the constructor
BattlegroundABScore* sc = new BattlegroundABScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
}
-void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
@@ -409,15 +409,15 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
WorldSafeLocsEntry const* ClosestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
- Player* plr = ObjectAccessor::FindPlayer(*itr);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(*itr);
+ if (!player)
continue;
if (!ClosestGrave) // cache
- ClosestGrave = GetClosestGraveYard(plr);
+ ClosestGrave = GetClosestGraveYard(player);
if (ClosestGrave)
- plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
+ player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index c848c5f23f8..39f3727d68e 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -245,10 +245,10 @@ class BattlegroundAB : public Battleground
BattlegroundAB();
~BattlegroundAB();
- void AddPlayer(Player* plr);
+ void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
virtual bool SetupBattleground();
virtual void Reset();
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index a647a3c6299..fe570930870 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -422,14 +422,14 @@ void BattlegroundAV::StartingEventOpenDoors()
DoorOpen(BG_AV_OBJECT_DOOR_A);
}
-void BattlegroundAV::AddPlayer(Player* plr)
+void BattlegroundAV::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundAVScore* sc = new BattlegroundAVScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
if (m_MaxLevel == 0)
- m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
+ m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
}
@@ -473,17 +473,17 @@ void BattlegroundAV::EndBattleground(uint32 winner)
Battleground::EndBattleground(winner);
}
-void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
{
- if (!plr)
+ if (!player)
{
sLog->outError("bg_AV no player at remove");
return;
}
//TODO search more buffs
- plr->RemoveAurasDueToSpell(AV_BUFF_ARMOR);
- plr->RemoveAurasDueToSpell(AV_BUFF_A_CAPTAIN);
- plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
+ player->RemoveAurasDueToSpell(AV_BUFF_ARMOR);
+ player->RemoveAurasDueToSpell(AV_BUFF_A_CAPTAIN);
+ player->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
}
void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
@@ -1029,17 +1029,17 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
if (!ghost_list.empty())
{
- Player* plr;
+ Player* player;
WorldSafeLocsEntry const* ClosestGrave = NULL;
for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
- plr = ObjectAccessor::FindPlayer(*ghost_list.begin());
- if (!plr)
+ player = ObjectAccessor::FindPlayer(*ghost_list.begin());
+ if (!player)
continue;
if (!ClosestGrave)
- ClosestGrave = GetClosestGraveYard(plr);
+ ClosestGrave = GetClosestGraveYard(player);
else
- plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
+ player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
m_ReviveQueue[m_BgCreatures[node]].clear();
}
@@ -1348,23 +1348,23 @@ bool BattlegroundAV::SetupBattleground()
//creatures
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
- for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
+ for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
{
if (m_Nodes[i].Owner)
- PopulateNode(i);
+ PopulateNode(BG_AV_Nodes(i));
}
//all creatures which don't get despawned through the script are static
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures");
- for (i=0; i < AV_STATICCPLACE_MAX; i++)
- AddAVCreature(0, i+AV_CPLACE_MAX);
+ for (i = 0; i < AV_STATICCPLACE_MAX; i++)
+ AddAVCreature(0, i + AV_CPLACE_MAX);
//mainspiritguides:
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning spiritguides creatures");
AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE);
AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE);
//spawn the marshals (those who get deleted, if a tower gets destroyed)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning marshal creatures");
- for (i=AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++)
- AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH+(i-AV_NPC_A_MARSHAL_SOUTH));
+ for (i = AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++)
+ AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH + (i - AV_NPC_A_MARSHAL_SOUTH));
AddAVCreature(AV_NPC_HERALD, AV_CPLACE_HERALD);
return true;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index 3ae1f52a4f9..2c8ffc0cf72 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -1539,11 +1539,11 @@ class BattlegroundAV : public Battleground
~BattlegroundAV();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void ResetBGSubclass();
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index 1db59547d92..88b9aa6184e 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
@@ -62,18 +62,18 @@ void BattlegroundBE::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
-void BattlegroundBE::AddPlayer(Player* plr)
+void BattlegroundBE::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundBEScore* sc = new BattlegroundBEScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
-void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundBE::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index 13aef8f561b..1b4fa8ebd64 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
@@ -55,17 +55,17 @@ class BattlegroundBE : public Battleground
~BattlegroundBE();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
- bool HandlePlayerUnderMap(Player* plr);
+ bool HandlePlayerUnderMap(Player* player);
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
index 6fb07ebb678..754005f3f33 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -88,18 +88,18 @@ void BattlegroundDS::StartingEventOpenDoors()
SpawnBGObject(i, getWaterFallTimer());
}
-void BattlegroundDS::AddPlayer(Player* plr)
+void BattlegroundDS::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundDSScore* sc = new BattlegroundDSScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
-void BattlegroundDS::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundDS::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index e5b2d613810..625eb1c7533 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -64,17 +64,17 @@ class BattlegroundDS : public Battleground
~BattlegroundDS();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
- bool HandlePlayerUnderMap(Player* plr);
+ bool HandlePlayerUnderMap(Player* player);
private:
uint32 m_waterTimer;
bool m_waterfallActive;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 8c5b0468aca..c790d64e986 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -146,20 +146,20 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
uint8 j = 0;
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
{
- Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
- if (!plr)
+ 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]));
++j;
continue;
}
- if (plr->CanCaptureTowerPoint() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
+ if (player->CanCaptureTowerPoint() && player->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
{
//player joined point!
//show progress bar
- UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, plr);
- UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], plr);
- UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, plr);
+ UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, player);
+ UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], player);
+ UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, player);
//add player to point
m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[EY_POINTS_MAX][j]);
//remove player from "free space"
@@ -186,8 +186,8 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
uint8 j = 0;
while (j < m_PlayersNearPoint[i].size())
{
- Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
- if (!plr)
+ 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]));
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
@@ -196,17 +196,17 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
++j;
continue;
}
- if (!plr->CanCaptureTowerPoint() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
+ if (!player->CanCaptureTowerPoint() || !player->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
//move player out of point (add him to players that are out of points
{
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
- this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr);
+ this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, player);
}
else
{
//player is neat flag, so update count:
- m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(plr->GetTeam())]++;
+ m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(player->GetTeam())]++;
++j;
}
}
@@ -241,20 +241,20 @@ void BattlegroundEY::UpdatePointStatuses()
for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i)
{
- Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]);
- if (plr)
+ Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]);
+ if (player)
{
- this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
+ this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], player);
//if point owner changed we must evoke event!
if (pointOwnerTeamId != m_PointOwnedByTeam[point])
{
//point was uncontrolled and player is from team which captured point
- if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId)
- this->EventTeamCapturedPoint(plr, point);
+ if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && player->GetTeam() == pointOwnerTeamId)
+ this->EventTeamCapturedPoint(player, point);
//point was under control and player isn't from team which controlled it
- if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point])
- this->EventTeamLostPoint(plr, point);
+ if (m_PointState[point] == EY_POINT_UNDER_CONTROL && player->GetTeam() != m_PointOwnedByTeam[point])
+ this->EventTeamLostPoint(player, point);
}
}
}
@@ -330,18 +330,18 @@ void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
}
}
-void BattlegroundEY::AddPlayer(Player* plr)
+void BattlegroundEY::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map
BattlegroundEYScore* sc = new BattlegroundEYScore;
- m_PlayersNearPoint[EY_POINTS_MAX].push_back(plr->GetGUID());
+ m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
}
-void BattlegroundEY::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/)
+void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j)
@@ -354,8 +354,8 @@ void BattlegroundEY::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/)
{
if (m_FlagKeeper == guid)
{
- if (plr)
- EventPlayerDroppedFlag(plr);
+ if (player)
+ EventPlayerDroppedFlag(player);
else
{
SetFlagPicker(0);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index fdb81491771..aba5754752a 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -336,7 +336,7 @@ class BattlegroundEY : public Battleground
~BattlegroundEY();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
@@ -348,7 +348,7 @@ class BattlegroundEY : public Battleground
void RespawnFlag(bool send_message);
void RespawnFlagAfterDrop();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleBuffUse(uint64 buff_guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index b00e8dac1d8..f17df3aaf67 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -90,22 +90,22 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
return;
- Player* plr = ObjectAccessor::FindPlayer(var);
+ Player* player = ObjectAccessor::FindPlayer(var);
- if (!plr || !gunshipAlliance || !gunshipHorde)
+ if (!player || !gunshipAlliance || !gunshipHorde)
return;
- plr->CastSpell(plr, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
- plr->CastSpell(plr, SPELL_SLOW_FALL, true);
+ player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
+ player->CastSpell(player, SPELL_SLOW_FALL, true);
- plr->SetTransport(plr->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
+ player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
- plr->m_movementInfo.t_pos.m_positionX = TransportMovementInfo.GetPositionX();
- plr->m_movementInfo.t_pos.m_positionY = TransportMovementInfo.GetPositionY();
- plr->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
- plr->m_movementInfo.t_guid = (plr->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
+ player->m_movementInfo.t_pos.m_positionX = TransportMovementInfo.GetPositionX();
+ player->m_movementInfo.t_pos.m_positionY = TransportMovementInfo.GetPositionY();
+ player->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
+ player->m_movementInfo.t_guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
- plr->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
+ player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
}
void BattlegroundIC::PostUpdateImpl(uint32 diff)
@@ -135,7 +135,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
- if (nodePoint[i].timer <= diff)
+ if (docksTimer <= diff)
{
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); u++)
@@ -158,7 +158,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
}
docksTimer = DOCKS_UPDATE_TIME;
- } else nodePoint[i].timer -= diff;
+ } else docksTimer -= diff;
}
}
@@ -292,29 +292,29 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
return count == NODE_TYPE_WORKSHOP;
}
-void BattlegroundIC::AddPlayer(Player* plr)
+void BattlegroundIC::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundICScore* sc = new BattlegroundICScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
- if (nodePoint[NODE_TYPE_QUARRY].nodeState == (plr->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
- plr->CastSpell(plr, SPELL_QUARRY, true);
+ if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
+ player->CastSpell(player, SPELL_QUARRY, true);
- if (nodePoint[NODE_TYPE_REFINERY].nodeState == (plr->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
- plr->CastSpell(plr, SPELL_OIL_REFINERY, true);
+ if (nodePoint[NODE_TYPE_REFINERY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
+ player->CastSpell(player, SPELL_OIL_REFINERY, true);
- SendTransportInit(plr);
+ SendTransportInit(player);
}
-void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundIC::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
{
- if (plr)
+ if (player)
{
- plr->RemoveAura(SPELL_QUARRY);
- plr->RemoveAura(SPELL_OIL_REFINERY);
+ player->RemoveAura(SPELL_QUARRY);
+ player->RemoveAura(SPELL_OIL_REFINERY);
}
}
@@ -482,15 +482,15 @@ void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType)
WorldSafeLocsEntry const* ClosestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
- Player* plr = ObjectAccessor::FindPlayer(*itr);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(*itr);
+ if (!player)
continue;
if (!ClosestGrave) // cache
- ClosestGrave = GetClosestGraveYard(plr);
+ ClosestGrave = GetClosestGraveYard(player);
if (ClosestGrave)
- plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
+ player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
}
}
@@ -644,178 +644,178 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
switch (nodePoint->gameobject_type)
{
- case BG_IC_GO_HANGAR_BANNER:
- // all the players on the stopped transport should be teleported out
- if (!gunshipAlliance || !gunshipHorde)
- break;
+ case BG_IC_GO_HANGAR_BANNER:
+ // all the players on the stopped transport should be teleported out
+ if (!gunshipAlliance || !gunshipHorde)
+ break;
- for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; u++)
- {
- uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u;
- AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL),
- BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(),
- BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(),
- 0, 0, 0, 0, RESPAWN_ONE_DAY);
- }
-
- //sLog->outError("BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
+ for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; u++)
+ {
+ uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u;
+ AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL),
+ BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(),
+ BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(),
+ 0, 0, 0, 0, RESPAWN_ONE_DAY);
+ }
- (nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap());
- (nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
- // we should spawn teleporters
- break;
- case BG_IC_GO_QUARRY_BANNER:
- RemoveAuraOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
- CastSpellOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
- break;
- case BG_IC_GO_REFINERY_BANNER:
- RemoveAuraOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
- CastSpellOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
- break;
- case BG_IC_GO_DOCKS_BANNER:
+ //sLog->outError("BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
- if (recapture)
+ (nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap());
+ (nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
+ // we should spawn teleporters
break;
+ case BG_IC_GO_QUARRY_BANNER:
+ RemoveAuraOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
+ CastSpellOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
+ break;
+ case BG_IC_GO_REFINERY_BANNER:
+ RemoveAuraOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
+ CastSpellOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
+ break;
+ case BG_IC_GO_DOCKS_BANNER:
- if (docksTimer < DOCKS_UPDATE_TIME)
- docksTimer = DOCKS_UPDATE_TIME;
+ if (recapture)
+ break;
- // we must del opposing faction vehicles when the node is captured (unused ones)
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++)
- {
- if (Creature* glaiveThrower = GetBGCreature(i))
+ if (docksTimer < DOCKS_UPDATE_TIME)
+ docksTimer = DOCKS_UPDATE_TIME;
+
+ // we must del opposing faction vehicles when the node is captured (unused ones)
+ for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++)
{
- if (Vehicle* vehicleGlaive = glaiveThrower->GetVehicleKit())
+ if (Creature* glaiveThrower = GetBGCreature(i))
{
- if (!vehicleGlaive->GetPassenger(0))
- DelCreature(i);
+ if (Vehicle* vehicleGlaive = glaiveThrower->GetVehicleKit())
+ {
+ if (!vehicleGlaive->GetPassenger(0))
+ DelCreature(i);
+ }
}
}
- }
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++)
- {
- if (Creature* catapult = GetBGCreature(i))
+ for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++)
{
- if (Vehicle* vehicleGlaive = catapult->GetVehicleKit())
+ if (Creature* catapult = GetBGCreature(i))
{
- if (!vehicleGlaive->GetPassenger(0))
- DelCreature(i);
+ if (Vehicle* vehicleGlaive = catapult->GetVehicleKit())
+ {
+ if (!vehicleGlaive->GetPassenger(0))
+ DelCreature(i);
+ }
}
}
- }
- // spawning glaive throwers
- for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; i++)
- {
- uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
+ // spawning glaive throwers
+ for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; i++)
+ {
+ uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
- if (GetBGCreature(type) && GetBGCreature(type)->isAlive())
- continue;
+ if (GetBGCreature(type) && GetBGCreature(type)->isAlive())
+ continue;
- if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, nodePoint->faction,
- BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(),
- BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(),
- RESPAWN_ONE_DAY))
- GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
- }
+ if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, nodePoint->faction,
+ BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(),
+ BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(),
+ RESPAWN_ONE_DAY))
+ GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ }
- // spawning catapults
- for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; i++)
- {
- uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
+ // spawning catapults
+ for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; i++)
+ {
+ uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
- if (GetBGCreature(type) && GetBGCreature(type)->isAlive())
- continue;
+ if (GetBGCreature(type) && GetBGCreature(type)->isAlive())
+ continue;
- if (AddCreature(NPC_CATAPULT, type, nodePoint->faction,
- BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(),
- BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(),
- RESPAWN_ONE_DAY))
- GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
- }
- break;
- case BG_IC_GO_WORKSHOP_BANNER:
- {
- if (siegeEngineWorkshopTimer < WORKSHOP_UPDATE_TIME)
- siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
-
- if (!recapture)
+ if (AddCreature(NPC_CATAPULT, type, nodePoint->faction,
+ BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(),
+ BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(),
+ RESPAWN_ONE_DAY))
+ GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ }
+ break;
+ case BG_IC_GO_WORKSHOP_BANNER:
{
- // we must del opposing faction vehicles when the node is captured (unused ones)
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++)
+ if (siegeEngineWorkshopTimer < WORKSHOP_UPDATE_TIME)
+ siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
+
+ if (!recapture)
{
- if (Creature* demolisher = GetBGCreature(i))
+ // we must del opposing faction vehicles when the node is captured (unused ones)
+ for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++)
{
- if (Vehicle* vehicleDemolisher = demolisher->GetVehicleKit())
+ if (Creature* demolisher = GetBGCreature(i))
{
- // is IsVehicleInUse working as expected?
- if (!vehicleDemolisher->IsVehicleInUse())
- DelCreature(i);
+ if (Vehicle* vehicleDemolisher = demolisher->GetVehicleKit())
+ {
+ // is IsVehicleInUse working as expected?
+ if (!vehicleDemolisher->IsVehicleInUse())
+ DelCreature(i);
+ }
}
}
- }
- for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; i++)
- {
- uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
+ for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; i++)
+ {
+ uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
- if (GetBGCreature(type) && GetBGCreature(type)->isAlive())
- continue;
+ if (GetBGCreature(type) && GetBGCreature(type)->isAlive())
+ continue;
- if (AddCreature(NPC_DEMOLISHER, type, nodePoint->faction,
- BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
- BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
- RESPAWN_ONE_DAY))
- GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
- }
+ if (AddCreature(NPC_DEMOLISHER, type, nodePoint->faction,
+ BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
+ BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
+ RESPAWN_ONE_DAY))
+ GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ }
- // we check if the opossing siege engine is in use
- int8 enemySiege = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
+ // we check if the opossing siege engine is in use
+ int8 enemySiege = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
- if (Creature* siegeEngine = GetBGCreature(enemySiege))
- {
- if (Vehicle* vehicleSiege = siegeEngine->GetVehicleKit())
+ if (Creature* siegeEngine = GetBGCreature(enemySiege))
{
- // is VehicleInUse working as expected ?
- if (!vehicleSiege->IsVehicleInUse())
- DelCreature(enemySiege);
+ if (Vehicle* vehicleSiege = siegeEngine->GetVehicleKit())
+ {
+ // is VehicleInUse working as expected ?
+ if (!vehicleSiege->IsVehicleInUse())
+ DelCreature(enemySiege);
+ }
}
- }
- uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
- if (!GetBGCreature(siegeType) || !GetBGCreature(siegeType)->isAlive())
- {
- AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, nodePoint->faction,
- BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
- BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
- RESPAWN_ONE_DAY);
-
- if (Creature* siegeEngine = GetBGCreature(siegeType))
+ uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
+ if (!GetBGCreature(siegeType) || !GetBGCreature(siegeType)->isAlive())
{
- siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_OOC_NOT_ATTACKABLE);
- siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, nodePoint->faction,
+ BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
+ BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
+ RESPAWN_ONE_DAY);
+
+ if (Creature* siegeEngine = GetBGCreature(siegeType))
+ {
+ siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_OOC_NOT_ATTACKABLE);
+ siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ }
}
}
- }
- for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; i++)
- {
- AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i, GO_SEAFORIUM_BOMBS,
- workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(),
- workshopBombs[i].GetPositionZ(), workshopBombs[i].GetOrientation(),
- 0, 0, 0, 0, 10);
-
- if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i))
+ for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; i++)
{
- seaforiumBombs->SetRespawnTime(10);
- seaforiumBombs->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i, GO_SEAFORIUM_BOMBS,
+ workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(),
+ workshopBombs[i].GetPositionZ(), workshopBombs[i].GetOrientation(),
+ 0, 0, 0, 0, 10);
+
+ if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i))
+ {
+ seaforiumBombs->SetRespawnTime(10);
+ seaforiumBombs->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ }
}
+ break;
}
+ default:
break;
- }
- default:
- break;
}
}
@@ -855,7 +855,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
}
-void BattlegroundIC::EventPlayerDamagedGO(Player* /*plr*/, GameObject* /*go*/, uint32 /*eventType*/)
+void BattlegroundIC::EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/)
{
}
@@ -903,7 +903,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
{
Transport* t = new Transport(period, 0);
- const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(goEntry);
+ GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(goEntry);
if (!goinfo)
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index efa91559ca6..552b79ce608 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -93,7 +93,6 @@ enum gameobjectsIC
GO_FLAGPOLE_1 = 195131,
GO_FLAGPOLE_2 = 195439,
- GO_FLAGPOLE_3 = 195131,
GO_GUNSHIP_PORTAL_1 = 195371,
GO_GUNSHIP_PORTAL_2 = 196413,
@@ -270,6 +269,7 @@ enum BG_IC_GOs
BG_IC_GO_FLAGPOLE_1_3,
BG_IC_GO_FLAGPOLE_1_4,
BG_IC_GO_FLAGPOLE_1_5,
+ BG_IC_GO_FLAGPOLE_1_6,
BG_IC_GO_HANGAR_BANNER,
@@ -624,6 +624,7 @@ const ICGo BG_IC_ObjSpawnlocs[MAX_NORMAL_GAMEOBJECTS_SPAWNS] =
{BG_IC_GO_FLAGPOLE_1_3, GO_FLAGPOLE_1, 807.78f, -1000.07f, 132.381f, -1.91986f}, // Flagpole
{BG_IC_GO_FLAGPOLE_1_4, GO_FLAGPOLE_1, 776.229f, -804.283f, 6.45052f, 1.6057f}, // Flagpole
{BG_IC_GO_FLAGPOLE_1_5, GO_FLAGPOLE_1, 251.016f, -1159.32f, 17.2376f, -2.25147f}, // Flagpole
+ {BG_IC_GO_FLAGPOLE_1_6, GO_FLAGPOLE_1, 1269.502f, -400.809f, 37.62525f, -1.762782f}, // Flagpole
{BG_IC_GO_HORDE_KEEP_PORTCULLIS, GO_HORDE_KEEP_PORTCULLIS, 1283.05f, -765.878f, 50.8297f, -3.13286f}, // Horde Keep Portcullis
@@ -862,12 +863,12 @@ class BattlegroundIC : public Battleground
~BattlegroundIC();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
virtual void PostUpdateImpl(uint32 diff);
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void SpawnLeader(uint32 teamid);
@@ -876,7 +877,7 @@ class BattlegroundIC : public Battleground
void EndBattleground(uint32 winner);
void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/);
- void EventPlayerDamagedGO(Player* /*plr*/, GameObject* go, uint32 eventType);
+ void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
void DestroyGate(Player* player, GameObject* go);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 58dc20c30cb..37fdd2559c4 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
@@ -59,18 +59,18 @@ void BattlegroundNA::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
-void BattlegroundNA::AddPlayer(Player* plr)
+void BattlegroundNA::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundNAScore* sc = new BattlegroundNAScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
-void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundNA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
index beddbaaeedf..e7fe08063a4 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
@@ -56,16 +56,16 @@ class BattlegroundNA : public Battleground
~BattlegroundNA();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
- bool HandlePlayerUnderMap(Player* plr);
+ bool HandlePlayerUnderMap(Player* player);
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp
index e2d64aa39f7..ba4d787b215 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp
@@ -43,16 +43,16 @@ void BattlegroundRB::StartingEventOpenDoors()
{
}
-void BattlegroundRB::AddPlayer(Player* plr)
+void BattlegroundRB::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundRBScore* sc = new BattlegroundRBScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
}
-void BattlegroundRB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h
index 0878654d7dd..ef6283ed96a 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h
@@ -34,11 +34,11 @@ class BattlegroundRB : public Battleground
BattlegroundRB();
~BattlegroundRB();
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
/* Scorekeeping */
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index 8ede4a6329c..3d1ebe8fec9 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
@@ -59,18 +59,18 @@ void BattlegroundRL::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
-void BattlegroundRL::AddPlayer(Player* plr)
+void BattlegroundRL::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundRLScore* sc = new BattlegroundRLScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState();
}
-void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundRL::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
index 52ce7d3ca40..5528d0ccf9e 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
@@ -52,16 +52,16 @@ class BattlegroundRL : public Battleground
~BattlegroundRL();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
- bool HandlePlayerUnderMap(Player* plr);
+ bool HandlePlayerUnderMap(Player* player);
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
index 81a75c23cb5..0c44c5d3d96 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
@@ -102,19 +102,19 @@ void BattlegroundRV::StartingEventOpenDoors()
setTimer(BG_RV_FIRST_TIMER);
}
-void BattlegroundRV::AddPlayer(Player* plr)
+void BattlegroundRV::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundRVScore* sc = new BattlegroundRVScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
}
-void BattlegroundRV::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundRV::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
index 9a6efe64524..70417c1dfce 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
@@ -105,17 +105,17 @@ class BattlegroundRV : public Battleground
~BattlegroundRV();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
- bool HandlePlayerUnderMap(Player* plr);
+ bool HandlePlayerUnderMap(Player* player);
private:
uint32 Timer;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index c214ac21068..aaa29e1ca20 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -62,8 +62,8 @@ bool BattlegroundSA::SetupBattleground()
bool BattlegroundSA::ResetObjs()
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
- SendTransportsRemove(plr);
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ SendTransportsRemove(player);
uint32 atF = BG_SA_Factions[Attackers];
uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE];
@@ -245,8 +245,8 @@ bool BattlegroundSA::ResetObjs()
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
- SendTransportInit(plr);
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ SendTransportInit(player);
TeleportPlayers();
return true;
@@ -431,39 +431,39 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks;
}
-void BattlegroundSA::AddPlayer(Player* plr)
+void BattlegroundSA::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundSAScore* sc = new BattlegroundSAScore;
if (!ShipsStarted)
{
- if (plr->GetTeamId() == Attackers)
+ if (player->GetTeamId() == Attackers)
{
- plr->CastSpell(plr, 12438, true);//Without this player falls before boat loads...
+ player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
if (urand(0, 1))
- plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
+ player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
- plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
+ player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
}
else
- plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
+ player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
else
{
- if (plr->GetTeamId() == Attackers)
- plr->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
+ if (player->GetTeamId() == Attackers)
+ player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
else
- plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
+ player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
- SendTransportInit(plr);
- m_PlayerScores[plr->GetGUID()] = sc;
+ SendTransportInit(player);
+ m_PlayerScores[player->GetGUID()] = sc;
}
-void BattlegroundSA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*team*/)
+void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
{
}
@@ -492,37 +492,37 @@ void BattlegroundSA::TeleportPlayers()
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
{
// should remove spirit of redemption
- if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
- plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
+ if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
+ player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
- if (!plr->isAlive())
+ if (!player->isAlive())
{
- plr->ResurrectPlayer(1.0f);
- plr->SpawnCorpseBones();
+ player->ResurrectPlayer(1.0f);
+ player->SpawnCorpseBones();
}
- plr->ResetAllPowers();
- plr->CombatStopWithPets(true);
+ player->ResetAllPowers();
+ player->CombatStopWithPets(true);
- if (plr->GetTeamId() == Attackers)
+ if (player->GetTeamId() == Attackers)
{
- plr->CastSpell(plr, 12438, true); //Without this player falls before boat loads...
+ player->CastSpell(player, 12438, true); //Without this player falls before boat loads...
if (urand(0, 1))
- plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
+ player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
- plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
+ player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
}
else
- plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
+ player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
}
}
-void BattlegroundSA::EventPlayerDamagedGO(Player* /*plr*/, GameObject* go, uint32 eventType)
+void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType)
{
if (!go || !go->GetGOInfo())
return;
@@ -798,9 +798,9 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
//Achievement Storm the Beach (1310)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
- if (plr->GetTeamId() == Attackers)
- plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ if (player->GetTeamId() == Attackers)
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
}
Attackers = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
@@ -822,9 +822,9 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
//Achievement Storm the Beach (1310)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
- if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
- if (plr->GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
- plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ if (player->GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
}
if (RoundScores[0].time == RoundScores[1].time)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 5f01d0fac4d..8b446fccb9e 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -423,7 +423,7 @@ class BattlegroundSA : public Battleground
/* inherited from BattlegroundClass */
/// Called when a player join battle
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
/// Called when battle start
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
@@ -433,7 +433,7 @@ class BattlegroundSA : public Battleground
/// Called for generate packet contain worldstate data
virtual void FillInitialWorldStates(WorldPacket& data);
/// Called when a player deal damage to building (door)
- virtual void EventPlayerDamagedGO(Player* plr, GameObject* go, uint32 eventType);
+ 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);
/// Return the nearest graveyard where player can respawn
@@ -477,7 +477,7 @@ class BattlegroundSA : public Battleground
void EndBattleground(uint32 winner);
/// CAlled when a player leave battleground
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
/* Scorekeeping */
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 951fe8f6b51..a6aa6f41db2 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -140,23 +140,23 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
m_FlagSpellForceTimer += diff;
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
{
- if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
- plr->CastSpell(plr, WS_SPELL_FOCUSED_ASSAULT, true);
- if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
- plr->CastSpell(plr, WS_SPELL_FOCUSED_ASSAULT, true);
+ if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
+ player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
+ if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
+ player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
m_FlagDebuffState = 1;
}
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
- if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
+ if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
{
- plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
- plr->CastSpell(plr, WS_SPELL_BRUTAL_ASSAULT, true);
+ player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
+ player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
}
- if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
+ if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
{
- plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
- plr->CastSpell(plr, WS_SPELL_BRUTAL_ASSAULT, true);
+ player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
+ player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
}
m_FlagDebuffState = 2;
}
@@ -202,13 +202,13 @@ void BattlegroundWS::StartingEventOpenDoors()
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE);
}
-void BattlegroundWS::AddPlayer(Player* plr)
+void BattlegroundWS::AddPlayer(Player* player)
{
- Battleground::AddPlayer(plr);
+ Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor
BattlegroundWGScore* sc = new BattlegroundWGScore;
- m_PlayerScores[plr->GetGUID()] = sc;
+ m_PlayerScores[player->GetGUID()] = sc;
}
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
@@ -556,30 +556,30 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
-void BattlegroundWS::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/)
+void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
{
- if (!plr)
+ if (!player)
{
sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0);
this->RespawnFlag(ALLIANCE, false);
}
else
- this->EventPlayerDroppedFlag(plr);
+ this->EventPlayerDroppedFlag(player);
}
if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
{
- if (!plr)
+ if (!player)
{
sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0);
this->RespawnFlag(HORDE, false);
}
else
- this->EventPlayerDroppedFlag(plr);
+ this->EventPlayerDroppedFlag(player);
}
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index 386cc6945e8..b3c2c88c306 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -163,7 +163,7 @@ class BattlegroundWS : public Battleground
~BattlegroundWS();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* plr);
+ virtual void AddPlayer(Player* player);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
@@ -187,7 +187,7 @@ class BattlegroundWS : public Battleground
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
virtual void EventPlayerCapturedFlag(Player* Source);
- void RemovePlayer(Player* plr, uint64 guid, uint32 team);
+ void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
bool SetupBattleground();
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 413070ca1de..1968de70f46 100755
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -85,7 +85,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
}
else // save
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL);
stmt->setString(0, name);
stmt->setUInt32(1, m_Team);
CharacterDatabase.Execute(stmt);
@@ -169,22 +169,22 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
- Player* plr = ObjectAccessor::FindPlayer(p);
+ Player* player = ObjectAccessor::FindPlayer(p);
- if (plr)
+ if (player)
{
if (HasFlag(CHANNEL_FLAG_LFG) &&
- sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(plr->GetSession()->GetSecurity()) && plr->GetGroup())
+ sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup())
{
MakeNotInLfg(&data);
SendToOne(&data, p);
return;
}
- plr->JoinedChannel(this);
+ player->JoinedChannel(this);
}
- if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, p);
SendToAll(&data);
@@ -231,22 +231,22 @@ void Channel::Leave(uint64 p, bool send)
}
else
{
- Player* plr = ObjectAccessor::FindPlayer(p);
+ Player* player = ObjectAccessor::FindPlayer(p);
if (send)
{
WorldPacket data;
MakeYouLeft(&data);
SendToOne(&data, p);
- if (plr)
- plr->LeftChannel(this);
+ if (player)
+ player->LeftChannel(this);
data.clear();
}
bool changeowner = players[p].IsOwner();
players.erase(p);
- if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
WorldPacket data;
MakeLeft(&data, p);
@@ -379,11 +379,11 @@ void Channel::UnBan(uint64 good, const char *badname)
void Channel::Password(uint64 p, const char *pass)
{
uint32 sec = 0;
- Player* plr = ObjectAccessor::FindPlayer(p);
- if (plr)
- sec = plr->GetSession()->GetSecurity();
+ Player* player = ObjectAccessor::FindPlayer(p);
+ if (player)
+ sec = player->GetSession()->GetSecurity();
- ChatHandler chat(plr);
+ ChatHandler chat(player);
if (!IsOn(p))
{
@@ -411,11 +411,11 @@ void Channel::Password(uint64 p, const char *pass)
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
{
- Player* plr = ObjectAccessor::FindPlayer(p);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(p);
+ if (!player)
return;
- uint32 sec = plr->GetSession()->GetSecurity();
+ uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(p))
{
@@ -453,8 +453,8 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
// allow make moderator from another team only if both is GMs
// at this moment this only way to show channel post for GM from another team
- if ((!AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
- plr->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if ((!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
+ player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -479,11 +479,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
void Channel::SetOwner(uint64 p, const char *newname)
{
- Player* plr = ObjectAccessor::FindPlayer(p);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(p);
+ if (!player)
return;
- uint32 sec = plr->GetSession()->GetSecurity();
+ uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(p))
{
@@ -510,7 +510,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
- if (newp->GetTeam() != plr->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -563,12 +563,12 @@ void Channel::List(Player* player)
uint32 count = 0;
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
- Player* plr = ObjectAccessor::FindPlayer(i->first);
+ Player* member = ObjectAccessor::FindPlayer(i->first);
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
- if (plr && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
- plr->IsVisibleGloballyFor(player))
+ if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
+ member->IsVisibleGloballyFor(player))
{
data << uint64(i->first);
data << uint8(i->second.flags); // flags seems to be changed...
@@ -585,9 +585,9 @@ void Channel::List(Player* player)
void Channel::Announce(uint64 p)
{
uint32 sec = 0;
- Player* plr = ObjectAccessor::FindPlayer(p);
- if (plr)
- sec = plr->GetSession()->GetSecurity();
+ Player* player = ObjectAccessor::FindPlayer(p);
+ if (player)
+ sec = player->GetSession()->GetSecurity();
if (!IsOn(p))
{
@@ -623,7 +623,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
- Player* plr = ObjectAccessor::FindPlayer(p);
+ Player* player = ObjectAccessor::FindPlayer(p);
if (!IsOn(p))
{
@@ -650,7 +650,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
data << p;
data << messageLength;
data << what;
- data << uint8(plr ? plr->chatTag() : 0);
+ data << uint8(player ? player->GetChatTag() : 0);
SendToAll(&data, !players[p].IsModerator() ? p : false);
}
@@ -683,11 +683,11 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
- Player* plr = ObjectAccessor::FindPlayer(p);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(p);
+ if (!player)
return;
- if (newp->GetTeam() != plr->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakeInviteWrongFaction(&data);
@@ -749,11 +749,11 @@ void Channel::SendToAll(WorldPacket* data, uint64 p)
{
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
- Player* plr = ObjectAccessor::FindPlayer(i->first);
- if (plr)
+ Player* player = ObjectAccessor::FindPlayer(i->first);
+ if (player)
{
- if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
- plr->GetSession()->SendPacket(data);
+ if (!p || !player->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ player->GetSession()->SendPacket(data);
}
}
}
@@ -764,18 +764,18 @@ void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
{
if (i->first != who)
{
- Player* plr = ObjectAccessor::FindPlayer(i->first);
- if (plr)
- plr->GetSession()->SendPacket(data);
+ Player* player = ObjectAccessor::FindPlayer(i->first);
+ if (player)
+ player->GetSession()->SendPacket(data);
}
}
}
void Channel::SendToOne(WorldPacket* data, uint64 who)
{
- Player* plr = ObjectAccessor::FindPlayer(who);
- if (plr)
- plr->GetSession()->SendPacket(data);
+ Player* player = ObjectAccessor::FindPlayer(who);
+ if (player)
+ player->GetSession()->SendPacket(data);
}
void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 7d6e9f7a004..be43862eaea 100755
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -1051,7 +1051,7 @@ void ChatHandler::FillMessageData(WorldPacket* data, WorldSession* session, uint
*data << uint32(messageLength);
*data << message;
if (session != 0 && type != CHAT_MSG_WHISPER_INFORM && type != CHAT_MSG_DND && type != CHAT_MSG_AFK)
- *data << uint8(session->GetPlayer()->chatTag());
+ *data << uint8(session->GetPlayer()->GetChatTag());
else
*data << uint8(0);
}
@@ -1551,9 +1551,9 @@ bool CliHandler::needReportToTarget(Player* /*chr*/) const
return true;
}
-bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline)
+bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline)
{
- plr = NULL;
+ player = NULL;
guid = 0;
if (cname)
@@ -1568,28 +1568,28 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, G
return false;
}
- plr = sObjectAccessor->FindPlayerByName(name.c_str());
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
if (offline)
guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
}
}
- if (plr)
+ if (player)
{
- group = plr->GetGroup();
+ group = player->GetGroup();
if (!guid || !offline)
- guid = plr->GetGUID();
+ guid = player->GetGUID();
}
else
{
if (getSelectedPlayer())
- plr = getSelectedPlayer();
+ player = getSelectedPlayer();
else
- plr = m_session->GetPlayer();
+ player = m_session->GetPlayer();
if (!guid || !offline)
- guid = plr->GetGUID();
- group = plr->GetGroup();
+ guid = player->GetGUID();
+ group = player->GetGroup();
}
return true;
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 6e34e39af5a..24652fcc6d5 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -109,7 +109,7 @@ class ChatHandler
uint32 extractSpellIdFromLink(char* text);
uint64 extractGuidFromLink(char* text);
GameTele const* extractGameTeleFromLink(char* text);
- bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline = false);
+ bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &player, Group* &group, uint64 &guid, bool offline = false);
std::string extractPlayerNameFromLink(char* text);
// select by arg (name/link) or in-game selection online/offline player
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL);
diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp
index c737e2b0b54..f06f8a7e89c 100755
--- a/src/server/game/Chat/Commands/Level1.cpp
+++ b/src/server/game/Chat/Commands/Level1.cpp
@@ -713,18 +713,18 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
- Player* pl = itr->getSource();
+ Player* player = itr->getSource();
- if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
+ if (!player || player == m_session->GetPlayer() || !player->GetSession())
continue;
// check online security
- if (HasLowerSecurity(pl, 0))
+ if (HasLowerSecurity(player, 0))
return false;
- std::string plNameLink = GetNameLink(pl);
+ std::string plNameLink = GetNameLink(player);
- if (pl->IsBeingTeleported() == true)
+ if (player->IsBeingTeleported() == true)
{
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
SetSentErrorMessage(true);
@@ -733,7 +733,7 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
if (to_instance)
{
- Map* plMap = pl->GetMap();
+ Map* plMap = player->GetMap();
if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
{
@@ -745,23 +745,23 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
}
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
- if (needReportToTarget(pl))
- ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
+ if (needReportToTarget(player))
+ ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
// stop flight if need
- if (pl->isInFlight())
+ if (player->isInFlight())
{
- pl->GetMotionMaster()->MovementExpired();
- pl->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- pl->SaveRecallPosition();
+ player->SaveRecallPosition();
// before GM
float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, pl->GetObjectSize());
- pl->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, pl->GetOrientation());
+ 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
index b4b0cff9ea7..1dd603094f6 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -349,18 +349,18 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
std::string bannedby = "unknown";
std::string banreason = "";
- if (QueryResult result = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned "
+ if (QueryResult result2 = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned "
"WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId))
{
- Field* fields = result->Fetch();
+ Field* fields = result2->Fetch();
banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
bannedby = fields[2].GetString();
banreason = fields[3].GetString();
}
- else if (QueryResult result = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned "
+ else if (QueryResult result3 = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned "
"WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid)))
{
- Field* fields = result->Fetch();
+ Field* fields = result3->Fetch();
banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
bannedby = fields[2].GetString();
banreason = fields[3].GetString();
@@ -912,8 +912,8 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
if (!*args)
return false;
- Player* plr = m_session->GetPlayer();
- Pet* pet = plr->GetPet();
+ Player* player = m_session->GetPlayer();
+ Pet* pet = player->GetPet();
if (!pet)
{
@@ -955,8 +955,8 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args)
if (!*args)
return false;
- Player* plr = m_session->GetPlayer();
- Pet* pet = plr->GetPet();
+ Player* player = m_session->GetPlayer();
+ Pet* pet = player->GetPet();
if (!pet)
{
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index d87717d96fe..f4f5892b587 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -256,10 +256,10 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
if (count == 0)
count = 1;
- Player* pl = m_session->GetPlayer();
+ Player* player = m_session->GetPlayer();
Player* plTarget = getSelectedPlayer();
if (!plTarget)
- plTarget = pl;
+ plTarget = player;
sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
@@ -298,15 +298,15 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
// remove binding (let GM give it to another player later)
- if (pl == plTarget)
+ if (player == plTarget)
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
- if (Item* item1 = pl->GetItemByPos(itr->pos))
+ if (Item* item1 = player->GetItemByPos(itr->pos))
item1->SetBinding(false);
if (count > 0 && item)
{
- pl->SendNewItem(item, count, false, true);
- if (pl != plTarget)
+ player->SendNewItem(item, count, false, true);
+ if (player != plTarget)
plTarget->SendNewItem(item, count, true, false);
}
@@ -526,7 +526,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
"SELECT ah.itemguid, ah.itemowner, c.account, c.name FROM auctionhouse ah "
"INNER JOIN characters c ON c.guid = ah.itemowner "
"INNER JOIN item_instance ii ON ii.guid = ah.itemguid "
- "WHERE ii.itemEntry = '%u' AND LIMIT %u", item_id, count);
+ "WHERE ii.itemEntry = '%u' LIMIT %u", item_id, count);
}
else
result = QueryResult(NULL);
@@ -637,9 +637,9 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
if (m_session)
{
- Player* pl = m_session->GetPlayer();
+ 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",
- pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), go_id, uint32(count));
+ 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",
@@ -709,9 +709,9 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
if (m_session)
{
- Player* pl = m_session->GetPlayer();
+ 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",
- pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id, uint32(count));
+ 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",
@@ -1859,6 +1859,12 @@ bool ChatHandler::HandleDamageCommand(const char * args)
return false;
}
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
if (!target->isAlive())
return true;
@@ -2671,7 +2677,7 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'", atLogin, atLogin);
- ACE_READ_GUARD_RETURN(HashMapHolder<Player>::LockType, guard, *HashMapHolder<Player>::GetLock(), true);
+ 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);
@@ -3452,11 +3458,11 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
{
- Player* pl = m_session->GetPlayer();
+ Player* player = m_session->GetPlayer();
// accept only explicitly selected target (not implicitly self targeting case)
Unit* target = getSelectedUnit();
- if (pl->GetSelection() && target)
+ if (player->GetSelection() && target)
{
if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
{
@@ -3470,15 +3476,15 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
return true;
}
- CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY()));
+ CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
Cell cell(p);
cell.SetNoCreate();
Trinity::RespawnDo u_do;
- Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(pl, u_do);
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
- cell.Visit(p, obj_worker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
+ cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
return true;
}
@@ -4025,9 +4031,9 @@ bool ChatHandler::HandleComeToMeCommand(const char *args)
caster->SetUnitMovementFlags(newFlags);
- Player* pl = m_session->GetPlayer();
+ Player* player = m_session->GetPlayer();
- caster->GetMotionMaster()->MovePoint(0, pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ());
+ caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
return true;
}
@@ -4171,9 +4177,9 @@ bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/)
{
- Player* pl = m_session->GetPlayer();
+ Player* player = m_session->GetPlayer();
- Map* map = pl->GetMap();
+ Map* map = player->GetMap();
if (!map->IsDungeon())
{
PSendSysMessage("Map is not a dungeon.");
@@ -4643,12 +4649,12 @@ bool ChatHandler::HandleListFreezeCommand(const char * /*args*/)
bool ChatHandler::HandleGroupLeaderCommand(const char *args)
{
- Player* plr = NULL;
+ Player* player = NULL;
Group* group = NULL;
uint64 guid = 0;
char* cname = strtok((char*)args, " ");
- if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid))
+ if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
if (group && group->GetLeaderGUID() != guid)
{
group->ChangeLeader(guid);
@@ -4660,12 +4666,12 @@ bool ChatHandler::HandleGroupLeaderCommand(const char *args)
bool ChatHandler::HandleGroupDisbandCommand(const char *args)
{
- Player* plr = NULL;
+ Player* player = NULL;
Group* group = NULL;
uint64 guid = 0;
char* cname = strtok((char*)args, " ");
- if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid))
+ if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
if (group)
group->Disband();
@@ -4674,12 +4680,12 @@ bool ChatHandler::HandleGroupDisbandCommand(const char *args)
bool ChatHandler::HandleGroupRemoveCommand(const char *args)
{
- Player* plr = NULL;
+ Player* player = NULL;
Group* group = NULL;
uint64 guid = 0;
char* cname = strtok((char*)args, " ");
- if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid, true))
+ if (GetPlayerGroupAndGUIDByName(cname, player, group, guid, true))
if (group)
group->RemoveMember(guid);
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index dafb0ebc11f..07febf889d0 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -277,26 +277,25 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
{
case DISABLE_TYPE_SPELL:
{
- uint8 flags = itr->second.flags;
+ uint8 spellFlags = itr->second.flags;
if (unit)
{
-
- if ((flags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
- (unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && flags & SPELL_DISABLE_PET) || flags & SPELL_DISABLE_CREATURE)))
+ if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
+ (unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
{
- if (flags & SPELL_DISABLE_MAP)
+ if (spellFlags & SPELL_DISABLE_MAP)
{
std::set<uint32> const& mapIds = itr->second.params[0];
if (mapIds.find(unit->GetMapId()) != mapIds.end())
return true; // Spell is disabled on current map
- if (!(flags & SPELL_DISABLE_AREA))
+ if (!(spellFlags & SPELL_DISABLE_AREA))
return false; // Spell is disabled on another map, but not this one, return false
// Spell is disabled in an area, but not explicitly our current mapId. Continue processing.
}
- if (flags & SPELL_DISABLE_AREA)
+ if (spellFlags & SPELL_DISABLE_AREA)
{
std::set<uint32> const& areaIds = itr->second.params[1];
if (areaIds.find(unit->GetAreaId()) != areaIds.end())
@@ -309,8 +308,10 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
return false;
}
- else if (flags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
+ else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
return true;
+
+ break;
}
case DISABLE_TYPE_MAP:
if (Player const* player = unit->ToPlayer())
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index faa73cefb11..6815d73d1b3 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -71,6 +71,7 @@ DBCStorage <ChrRacesEntry> sChrRacesStore(ChrRacesEntryfmt);
DBCStorage <CinematicSequencesEntry> sCinematicSequencesStore(CinematicSequencesEntryfmt);
DBCStorage <CreatureDisplayInfoEntry> sCreatureDisplayInfoStore(CreatureDisplayInfofmt);
DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore(CreatureFamilyfmt);
+DBCStorage <CreatureModelDataEntry> sCreatureModelDataStore(CreatureModelDatafmt);
DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore(CreatureSpellDatafmt);
DBCStorage <CreatureTypeEntry> sCreatureTypeStore(CreatureTypefmt);
DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore(CurrencyTypesfmt);
@@ -292,6 +293,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc");
+ LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureTypeStore, dbcPath, "CreatureType.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sCurrencyTypesStore, dbcPath, "CurrencyTypes.dbc");
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index 367746616d1..7edfaad03f1 100755
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -81,6 +81,7 @@ extern DBCStorage <ChrRacesEntry> sChrRacesStore;
extern DBCStorage <CinematicSequencesEntry> sCinematicSequencesStore;
extern DBCStorage <CreatureDisplayInfoEntry> sCreatureDisplayInfoStore;
extern DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore;
+extern DBCStorage <CreatureModelDataEntry> sCreatureModelDataStore;
extern DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore;
extern DBCStorage <CreatureTypeEntry> sCreatureTypeStore;
extern DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore;
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index e01acd2e03d..ba7be495c77 100755
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -723,7 +723,7 @@ struct CinematicSequencesEntry
struct CreatureDisplayInfoEntry
{
uint32 Displayid; // 0 m_ID
- // 1 m_modelID
+ uint32 ModelId; // 1 m_modelID
// 2 m_soundID
// 3 m_extendedDisplayInfoID
float scale; // 4 m_creatureModelScale
@@ -754,6 +754,28 @@ struct CreatureFamilyEntry
// 27 m_iconFile
};
+struct CreatureModelDataEntry
+{
+ uint32 Id;
+ //uint32 Flags;
+ //char* ModelPath[16]
+ //uint32 Unk1;
+ float Scale; // Used in calculation of unit collision data
+ //int32 Unk2
+ //int32 Unk3
+ //uint32 Unk4
+ //uint32 Unk5
+ //float Unk6
+ //uint32 Unk7
+ //float Unk8
+ //uint32 Unk9
+ //uint32 Unk10
+ //float CollisionWidth;
+ float CollisionHeight;
+ float MountHeight; // Used in calculation of unit collision data when mounted
+ //float Unks[11]
+};
+
#define MAX_CREATURE_SPELL_DATA_SLOT 4
struct CreatureSpellDataEntry
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 5d33a3011ab..ac0b60d7f80 100755
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -38,8 +38,9 @@ const char ChatChannelsEntryfmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxx";
const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";
-const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx";
+const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx";
const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
+const char CreatureModelDatafmt[]="nxxxfxxxxxxxxxxffxxxxxxxxxxx";
const char CreatureSpellDatafmt[]="niiiixxxx";
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
const char CurrencyTypesfmt[]="xnxi";
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 52b41c0a0f7..55f798204db 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -159,12 +159,12 @@ void LFGMgr::Update(uint32 diff)
{
uint64 guid = itRoles->first;
ClearState(guid);
- if (Player* plr = ObjectAccessor::FindPlayer(guid))
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
{
- plr->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
+ player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
if (itRoles->first == roleCheck->leader)
- plr->GetSession()->SendLfgJoinResult(LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
+ player->GetSession()->SendLfgJoinResult(LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
}
}
delete roleCheck;
@@ -226,18 +226,18 @@ void LFGMgr::Update(uint32 diff)
{
guid = itPlayers->first;
SetState(guid, LFG_STATE_PROPOSAL);
- if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first))
+ if (Player* player = ObjectAccessor::FindPlayer(itPlayers->first))
{
- Group* grp = plr->GetGroup();
+ Group* grp = player->GetGroup();
if (grp)
{
uint64 gguid = grp->GetGUID();
SetState(gguid, LFG_STATE_PROPOSAL);
- plr->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
+ player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
}
else
- plr->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
- plr->GetSession()->SendLfgUpdateProposal(m_lfgProposalId, pProposal);
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
+ player->GetSession()->SendLfgUpdateProposal(m_lfgProposalId, pProposal);
}
}
@@ -254,7 +254,7 @@ void LFGMgr::Update(uint32 diff)
if (m_QueueTimer > LFG_QUEUEUPDATE_INTERVAL)
{
m_QueueTimer = 0;
- time_t currTime = time(NULL);
+ currTime = time(NULL);
for (LfgQueueInfoMap::const_iterator itQueue = m_QueueInfoMap.begin(); itQueue != m_QueueInfoMap.end(); ++itQueue)
{
LfgQueueInfo* queue = itQueue->second;
@@ -291,8 +291,8 @@ void LFGMgr::Update(uint32 diff)
}
for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
- if (Player* plr = ObjectAccessor::FindPlayer(itPlayer->first))
- plr->GetSession()->SendLfgQueueStatus(dungeonId, waitTime, m_WaitTimeAvg, m_WaitTimeTank, m_WaitTimeHealer, m_WaitTimeDps, queuedTime, queue->tanks, queue->healers, queue->dps);
+ if (Player* player = ObjectAccessor::FindPlayer(itPlayer->first))
+ player->GetSession()->SendLfgQueueStatus(dungeonId, waitTime, m_WaitTimeAvg, m_WaitTimeTank, m_WaitTimeHealer, m_WaitTimeDps, queuedTime, queue->tanks, queue->healers, queue->dps);
}
}
else
@@ -358,13 +358,13 @@ bool LFGMgr::RemoveFromQueue(uint64 guid)
/**
Generate the dungeon lock map for a given player
- @param[in] plr Player we need to initialize the lock status map
+ @param[in] player Player we need to initialize the lock status map
*/
-void LFGMgr::InitializeLockedDungeons(Player* plr)
+void LFGMgr::InitializeLockedDungeons(Player* player)
{
- uint64 guid = plr->GetGUID();
- uint8 level = plr->getLevel();
- uint8 expansion = plr->GetSession()->Expansion();
+ uint64 guid = player->GetGUID();
+ uint8 level = player->getLevel();
+ uint8 expansion = player->GetSession()->Expansion();
LfgDungeonSet dungeons = GetDungeonsByRandom(0);
LfgLockMap lock;
@@ -379,9 +379,9 @@ void LFGMgr::InitializeLockedDungeons(Player* plr)
LfgLockStatusType locktype = LFG_LOCKSTATUS_OK;
if (dungeon->expansion > expansion)
locktype = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
- else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, plr))
+ else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
locktype = LFG_LOCKSTATUS_RAID_LOCKED;
- else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && plr->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
+ else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
locktype = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->minlevel > level)
locktype = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
@@ -389,19 +389,19 @@ void LFGMgr::InitializeLockedDungeons(Player* plr)
locktype = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
else if (locktype == LFG_LOCKSTATUS_OK && ar)
{
- if (ar->achievement && !plr->GetAchievementMgr().HasAchieved(sAchievementStore.LookupEntry(ar->achievement)))
+ if (ar->achievement && !player->GetAchievementMgr().HasAchieved(sAchievementStore.LookupEntry(ar->achievement)))
locktype = LFG_LOCKSTATUS_RAID_LOCKED; // FIXME: Check the correct lock value
- else if (plr->GetTeam() == ALLIANCE && ar->quest_A && !plr->GetQuestRewardStatus(ar->quest_A))
+ else if (player->GetTeam() == ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A))
locktype = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
- else if (plr->GetTeam() == HORDE && ar->quest_H && !plr->GetQuestRewardStatus(ar->quest_H))
+ else if (player->GetTeam() == HORDE && ar->quest_H && !player->GetQuestRewardStatus(ar->quest_H))
locktype = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
else
if (ar->item)
{
- if (!plr->HasItemCount(ar->item, 1) && (!ar->item2 || !plr->HasItemCount(ar->item2, 1)))
+ if (!player->HasItemCount(ar->item, 1) && (!ar->item2 || !player->HasItemCount(ar->item2, 1)))
locktype = LFG_LOCKSTATUS_MISSING_ITEM;
}
- else if (ar->item2 && !plr->HasItemCount(ar->item2, 1))
+ else if (ar->item2 && !player->HasItemCount(ar->item2, 1))
locktype = LFG_LOCKSTATUS_MISSING_ITEM;
}
/* TODO VoA closed if WG is not under team control (LFG_LOCKSTATUS_RAID_LOCKED)
@@ -423,18 +423,18 @@ void LFGMgr::InitializeLockedDungeons(Player* plr)
of the group tying to join the group. Join conditions are checked before adding
to the new queue.
- @param[in] plr Player trying to join (or leader of group trying to join)
+ @param[in] player Player trying to join (or leader of group trying to join)
@param[in] roles Player selected roles
@param[in] dungeons Dungeons the player/group is applying for
@param[in] comment Player selected comment
*/
-void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment)
+void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment)
{
- if (!plr || !plr->GetSession() || selectedDungeons.empty())
+ if (!player || !player->GetSession() || selectedDungeons.empty())
return;
- Group* grp = plr->GetGroup();
- uint64 guid = plr->GetGUID();
+ Group* grp = player->GetGroup();
+ uint64 guid = player->GetGUID();
uint64 gguid = grp ? grp->GetGUID() : guid;
LfgJoinResultData joinData;
PlayerSet players;
@@ -457,7 +457,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
if (playerDungeons == dungeons) // Joining the same dungeons -- Send OK
{
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment);
- plr->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK
+ player->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK
if (grp)
{
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
@@ -471,11 +471,11 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
}
// Check player or group member restrictions
- if (plr->InBattleground() || plr->InArena() || plr->InBattlegroundQueue())
+ if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue())
joinData.result = LFG_JOIN_USING_BG_SYSTEM;
- else if (plr->HasAura(LFG_SPELL_DUNGEON_DESERTER))
+ else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER))
joinData.result = LFG_JOIN_DESERTER;
- else if (plr->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
+ else if (player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
joinData.result = LFG_JOIN_RANDOM_COOLDOWN;
else if (dungeons.empty())
joinData.result = LFG_JOIN_NOT_MEET_REQS;
@@ -505,7 +505,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
}
}
else
- players.insert(plr);
+ players.insert(player);
// Check if all dungeons are valid
bool isRaid = false;
@@ -559,7 +559,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joining with %u members. result: %u", guid, grp ? grp->GetMembersCount() : 1, joinData.result);
if (!dungeons.empty()) // Only should show lockmap when have no dungeons available
joinData.lockmap.clear();
- plr->GetSession()->SendLfgJoinResult(joinData);
+ player->GetSession()->SendLfgJoinResult(joinData);
return;
}
@@ -612,7 +612,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
// Queue player
LfgQueueInfo* pqInfo = new LfgQueueInfo();
pqInfo->joinTime = time_t(time(NULL));
- pqInfo->roles[plr->GetGUID()] = roles;
+ pqInfo->roles[player->GetGUID()] = roles;
pqInfo->dungeons = dungeons;
if (roles & ROLE_TANK)
--pqInfo->tanks;
@@ -623,8 +623,8 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
m_QueueInfoMap[guid] = pqInfo;
// Send update to player
- plr->GetSession()->SendLfgJoinResult(joinData);
- plr->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment));
+ player->GetSession()->SendLfgJoinResult(joinData);
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment));
SetState(gguid, LFG_STATE_QUEUED);
SetRoles(guid, roles);
if (!isContinue)
@@ -636,7 +636,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
}
SetSelectedDungeons(guid, dungeons);
}
- AddToQueue(guid, uint8(plr->GetTeam()));
+ AddToQueue(guid, uint8(player->GetTeam()));
}
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joined with %u members. dungeons: %u", guid, grp ? grp->GetMembersCount() : 1, uint8(dungeons.size()));
}
@@ -645,15 +645,15 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
Leaves Dungeon System. Player/Group is removed from queue, rolechecks, proposals
or votekicks. Player or group needs to be not NULL and using Dungeon System
- @param[in] plr Player trying to leave (can be NULL)
+ @param[in] player Player trying to leave (can be NULL)
@param[in] grp Group trying to leave (default NULL)
*/
-void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
+void LFGMgr::Leave(Player* player, Group* grp /* = NULL*/)
{
- if (!plr && !grp)
+ if (!player && !grp)
return;
- uint64 guid = grp ? grp->GetGUID() : plr->GetGUID();
+ uint64 guid = grp ? grp->GetGUID() : player->GetGUID();
LfgState state = GetState(guid);
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
@@ -676,7 +676,7 @@ void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
}
else
{
- plr->GetSession()->SendLfgUpdatePlayer(updateData);
+ player->GetSession()->SendLfgUpdatePlayer(updateData);
ClearState(guid);
}
}
@@ -689,10 +689,9 @@ void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
{
// Remove from Proposals
LfgProposalMap::iterator it = m_Proposals.begin();
- uint64 guid = plr ? plr->GetGUID() : grp->GetLeaderGUID();
while (it != m_Proposals.end())
{
- LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(guid);
+ LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(player ? player->GetGUID() : grp->GetLeaderGUID());
if (itPlayer != it->second->players.end())
{
// Mark the player/leader of group who left as didn't accept the proposal
@@ -866,22 +865,22 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
PlayerSet players;
for (LfgRolesMap::const_iterator it = rolesMap.begin(); it != rolesMap.end(); ++it)
{
- Player* plr = ObjectAccessor::FindPlayer(it->first);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(it->first);
+ if (!player)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Warning! [" UI64FMTD "] offline! Marking as not compatibles!", strGuids.c_str(), it->first);
else
{
- for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && plr; ++itPlayer)
+ for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && player; ++itPlayer)
{
// Do not form a group with ignoring candidates
- if (plr->GetSocial()->HasIgnore((*itPlayer)->GetGUIDLow()) || (*itPlayer)->GetSocial()->HasIgnore(plr->GetGUIDLow()))
+ if (player->GetSocial()->HasIgnore((*itPlayer)->GetGUIDLow()) || (*itPlayer)->GetSocial()->HasIgnore(player->GetGUIDLow()))
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Players [" UI64FMTD "] and [" UI64FMTD "] ignoring", strGuids.c_str(), (*itPlayer)->GetGUID(), plr->GetGUID());
- plr = NULL;
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Players [" UI64FMTD "] and [" UI64FMTD "] ignoring", strGuids.c_str(), (*itPlayer)->GetGUID(), player->GetGUID());
+ player = NULL;
}
}
- if (plr)
- players.insert(plr);
+ if (player)
+ players.insert(player);
}
}
@@ -1069,10 +1068,10 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
// Set queue roles needed - As we are using check_roles will not have more that 1 tank, 1 healer, 3 dps
for (LfgRolesMap::const_iterator it = check_roles.begin(); it != check_roles.end(); ++it)
{
- uint8 roles = it->second;
- if (roles & ROLE_TANK)
+ uint8 roles2 = it->second;
+ if (roles2 & ROLE_TANK)
--pqInfo->tanks;
- else if (roles & ROLE_HEALER)
+ else if (roles2 & ROLE_HEALER)
--pqInfo->healers;
else
--pqInfo->dps;
@@ -1152,14 +1151,14 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& pla
{
uint64 guid = (*it)->GetGUID();
LfgLockMap cachedLockMap = GetLockedDungeons(guid);
- for (LfgLockMap::const_iterator it = cachedLockMap.begin(); it != cachedLockMap.end() && dungeons.size(); ++it)
+ for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2)
{
- uint32 dungeonId = (it->first & 0x00FFFFFF); // Compare dungeon ids
+ uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
if (itDungeon != dungeons.end())
{
dungeons.erase(itDungeon);
- lockMap[guid][dungeonId] = it->second;
+ lockMap[guid][dungeonId] = it2->second;
}
}
}
@@ -1276,18 +1275,18 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
bool allAnswered = true;
for (LfgProposalPlayerMap::const_iterator itPlayers = pProposal->players.begin(); itPlayers != pProposal->players.end(); ++itPlayers)
{
- if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first))
+ if (Player* player = ObjectAccessor::FindPlayer(itPlayers->first))
{
if (itPlayers->first == pProposal->leader)
- players.push_front(plr);
+ players.push_front(player);
else
- players.push_back(plr);
+ players.push_back(player);
// Only teleport new players
- Group* grp = plr->GetGroup();
+ Group* grp = player->GetGroup();
uint64 gguid = grp ? grp->GetGUID() : 0;
if (!gguid || !grp->isLFGGroup() || GetState(gguid) == LFG_STATE_FINISHED_DUNGEON)
- playersToTeleport.push_back(plr);
+ playersToTeleport.push_back(player);
}
if (itPlayers->second->accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
@@ -1313,8 +1312,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
if (player->groupLowGuid != lowgroupguid)
sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid);
- uint64 guid = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
- LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
+ 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);
@@ -1329,31 +1328,31 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL;
for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
{
- Player* plr = (*it);
- uint64 pguid = plr->GetGUID();
- Group* group = plr->GetGroup();
+ Player* player = (*it);
+ uint64 pguid = player->GetGUID();
+ Group* group = player->GetGroup();
if (sendUpdate)
- plr->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
+ player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
if (group)
{
- plr->GetSession()->SendLfgUpdateParty(updateData);
+ player->GetSession()->SendLfgUpdateParty(updateData);
if (group != grp)
- plr->RemoveFromGroup();
+ player->RemoveFromGroup();
}
else
- plr->GetSession()->SendLfgUpdatePlayer(updateData);
+ player->GetSession()->SendLfgUpdatePlayer(updateData);
if (!grp)
{
grp = new Group();
- grp->Create(plr);
+ grp->Create(player);
grp->ConvertToLFG();
uint64 gguid = grp->GetGUID();
SetState(gguid, LFG_STATE_PROPOSAL);
sGroupMgr->AddGroup(grp);
}
else if (group != grp)
- grp->AddMember(plr);
+ grp->AddMember(player);
// Update timers
uint8 role = GetRoles(pguid);
@@ -1363,25 +1362,25 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
case ROLE_DAMAGE:
{
uint32 old_number = m_NumWaitTimeDps++;
- m_WaitTimeDps = int32((m_WaitTimeDps * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeDps);
+ m_WaitTimeDps = int32((m_WaitTimeDps * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeDps);
break;
}
case ROLE_HEALER:
{
uint32 old_number = m_NumWaitTimeHealer++;
- m_WaitTimeHealer = int32((m_WaitTimeHealer * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeHealer);
+ m_WaitTimeHealer = int32((m_WaitTimeHealer * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeHealer);
break;
}
case ROLE_TANK:
{
uint32 old_number = m_NumWaitTimeTank++;
- m_WaitTimeTank = int32((m_WaitTimeTank * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeTank);
+ m_WaitTimeTank = int32((m_WaitTimeTank * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeTank);
break;
}
default:
{
uint32 old_number = m_NumWaitTimeAvg++;
- m_WaitTimeAvg = int32((m_WaitTimeAvg * old_number + waitTimesMap[plr->GetGUID()]) / m_NumWaitTimeAvg);
+ m_WaitTimeAvg = int32((m_WaitTimeAvg * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeAvg);
break;
}
}
@@ -1399,10 +1398,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
// Remove players/groups from Queue
for (LfgGuidList::const_iterator it = pProposal->queues.begin(); it != pProposal->queues.end(); ++it)
- {
- uint64 guid = (*it);
- RemoveFromQueue(guid);
- }
+ RemoveFromQueue(*it);
// Teleport Player
for (LfgPlayerList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
@@ -1454,15 +1450,15 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
// Notify players
for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it)
{
- Player* plr = ObjectAccessor::FindPlayer(it->first);
- if (!plr)
+ Player* player = ObjectAccessor::FindPlayer(it->first);
+ if (!player)
continue;
- team = uint8(plr->GetTeam());
- plr->GetSession()->SendLfgUpdateProposal(itProposal->first, pProposal);
+ team = uint8(player->GetTeam());
+ player->GetSession()->SendLfgUpdateProposal(itProposal->first, pProposal);
- Group* grp = plr->GetGroup();
- uint64 guid = plr->GetGUID();
+ Group* grp = player->GetGroup();
+ uint64 guid = player->GetGUID();
uint64 gguid = it->second->groupLowGuid ? MAKE_NEW_GUID(it->second->groupLowGuid, 0, HIGHGUID_GROUP) : guid;
if (toRemove.find(gguid) != toRemove.end()) // Didn't accept or in same group that someone that didn't accept
@@ -1482,10 +1478,10 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
if (grp)
{
RestoreState(gguid);
- plr->GetSession()->SendLfgUpdateParty(updateData);
+ player->GetSession()->SendLfgUpdateParty(updateData);
}
else
- plr->GetSession()->SendLfgUpdatePlayer(updateData);
+ player->GetSession()->SendLfgUpdatePlayer(updateData);
}
else
{
@@ -1494,10 +1490,10 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
if (grp)
{
SetState(gguid, LFG_STATE_QUEUED);
- plr->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
+ player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
}
else
- plr->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
}
}
@@ -1572,17 +1568,17 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas
/**
Update Boot info with player answer
- @param[in] plr Player who has answered
+ @param[in] player Player who has answered
@param[in] accept player answer
*/
-void LFGMgr::UpdateBoot(Player* plr, bool accept)
+void LFGMgr::UpdateBoot(Player* player, bool accept)
{
- Group* grp = plr ? plr->GetGroup() : NULL;
+ Group* grp = player ? player->GetGroup() : NULL;
if (!grp)
return;
uint32 bootId = grp->GetLowGUID();
- uint64 guid = plr->GetGUID();
+ uint64 guid = player->GetGUID();
LfgPlayerBootMap::iterator itBoot = m_Boots.find(bootId);
if (itBoot == m_Boots.end())
@@ -1647,29 +1643,29 @@ void LFGMgr::UpdateBoot(Player* plr, bool accept)
/**
Teleports the player in or out the dungeon
- @param[in] plr Player to teleport
+ @param[in] player Player to teleport
@param[in] out Teleport out (true) or in (false)
@param[in] fromOpcode Function called from opcode handlers? (Default false)
*/
-void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
+void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", plr->GetGUID(), out ? "out" : "in");
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in");
if (out)
{
- plr->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
- plr->TeleportToBGEntryPoint();
+ 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 = plr->GetGroup();
+ Group* grp = player->GetGroup();
if (!grp || !grp->isLFGGroup()) // should never happen, but just in case...
error = LFG_TELEPORTERROR_INVALID_LOCATION;
- else if (!plr->isAlive())
+ else if (!player->isAlive())
error = LFG_TELEPORTERROR_PLAYER_DEAD;
- else if (plr->IsFalling() || plr->HasUnitState(UNIT_STAT_JUMPING))
+ else if (player->IsFalling() || player->HasUnitState(UNIT_STAT_JUMPING))
error = LFG_TELEPORTERROR_FALLING;
else
{
@@ -1678,7 +1674,7 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
if (!dungeon)
error = LFG_TELEPORTERROR_INVALID_LOCATION;
- else if (plr->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance
+ else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance
{
uint32 mapid = 0;
float x = 0;
@@ -1692,7 +1688,7 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && !mapid; itr = itr->next())
{
Player* plrg = itr->getSource();
- if (plrg && plrg != plr && plrg->GetMapId() == uint32(dungeon->map))
+ if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map))
{
mapid = plrg->GetMapId();
x = plrg->GetPositionX();
@@ -1708,7 +1704,7 @@ void LFGMgr::TeleportPlayer(Player* plr, 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", plr->GetGUID(), dungeon->map, dungeon->difficulty);
+ sLog->outError("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
@@ -1723,36 +1719,36 @@ void LFGMgr::TeleportPlayer(Player* plr, bool out, bool fromOpcode /*= false*/)
if (error == LFG_TELEPORTERROR_OK)
{
- if (!plr->GetMap()->IsDungeon() && !plr->GetMap()->IsRaid())
- plr->SetBattlegroundEntryPoint();
+ if (!player->GetMap()->IsDungeon() && !player->GetMap()->IsRaid())
+ player->SetBattlegroundEntryPoint();
- if (plr->isInFlight())
+ if (player->isInFlight())
{
- plr->GetMotionMaster()->MovementExpired();
- plr->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
- if (plr->TeleportTo(mapid, x, y, z, orientation))
+ if (player->TeleportTo(mapid, x, y, z, orientation))
// FIXME - HACK - this should be done by teleport, when teleporting far
- plr->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
else
{
error = LFG_TELEPORTERROR_INVALID_LOCATION;
- sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", plr->GetGUID(), mapid);
+ sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid);
}
}
}
}
if (error != LFG_TELEPORTERROR_OK)
- plr->GetSession()->SendLfgTeleportError(uint8(error));
+ player->GetSession()->SendLfgTeleportError(uint8(error));
}
/**
Give completion reward to player
@param[in] dungeonId Id of the dungeon finished
- @param[in] plr Player to reward
+ @param[in] player Player to reward
*/
void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player)
{
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 300268ed7c8..95cb2e81869 100755
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -268,8 +268,8 @@ class LFGMgr
LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
// Queue
- void Join(Player* plr, uint8 roles, const LfgDungeonSet& dungeons, const std::string& comment);
- void Leave(Player* plr, Group* grp = NULL);
+ void Join(Player* player, uint8 roles, const LfgDungeonSet& dungeons, const std::string& comment);
+ void Leave(Player* player, Group* grp = NULL);
// Role Check
void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = ROLE_NONE);
@@ -278,20 +278,21 @@ class LFGMgr
void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
// Teleportation
- void TeleportPlayer(Player* plr, bool out, bool fromOpcode = false);
+ void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
// Vote kick
void InitBoot(Group* grp, uint64 kguid, uint64 vguid, std::string reason);
- void UpdateBoot(Player* plr, bool accept);
+ void UpdateBoot(Player* player, bool accept);
void OfferContinue(Group* grp);
- void InitializeLockedDungeons(Player* plr);
+ void InitializeLockedDungeons(Player* player);
void SetComment(uint64 guid, const std::string& comment);
const LfgLockMap& GetLockedDungeons(uint64 guid);
LfgState GetState(uint64 guid);
const LfgDungeonSet& GetSelectedDungeons(uint64 guid);
uint32 GetDungeon(uint64 guid, bool asId = true);
+ void SetState(uint64 guid, LfgState state);
void ClearState(uint64 guid);
void RemovePlayerData(uint64 guid);
void RemoveGroupData(uint64 guid);
@@ -304,7 +305,6 @@ class LFGMgr
uint8 GetRoles(uint64 guid);
const std::string& GetComment(uint64 gguid);
void RestoreState(uint64 guid);
- void SetState(uint64 guid, LfgState state);
void SetDungeon(uint64 guid, uint32 dungeon);
void SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons);
void SetLockedDungeons(uint64 guid, const LfgLockMap& lock);
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 23eb10a98ae..42119a02ef8 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -51,8 +51,8 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid)
sLFGMgr->Leave(NULL, group);
if (sLFGMgr->GetState(guid) == LFG_STATE_QUEUED)
- if (Player* plr = ObjectAccessor::FindPlayer(guid))
- sLFGMgr->Leave(plr);
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ sLFGMgr->Leave(player);
}
void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason)
@@ -82,7 +82,8 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method,
}
sLFGMgr->ClearState(guid);
- if (Player* plr = ObjectAccessor::FindPlayer(guid))
+ sLFGMgr->SetState(guid, LFG_STATE_NONE);
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
{
/*
if (method == GROUP_REMOVEMETHOD_LEAVE)
@@ -92,9 +93,9 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method,
*/
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
- plr->GetSession()->SendLfgUpdateParty(updateData);
- if (plr->GetMap()->IsDungeon()) // Teleport player out the dungeon
- sLFGMgr->TeleportPlayer(plr, true);
+ player->GetSession()->SendLfgUpdateParty(updateData);
+ if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon
+ sLFGMgr->TeleportPlayer(player, true);
}
if (sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon
@@ -116,17 +117,17 @@ void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLe
return;
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
- Player* plr = ObjectAccessor::FindPlayer(newLeaderGuid);
+ Player* player = ObjectAccessor::FindPlayer(newLeaderGuid);
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
- if (plr)
- plr->GetSession()->SendLfgUpdateParty(updateData);
+ if (player)
+ player->GetSession()->SendLfgUpdateParty(updateData);
- plr = ObjectAccessor::FindPlayer(oldLeaderGuid);
- if (plr)
+ player = ObjectAccessor::FindPlayer(oldLeaderGuid);
+ if (player)
{
updateData.updateType = LFG_UPDATETYPE_GROUP_DISBAND;
- plr->GetSession()->SendLfgUpdateParty(updateData);
+ player->GetSession()->SendLfgUpdateParty(updateData);
}
}
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 3d6eaf1a198..922db88bcd0 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -787,16 +787,11 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
LastUsedScriptID = GetCreatureInfo()->ScriptID;
// TODO: Replace with spell, handle from DB
- if (isSpiritHealer())
+ if (isSpiritHealer() || isSpiritGuide())
{
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
}
- else if (isSpiritGuide())
- {
- m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST | GHOST_VISIBILITY_ALIVE);
- m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST | GHOST_VISIBILITY_ALIVE);
- }
if (Entry == VISUAL_WAYPOINT)
SetVisible(false);
@@ -1438,14 +1433,14 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
return IsWithinLOSInMap(who);
}
-float Creature::GetAttackDistance(Unit const* pl) const
+float Creature::GetAttackDistance(Unit const* player) const
{
float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
if (aggroRate == 0)
return 0.0f;
- uint32 playerlevel = pl->getLevelForTarget(this);
- uint32 creaturelevel = getLevelForTarget(pl);
+ uint32 playerlevel = player->getLevelForTarget(this);
+ uint32 creaturelevel = getLevelForTarget(player);
int32 leveldif = int32(playerlevel) - int32(creaturelevel);
@@ -1466,7 +1461,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
RetDistance += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
// detected range auras
- RetDistance += pl->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
+ RetDistance += player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
}
// "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 9f5d8ec202e..665942e134a 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -156,7 +156,7 @@ struct CreatureTemplate
else if (type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
return SKILL_MINING;
else if (type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
- return SKILL_ENGINERING;
+ return SKILL_ENGINEERING;
else
return SKILL_SKINNING; // normal case
}
@@ -607,7 +607,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
CreatureSpellCooldowns m_CreatureCategoryCooldowns;
bool canStartAttack(Unit const* u, bool force) const;
- float GetAttackDistance(Unit const* pl) const;
+ float GetAttackDistance(Unit const* player) const;
void SendAIReaction(AiReaction reactionType);
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 90011dbae22..5bf7910466c 100755
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -337,13 +337,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
data << uint32(quest->GetRewChoiceItemsCount());
for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
- if (!quest->RewChoiceItemId[i])
+ if (!quest->RewardChoiceItemId[i])
continue;
- data << uint32(quest->RewChoiceItemId[i]);
- data << uint32(quest->RewChoiceItemCount[i]);
+ data << uint32(quest->RewardChoiceItemId[i]);
+ data << uint32(quest->RewardChoiceItemCount[i]);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewChoiceItemId[i]))
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0x00);
@@ -353,13 +353,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
for (uint32 i=0; i < QUEST_REWARDS_COUNT; ++i)
{
- if (!quest->RewItemId[i])
+ if (!quest->RewardItemId[i])
continue;
- data << uint32(quest->RewItemId[i]);
- data << uint32(quest->RewItemCount[i]);
+ data << uint32(quest->RewardItemId[i]);
+ data << uint32(quest->RewardItemIdCount[i]);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewItemId[i]))
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
@@ -380,13 +380,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
data << uint32(0); // unk
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- data << uint32(quest->RewRepFaction[i]);
+ data << uint32(quest->RewardFactionId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- data << int32(quest->RewRepValueId[i]);
+ data << int32(quest->RewardFactionValueId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- data << int32(quest->RewRepValue[i]);
+ data << int32(quest->RewardFactionValueIdOverride[i]);
data << uint32(QUEST_EMOTE_COUNT);
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
@@ -478,24 +478,24 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
{
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
- data << uint32(quest->RewItemId[i]);
- data << uint32(quest->RewItemCount[i]);
+ data << uint32(quest->RewardItemId[i]);
+ data << uint32(quest->RewardItemIdCount[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
- data << uint32(quest->RewChoiceItemId[i]);
- data << uint32(quest->RewChoiceItemCount[i]);
+ data << uint32(quest->RewardChoiceItemId[i]);
+ data << uint32(quest->RewardChoiceItemCount[i]);
}
}
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
- data << uint32(quest->RewRepFaction[i]);
+ data << uint32(quest->RewardFactionId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc?
- data << int32(quest->RewRepValueId[i]);
+ data << int32(quest->RewardFactionValueId[i]);
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0)
- data << int32(quest->RewRepValue[i]);
+ data << int32(quest->RewardFactionValueIdOverride[i]);
data << quest->GetPointMapId();
data << quest->GetPointX();
@@ -510,20 +510,20 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
- if (quest->ReqCreatureOrGOId[i] < 0)
- data << uint32((quest->ReqCreatureOrGOId[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000)
+ if (quest->RequiredNpcOrGo[i] < 0)
+ data << uint32((quest->RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000)
else
- data << uint32(quest->ReqCreatureOrGOId[i]);
+ data << uint32(quest->RequiredNpcOrGo[i]);
- data << uint32(quest->ReqCreatureOrGOCount[i]);
- data << uint32(quest->ReqSourceId[i]);
+ data << uint32(quest->RequiredNpcOrGoCount[i]);
+ data << uint32(quest->RequiredSourceItemid[i]);
data << uint32(0); // req source count?
}
for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- data << uint32(quest->ReqItemId[i]);
- data << uint32(quest->ReqItemCount[i]);
+ data << uint32(quest->RequiredItemId[i]);
+ data << uint32(quest->RequiredItemCount[i]);
}
for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
@@ -576,10 +576,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(quest->GetRewChoiceItemsCount());
for (uint32 i=0; i < quest->GetRewChoiceItemsCount(); ++i)
{
- data << uint32(quest->RewChoiceItemId[i]);
- data << uint32(quest->RewChoiceItemCount[i]);
+ data << uint32(quest->RewardChoiceItemId[i]);
+ data << uint32(quest->RewardChoiceItemCount[i]);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewChoiceItemId[i]))
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
@@ -588,10 +588,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(quest->GetRewItemsCount());
for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
{
- data << uint32(quest->RewItemId[i]);
- data << uint32(quest->RewItemCount[i]);
+ data << uint32(quest->RewardItemId[i]);
+ data << uint32(quest->RewardItemIdCount[i]);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewItemId[i]))
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
@@ -612,13 +612,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(0);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
- data << uint32(quest->RewRepFaction[i]);
+ data << uint32(quest->RewardFactionId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
- data << int32(quest->RewRepValueId[i]);
+ data << int32(quest->RewardFactionValueId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override?
- data << uint32(quest->RewRepValue[i]);
+ data << uint32(quest->RewardFactionValueIdOverride[i]);
_session->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
@@ -676,13 +676,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
data << uint32(quest->GetReqItemsCount());
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- if (!quest->ReqItemId[i])
+ if (!quest->RequiredItemId[i])
continue;
- data << uint32(quest->ReqItemId[i]);
- data << uint32(quest->ReqItemCount[i]);
+ data << uint32(quest->RequiredItemId[i]);
+ data << uint32(quest->RequiredItemCount[i]);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ReqItemId[i]))
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index a894ee16c2d..9e514ad34bb 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -91,27 +91,31 @@ void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
RemoveFromWorld();
if (m_uint32Values) // field array can be not exist if GameOBject not loaded
- {
- // Possible crash at access to deleted GO in Unit::m_gameobj
- if (uint64 owner_guid = GetOwnerGUID())
- {
- Unit* owner = ObjectAccessor::GetUnit(*this, owner_guid);
+ RemoveFromOwner();
+}
- if (owner)
- owner->RemoveGameObject(this, false);
- else
- {
- const char * ownerType = "creature";
- if (IS_PLAYER_GUID(owner_guid))
- ownerType = "player";
- else if (IS_PET_GUID(owner_guid))
- ownerType = "pet";
-
- sLog->outError("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(owner_guid), ownerType);
- }
- }
+void GameObject::RemoveFromOwner()
+{
+ uint64 ownerGUID = GetOwnerGUID();
+ if (!ownerGUID)
+ return;
+
+ if (Unit* owner = ObjectAccessor::GetUnit(*this, ownerGUID))
+ {
+ owner->RemoveGameObject(this, false);
+ ASSERT(!GetOwnerGUID());
+ return;
}
+
+ const char * ownerType = "creature";
+ if (IS_PLAYER_GUID(ownerGUID))
+ ownerType = "player";
+ 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.",
+ GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);
+ SetOwnerGUID(0);
}
void GameObject::AddToWorld()
@@ -135,14 +139,7 @@ void GameObject::RemoveFromWorld()
if (m_zoneScript)
m_zoneScript->OnGameObjectRemove(this);
- // Possible crash at access to deleted GO in Unit::m_gameobj
- if (uint64 owner_guid = GetOwnerGUID())
- {
- if (Unit* owner = GetOwner())
- owner->RemoveGameObject(this, false);
- else
- sLog->outError("Delete GameObject (GUID: %u Entry: %u, Name: %s) that have references in not found creature %u GO list. Crash possible later.", GetGUIDLow(), GetGOInfo()->entry, GetGOInfo()->name.c_str(), GUID_LOPART(owner_guid));
- }
+ RemoveFromOwner();
WorldObject::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
}
@@ -601,15 +598,8 @@ void GameObject::AddUniqueUse(Player* player)
void GameObject::Delete()
{
SetLootState(GO_NOT_READY);
- if (GetOwnerGUID())
- {
- if (Unit* owner = GetOwner())
- owner->RemoveGameObject(this, false);
- else //! Owner not in world anymore
- SetOwnerGUID(0);
- }
+ RemoveFromOwner();
- ASSERT (!GetOwnerGUID());
SendObjectDeSpawnAnim(GetGUID());
SetGoState(GO_STATE_READY);
@@ -1284,8 +1274,9 @@ void GameObject::Use(Unit* user)
{
player->UpdateFishingSkill();
+ //TODO: I do not understand this hack. Need some explanation.
// prevent removing GO at spell cancel
- player->RemoveGameObject(this, false);
+ RemoveFromOwner();
SetOwnerGUID(player->GetGUID());
//TODO: find reasonable value for fishing hole search
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 13b410d7373..9167b40d285 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -815,6 +815,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
private:
+ void RemoveFromOwner();
void SwitchDoorOrButton(bool activate, bool alternative = false);
//! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size.
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 3bbe06dd4fb..978d9accb64 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -780,13 +780,13 @@ void Object::ClearUpdateMask(bool remove)
}
}
-void Object::BuildFieldsUpdate(Player* pl, UpdateDataMapType& data_map) const
+void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) const
{
- UpdateDataMapType::iterator iter = data_map.find(pl);
+ UpdateDataMapType::iterator iter = data_map.find(player);
if (iter == data_map.end())
{
- std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(pl, UpdateData()));
+ std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(player, UpdateData()));
ASSERT(p.second);
iter = p.first;
}
@@ -1273,6 +1273,8 @@ void WorldObject::setActive(bool on)
void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
{
+ if (IsInWorld())
+ RemoveFromWorld();
}
void WorldObject::_Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
@@ -2723,19 +2725,19 @@ void WorldObject::DestroyForNearbyPlayers()
VisitNearbyWorldObject(GetVisibilityRange(), searcher);
for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
- Player* plr = (*iter);
+ Player* player = (*iter);
- if (plr == this)
+ if (player == this)
continue;
- if (!plr->HaveAtClient(this))
+ if (!player->HaveAtClient(this))
continue;
- if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == plr->GetGUID()) // TODO: this is for puppet
+ if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == player->GetGUID()) // TODO: this is for puppet
continue;
- DestroyForPlayer(plr);
- plr->m_clientGUIDs.erase(GetGUID());
+ DestroyForPlayer(player);
+ player->m_clientGUIDs.erase(GetGUID());
}
}
@@ -2803,13 +2805,13 @@ struct WorldObjectChangeAccumulator
}
}
- void BuildPacket(Player* plr)
+ void BuildPacket(Player* player)
{
// Only send update once to a player
- if (plr_list.find(plr->GetGUID()) == plr_list.end() && plr->HaveAtClient(&i_object))
+ if (plr_list.find(player->GetGUID()) == plr_list.end() && player->HaveAtClient(&i_object))
{
- i_object.BuildFieldsUpdate(plr, i_updateDatas);
- plr_list.insert(plr->GetGUID());
+ i_object.BuildFieldsUpdate(player, i_updateDatas);
+ plr_list.insert(player->GetGUID());
}
}
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index dfcf6a3cfa4..eab4dbeba99 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -527,9 +527,11 @@ template<class T>
class GridObject
{
public:
- GridReference<T> &GetGridRef() { return m_gridRef; }
- protected:
- GridReference<T> m_gridRef;
+ bool IsInGrid() const { return _gridRef.isValid(); }
+ void AddToGrid(GridRefManager<T>& m) { ASSERT(!IsInGrid()); _gridRef.link(&m, (T*)this); }
+ void RemoveFromGrid() { ASSERT(IsInGrid()); _gridRef.unlink(); }
+ private:
+ GridReference<T> _gridRef;
};
template <class T_VALUES, class T_FLAGS, class FLAG_TYPE, uint8 ARRAY_SIZE>
@@ -667,12 +669,17 @@ class WorldObject : public Object, public WorldLocation
}
float GetDistanceZ(const WorldObject* obj) const;
+ bool IsSelfOrInSameMap(const WorldObject* obj) const
+ {
+ if (this == obj)
+ return true;
+ return IsInMap(obj);
+ }
bool IsInMap(const WorldObject* obj) const
{
if (obj)
return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj);
- else
- return false;
+ return false;
}
bool IsWithinDist3d(float x, float y, float z, float dist) const
{ return IsInDist(x, y, z, dist + GetObjectSize()); }
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 82c551c2374..404fe24d467 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -382,29 +382,29 @@ void Pet::SavePetToDB(PetSaveMode mode)
// current/stable/not_in_slot
if (mode >= PET_SAVE_AS_CURRENT)
{
- uint32 owner = GUID_LOPART(GetOwnerGUID());
+ uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID());
std::string name = m_name;
CharacterDatabase.EscapeString(name);
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ trans = CharacterDatabase.BeginTransaction();
// remove current data
- trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner, m_charmInfo->GetPetNumber());
+ trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", ownerLowGUID, m_charmInfo->GetPetNumber());
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
if (mode <= PET_SAVE_LAST_STABLE_SLOT)
trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'",
- PET_SAVE_NOT_IN_SLOT, owner, uint32(mode));
+ PET_SAVE_NOT_IN_SLOT, ownerLowGUID, uint32(mode));
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
- if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
+ if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT))
trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')",
- owner, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
+ ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
// save pet
std::ostringstream ss;
ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) "
<< "VALUES ("
<< m_charmInfo->GetPetNumber() << ','
<< GetEntry() << ','
- << owner << ','
+ << ownerLowGUID << ','
<< GetNativeDisplayId() << ','
<< uint32(getLevel()) << ','
<< GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ','
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 27713586b54..401e965f816 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -279,10 +279,8 @@ uint32 PlayerTaxi::GetCurrentTaxiPath() const
std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
{
- ss << '\'';
for (uint8 i = 0; i < TaxiMaskSize; ++i)
ss << taxi.m_taximask[i] << ' ';
- ss << '\'';
return ss;
}
@@ -940,7 +938,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
return false;
}
- SetMap(sMapMgr->CreateMap(info->mapId, this, 0));
+ SetMap(sMapMgr->CreateMap(info->mapId, this));
uint8 powertype = cEntry->powerType;
@@ -2020,21 +2018,20 @@ bool Player::ToggleDND()
return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND);
}
-uint8 Player::chatTag() const
+uint8 Player::GetChatTag() const
{
- // it's bitmask
- // 0x8 - ??
- // 0x4 - gm
- // 0x2 - dnd
- // 0x1 - afk
+ uint8 tag = CHAT_TAG_NONE;
+
if (isGMChat())
- return 4;
- else if (isDND())
- return 3;
+ tag |= CHAT_TAG_GM;
+ if (isDND())
+ tag |= CHAT_TAG_DND;
if (isAFK())
- return 1;
- else
- return 0;
+ tag |= CHAT_TAG_AFK;
+ if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
+ tag |= CHAT_TAG_DEV;
+
+ return tag;
}
void Player::SendTeleportPacket(Position &oldPos)
@@ -2206,8 +2203,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (!sMapMgr->CanPlayerEnter(mapid, this, false))
return false;
- Map* map = sMapMgr->CreateMap(mapid, this, 0);
- if (!map || map->CanEnter(this))
+ //I think this always returns true. Correct me if I am wrong.
+ // If the map is not created, assume it is possible to enter it.
+ // It will be created in the WorldPortAck.
+ //Map* map = sMapMgr->FindBaseNonInstanceMap(mapid);
+ //if (!map || map->CanEnter(this))
{
//lets reset near teleport flag if it wasn't reset during chained teleports
SetSemaphoreTeleportNear(false);
@@ -2278,7 +2278,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// remove from old map now
if (oldmap)
- oldmap->RemoveFromMap(this, false);
+ oldmap->RemovePlayerFromMap(this, false);
// new final coordinates
float final_x = x;
@@ -2316,8 +2316,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet
SetSemaphoreTeleportFar(true);
}
- else
- return false;
+ //else
+ // return false;
}
return true;
}
@@ -3088,7 +3088,8 @@ void Player::GiveLevel(uint8 level)
// Refer-A-Friend
if (GetSession()->GetRecruiterId())
if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
- if (level % 2 == 0) {
+ if (level % 2 == 0)
+ {
++m_grantableLevels;
if (!HasByteFlag(PLAYER_FIELD_BYTES, 1, 0x01))
@@ -3483,7 +3484,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
if (!rankSpellId || rankSpellId == spell_id)
continue;
- PlayerTalentMap::iterator itr = m_talents[spec]->find(rankSpellId);
+ itr = m_talents[spec]->find(rankSpellId);
if (itr != m_talents[spec]->end())
itr->second->state = PLAYERSPELL_REMOVED;
}
@@ -4093,8 +4094,6 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain(spell_id))
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
-
// if talent then lesser rank also talent and need learn
if (talentCosts)
{
@@ -4242,8 +4241,8 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
if (Pet* pet = GetPet())
{
// notify player
- for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
- SendClearCooldown(itr->first, pet);
+ for (CreatureSpellCooldowns::const_iterator itr2 = pet->m_CreatureSpellCooldowns.begin(); itr2 != pet->m_CreatureSpellCooldowns.end(); ++itr2)
+ SendClearCooldown(itr2->first, pet);
// actually clear cooldowns
pet->m_CreatureSpellCooldowns.clear();
@@ -4396,9 +4395,9 @@ bool Player::resetTalents(bool no_cost)
RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
- for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
+ for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
{
- TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
+ TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
if (!talentInfo)
continue;
@@ -4834,14 +4833,14 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
{
do
{
- Field* fields = resultItems->Fetch();
- uint32 item_guidlow = fields[11].GetUInt32();
- uint32 item_template = fields[12].GetUInt32();
+ Field* fields2 = resultItems->Fetch();
+ uint32 item_guidlow = fields2[11].GetUInt32();
+ uint32 item_template = fields2[12].GetUInt32();
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_template);
if (!itemProto)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
stmt->setUInt32(0, item_guidlow);
trans->Append(stmt);
continue;
@@ -5088,8 +5087,6 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);
- setDeathState(ALIVE);
-
SetMovement(MOVE_LAND_WALK);
SetMovement(MOVE_UNROOT);
@@ -5119,6 +5116,8 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
// update visibility
UpdateObjectVisibility();
+ setDeathState(ALIVE);
+
if (!applySickness)
return;
@@ -6227,11 +6226,11 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
return false;
}
-void Player::UpdateWeaponSkill (WeaponAttackType attType)
+void Player::UpdateWeaponSkill(WeaponAttackType attType)
{
// no skill gain in pvp
- Unit* pVictim = getVictim();
- if (pVictim && pVictim->GetTypeId() == TYPEID_PLAYER)
+ Unit* victim = getVictim();
+ if (victim && victim->GetTypeId() == TYPEID_PLAYER)
return;
if (IsInFeralForm())
@@ -6240,42 +6239,25 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
if (GetShapeshiftForm() == FORM_TREE)
return; // use weapon but not skill up
- if (pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
+ if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
return;
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
- switch (attType)
- {
- case BASE_ATTACK:
- {
- Item* tmpitem = GetWeaponForAttack(attType, true);
+ Item* tmpitem = GetWeaponForAttack(attType, true);
+ if (!tmpitem && attType == BASE_ATTACK)
+ UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
+ else if (tmpitem && tmpitem->GetTemplate()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
+ UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
- if (!tmpitem)
- UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
- else if (tmpitem->GetTemplate()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
- UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
- break;
- }
- case OFF_ATTACK:
- case RANGED_ATTACK:
- {
- Item* tmpitem = GetWeaponForAttack(attType, true);
- if (tmpitem)
- UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
- break;
- }
- default:
- break;
- }
UpdateAllCritPercentages();
}
-void Player::UpdateCombatSkills(Unit* pVictim, WeaponAttackType attType, bool defence)
+void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence)
{
- uint8 plevel = getLevel(); // if defense than pVictim == attacker
+ uint8 plevel = getLevel(); // if defense than victim == attacker
uint8 greylevel = Trinity::XP::GetGrayLevel(plevel);
- uint8 moblevel = pVictim->getLevelForTarget(this);
+ uint8 moblevel = victim->getLevelForTarget(this);
if (moblevel < greylevel)
return;
@@ -7034,22 +7016,22 @@ void Player::RewardReputation(Quest const* quest)
// quest reputation reward/loss
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
- if (!quest->RewRepFaction[i])
+ if (!quest->RewardFactionId[i])
continue;
- if (quest->RewRepValue[i])
+ if (quest->RewardFactionValueIdOverride[i])
{
- int32 rep = CalculateReputationGain(GetQuestLevel(quest), quest->RewRepValue[i]/100, quest->RewRepFaction[i], true, true);
+ int32 rep = CalculateReputationGain(GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true, true);
if (recruitAFriend)
rep = int32(rep * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
- if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewRepFaction[i]))
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
GetReputationMgr().ModifyReputation(factionEntry, rep);
}
else
{
- uint32 row = ((quest->RewRepValueId[i] < 0) ? 1 : 0) + 1;
- uint32 field = abs(quest->RewRepValueId[i]);
+ uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1;
+ uint32 field = abs(quest->RewardFactionValueId[i]);
if (const QuestFactionRewEntry* pRow = sQuestFactionRewardStore.LookupEntry(row))
{
@@ -7058,12 +7040,12 @@ void Player::RewardReputation(Quest const* quest)
if (!repPoints)
continue;
- repPoints = CalculateReputationGain(GetQuestLevel(quest), repPoints, quest->RewRepFaction[i], true);
+ repPoints = CalculateReputationGain(GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
if (recruitAFriend)
repPoints = int32(repPoints * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
- if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(quest->RewRepFaction[i]))
+ if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
GetReputationMgr().ModifyReputation(factionEntry, repPoints);
}
}
@@ -14532,7 +14514,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
bool Player::CanSeeStartQuest(Quest const* quest)
{
- if (SatisfyQuestRace(quest, false) && SatisfyQuestSkillOrClass(quest, false) &&
+ if (SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) && SatisfyQuestSkill(quest, false) &&
SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
@@ -14547,8 +14529,8 @@ bool Player::CanSeeStartQuest(Quest const* quest)
bool Player::CanTakeQuest(Quest const* quest, bool msg)
{
return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
- && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
- && SatisfyQuestSkillOrClass(quest, msg) && SatisfyQuestReputation(quest, msg)
+ && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
+ && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
@@ -14607,7 +14589,7 @@ bool Player::CanCompleteQuest(uint32 quest_id)
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
- if (qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i])
+ if (qInfo->RequiredItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->RequiredItemCount[i])
return false;
}
}
@@ -14616,10 +14598,10 @@ bool Player::CanCompleteQuest(uint32 quest_id)
{
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
{
- if (qInfo->ReqCreatureOrGOId[i] == 0)
+ if (qInfo->RequiredNpcOrGo[i] == 0)
continue;
- if (qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i])
+ if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->RequiredNpcOrGoCount[i])
return false;
}
}
@@ -14660,7 +14642,7 @@ bool Player::CanCompleteRepeatableQuest(Quest const* quest)
if (quest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
- if (quest->ReqItemId[i] && quest->ReqItemCount[i] && !HasItemCount(quest->ReqItemId[i], quest->ReqItemCount[i]))
+ if (quest->RequiredItemId[i] && quest->RequiredItemCount[i] && !HasItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i]))
return false;
if (!CanRewardQuest(quest, false))
@@ -14688,11 +14670,11 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg)
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
- if (quest->ReqItemCount[i]!= 0 &&
- GetItemCount(quest->ReqItemId[i]) < quest->ReqItemCount[i])
+ if (quest->RequiredItemCount[i]!= 0 &&
+ GetItemCount(quest->RequiredItemId[i]) < quest->RequiredItemCount[i])
{
if (msg)
- SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, quest->ReqItemId[i]);
+ SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, quest->RequiredItemId[i]);
return false;
}
}
@@ -14713,13 +14695,13 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg)
if (quest->GetRewChoiceItemsCount() > 0)
{
- if (quest->RewChoiceItemId[reward])
+ if (quest->RewardChoiceItemId[reward])
{
ItemPosCountVec dest;
- InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewChoiceItemId[reward], quest->RewChoiceItemCount[reward]);
+ InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardChoiceItemId[reward], quest->RewardChoiceItemCount[reward]);
if (res != EQUIP_ERR_OK)
{
- SendEquipError(res, NULL, NULL, quest->RewChoiceItemId[reward]);
+ SendEquipError(res, NULL, NULL, quest->RewardChoiceItemId[reward]);
return false;
}
}
@@ -14729,13 +14711,13 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg)
{
for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
{
- if (quest->RewItemId[i])
+ if (quest->RewardItemId[i])
{
ItemPosCountVec dest;
- InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewItemId[i], quest->RewItemCount[i]);
+ InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardItemId[i], quest->RewardItemIdCount[i]);
if (res != EQUIP_ERR_OK)
{
- SendEquipError(res, NULL, NULL, quest->RewItemId[i]);
+ SendEquipError(res, NULL, NULL, quest->RewardItemId[i]);
return false;
}
}
@@ -14868,15 +14850,15 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
uint32 quest_id = quest->GetQuestId();
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- if (quest->ReqItemId[i])
- DestroyItemCount(quest->ReqItemId[i], quest->ReqItemCount[i], true);
+ if (quest->RequiredItemId[i])
+ DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
- if (quest->ReqSourceId[i])
+ if (quest->RequiredSourceItemid[i])
{
- uint32 count = quest->ReqSourceCount[i];
- DestroyItemCount(quest->ReqSourceId[i], count ? count : 9999, true);
+ uint32 count = quest->RequiredSourceItemId[i];
+ DestroyItemCount(quest->RequiredSourceItemid[i], count ? count : 9999, true);
}
}
@@ -14884,13 +14866,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
if (quest->GetRewChoiceItemsCount() > 0)
{
- if (uint32 itemId = quest->RewChoiceItemId[reward])
+ if (uint32 itemId = quest->RewardChoiceItemId[reward])
{
ItemPosCountVec dest;
- if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewChoiceItemCount[reward]) == EQUIP_ERR_OK)
+ if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardChoiceItemCount[reward]) == EQUIP_ERR_OK)
{
Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
- SendNewItem(item, quest->RewChoiceItemCount[reward], true, false);
+ SendNewItem(item, quest->RewardChoiceItemCount[reward], true, false);
}
}
}
@@ -14899,13 +14881,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
{
for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
{
- if (uint32 itemId = quest->RewItemId[i])
+ if (uint32 itemId = quest->RewardItemId[i])
{
ItemPosCountVec dest;
- if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewItemCount[i]) == EQUIP_ERR_OK)
+ if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemIdCount[i]) == EQUIP_ERR_OK)
{
Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
- SendNewItem(item, quest->RewItemCount[i], true, false);
+ SendNewItem(item, quest->RewardItemIdCount[i], true, false);
}
}
}
@@ -15069,57 +15051,31 @@ void Player::FailQuest(uint32 questId)
// Destroy quest items on quest failure.
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- if (quest->ReqItemId[i] > 0 && quest->ReqItemCount[i] > 0)
+ if (quest->RequiredItemId[i] > 0 && quest->RequiredItemCount[i] > 0)
// Destroy items recieved on starting the quest.
- DestroyItemCount(quest->ReqItemId[i], quest->ReqItemCount[i], true, true);
+ DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true, true);
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- if (quest->ReqSourceId[i] > 0 && quest->ReqSourceCount[i] > 0)
+ if (quest->RequiredSourceItemid[i] > 0 && quest->RequiredSourceItemId[i] > 0)
// Destroy items recieved during the quest.
- DestroyItemCount(quest->ReqSourceId[i], quest->ReqSourceCount[i], true, true);
+ DestroyItemCount(quest->RequiredSourceItemid[i], quest->RequiredSourceItemId[i], true, true);
}
}
-bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg)
+bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const
{
- int32 zoneOrSort = qInfo->GetZoneOrSort();
- int32 skillOrClassMask = qInfo->GetSkillOrClassMask();
+ uint32 skill = qInfo->GetRequiredSkill();
- // skip zone zoneOrSort and 0 case skillOrClass
- if (zoneOrSort >= 0 && skillOrClassMask == 0)
+ // skip 0 case RequiredSkill
+ if (skill == 0)
return true;
- int32 questSort = -zoneOrSort;
- uint8 reqSortClass = ClassByQuestSort(questSort);
-
- // check class sort cases in zoneOrSort
- if (reqSortClass != 0 && getClass() != reqSortClass)
+ // check skill value
+ if (GetSkillValue(skill) < qInfo->GetRequiredSkillValue())
{
if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
- // check class
- if (skillOrClassMask < 0)
- {
- uint32 reqClassMask = -int32(skillOrClassMask);
- if (!(reqClassMask & getClassMask()))
- {
- if (msg)
- SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
- }
- // check skill
- else if (skillOrClassMask > 0)
- {
- uint32 reqSkill = skillOrClassMask;
- if (GetSkillValue(reqSkill) < qInfo->GetRequiredSkillValue())
- {
- if (msg)
- SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
+ return false;
}
return true;
@@ -15247,6 +15203,24 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
return false;
}
+bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const
+{
+ uint32 reqClass = qInfo->GetRequiredClasses();
+
+ if (reqClass == 0)
+ return true;
+
+ if ((reqClass & getClassMask()) == 0)
+ {
+ if (msg)
+ SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+
+ return false;
+ }
+
+ return true;
+}
+
bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg)
{
uint32 reqraces = qInfo->GetRequiredRaces();
@@ -15504,7 +15478,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
// exist two cases when destroy source quest item not possible:
// a) non un-equippable item (equipped non-empty bag, for example)
// b) when quest is started from an item and item also is needed in
- // the end as ReqItemId
+ // the end as RequiredItemId
InventoryResult res = CanUnequipItems(srcItemId, count);
if (res != EQUIP_ERR_OK)
{
@@ -15514,7 +15488,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
}
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
- if (item->StartQuest == questId && srcItemId == quest->ReqItemId[n])
+ if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
destroyItem = false;
if (destroyItem)
@@ -15606,7 +15580,7 @@ uint16 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry)
return 0;
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
- if (qInfo->ReqCreatureOrGOId[j] == entry)
+ if (qInfo->RequiredNpcOrGo[j] == entry)
return m_QuestStatus[quest_id].m_creatureOrGOcount[j];
return 0;
@@ -15618,10 +15592,10 @@ void Player::AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questS
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- uint32 reqitemcount = quest->ReqItemCount[i];
+ uint32 reqitemcount = quest->RequiredItemCount[i];
if (reqitemcount != 0)
{
- uint32 curitemcount = GetItemCount(quest->ReqItemId[i], true);
+ uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true);
questStatusData.m_itemcount[i] = std::min(curitemcount, reqitemcount);
m_QuestStatusSave[quest->GetQuestId()] = true;
@@ -15696,10 +15670,10 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count)
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
{
- uint32 reqitem = qInfo->ReqItemId[j];
+ uint32 reqitem = qInfo->RequiredItemId[j];
if (reqitem == entry)
{
- uint32 reqitemcount = qInfo->ReqItemCount[j];
+ uint32 reqitemcount = qInfo->RequiredItemCount[j];
uint16 curitemcount = q_status.m_itemcount[j];
if (curitemcount < reqitemcount)
{
@@ -15734,12 +15708,12 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
{
- uint32 reqitem = qInfo->ReqItemId[j];
+ uint32 reqitem = qInfo->RequiredItemId[j];
if (reqitem == entry)
{
QuestStatusData& q_status = m_QuestStatus[questid];
- uint32 reqitemcount = qInfo->ReqItemCount[j];
+ uint32 reqitemcount = qInfo->RequiredItemCount[j];
uint16 curitemcount;
if (q_status.m_status != QUEST_STATUS_COMPLETE)
curitemcount = q_status.m_itemcount[j];
@@ -15803,18 +15777,18 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
// skip GO activate objective or none
- if (qInfo->ReqCreatureOrGOId[j] <= 0)
+ if (qInfo->RequiredNpcOrGo[j] <= 0)
continue;
// skip Cast at creature objective
- if (qInfo->ReqSpell[j] != 0)
+ if (qInfo->RequiredSpellCast[j] != 0)
continue;
- uint32 reqkill = qInfo->ReqCreatureOrGOId[j];
+ uint32 reqkill = qInfo->RequiredNpcOrGo[j];
if (reqkill == real_entry)
{
- uint32 reqkillcount = qInfo->ReqCreatureOrGOCount[j];
+ uint32 reqkillcount = qInfo->RequiredNpcOrGoCount[j];
uint16 curkillcount = q_status.m_creatureOrGOcount[j];
if (curkillcount < reqkillcount)
{
@@ -15900,7 +15874,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
// skip kill creature objective (0) or wrong spell casts
- if (qInfo->ReqSpell[j] != spell_id)
+ if (qInfo->RequiredSpellCast[j] != spell_id)
continue;
uint32 reqTarget = 0;
@@ -15908,32 +15882,32 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
if (isCreature)
{
// creature activate objectives
- if (qInfo->ReqCreatureOrGOId[j] > 0)
+ if (qInfo->RequiredNpcOrGo[j] > 0)
{
// checked at quest_template loading
- reqTarget = qInfo->ReqCreatureOrGOId[j];
+ reqTarget = qInfo->RequiredNpcOrGo[j];
if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template
{
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
- for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
- if (cinfo->KillCredit[i] == reqTarget)
- entry = cinfo->KillCredit[i];
+ for (uint8 j = 0; j < MAX_KILL_CREDIT; ++j)
+ if (cinfo->KillCredit[j] == reqTarget)
+ entry = cinfo->KillCredit[j];
}
}
}
else
{
// GO activate objective
- if (qInfo->ReqCreatureOrGOId[j] < 0)
+ if (qInfo->RequiredNpcOrGo[j] < 0)
// checked at quest_template loading
- reqTarget = - qInfo->ReqCreatureOrGOId[j];
+ reqTarget = - qInfo->RequiredNpcOrGo[j];
}
// other not this creature/GO related objectives
if (reqTarget != entry)
continue;
- uint32 reqCastCount = qInfo->ReqCreatureOrGOCount[j];
+ uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j];
uint16 curCastCount = q_status.m_creatureOrGOcount[j];
if (curCastCount < reqCastCount)
{
@@ -15977,20 +15951,20 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid)
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
// skip spell casts and Gameobject objectives
- if (qInfo->ReqSpell[j] > 0 || qInfo->ReqCreatureOrGOId[j] < 0)
+ if (qInfo->RequiredSpellCast[j] > 0 || qInfo->RequiredNpcOrGo[j] < 0)
continue;
uint32 reqTarget = 0;
- if (qInfo->ReqCreatureOrGOId[j] > 0) // creature activate objectives
+ if (qInfo->RequiredNpcOrGo[j] > 0) // creature activate objectives
// checked at quest_template loading
- reqTarget = qInfo->ReqCreatureOrGOId[j];
+ reqTarget = qInfo->RequiredNpcOrGo[j];
else
continue;
if (reqTarget == entry)
{
- uint32 reqTalkCount = qInfo->ReqCreatureOrGOCount[j];
+ uint32 reqTalkCount = qInfo->RequiredNpcOrGoCount[j];
uint16 curTalkCount = q_status.m_creatureOrGOcount[j];
if (curTalkCount < reqTalkCount)
{
@@ -16127,14 +16101,14 @@ bool Player::HasQuestForItem(uint32 itemid) const
// This part for ReqItem drop
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
{
- if (itemid == qinfo->ReqItemId[j] && q_status.m_itemcount[j] < qinfo->ReqItemCount[j])
+ if (itemid == qinfo->RequiredItemId[j] && q_status.m_itemcount[j] < qinfo->RequiredItemCount[j])
return true;
}
// This part - for ReqSource
for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
{
// examined item is a source item
- if (qinfo->ReqSourceId[j] == itemid)
+ if (qinfo->RequiredSourceItemid[j] == itemid)
{
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
@@ -16143,9 +16117,9 @@ bool Player::HasQuestForItem(uint32 itemid) const
return true;
// allows custom amount drop when not 0
- if (qinfo->ReqSourceCount[j])
+ if (qinfo->RequiredSourceItemId[j])
{
- if (GetItemCount(itemid, true) < qinfo->ReqSourceCount[j])
+ if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemId[j])
return true;
} else if (GetItemCount(itemid, true) < pProto->GetMaxStackSize())
return true;
@@ -16218,7 +16192,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id)
}
}
-void Player::SendCanTakeQuestResponse(uint32 msg)
+void Player::SendCanTakeQuestResponse(uint32 msg) const
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4);
data << uint32(msg);
@@ -16263,7 +16237,7 @@ void Player::SendQuestUpdateAddItem(Quest const* /*quest*/, uint32 /*item_idx*/,
{
WorldPacket data(SMSG_QUESTUPDATE_ADD_ITEM, 0);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM");
- //data << quest->ReqItemId[item_idx];
+ //data << quest->RequiredItemId[item_idx];
//data << count;
GetSession()->SendPacket(&data);
}
@@ -16272,7 +16246,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin
{
ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)");
- int32 entry = quest->ReqCreatureOrGOId[ creatureOrGO_idx ];
+ int32 entry = quest->RequiredNpcOrGo[ creatureOrGO_idx ];
if (entry < 0)
// client expected gameobject template id in form (id|0x80000000)
entry = (-entry) | 0x80000000;
@@ -16282,7 +16256,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin
data << uint32(quest->GetQuestId());
data << uint32(entry);
data << uint32(old_count + add_count);
- data << uint32(quest->ReqCreatureOrGOCount[ creatureOrGO_idx ]);
+ data << uint32(quest->RequiredNpcOrGoCount[ creatureOrGO_idx ]);
data << uint64(guid);
GetSession()->SendPacket(&data);
@@ -16808,7 +16782,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// NOW player must have valid map
// load the player's map here if it's not already loaded
- Map* map = sMapMgr->CreateMap(mapId, this, instanceId);
+ Map* map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
@@ -16826,14 +16800,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
RelocateToHomebind();
}
- map = sMapMgr->CreateMap(mapId, this, 0);
+ map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
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());
- map = sMapMgr->CreateMap(mapId, this, 0);
+ 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());
@@ -17554,7 +17528,7 @@ void Player::_LoadMailedItems(Mail* mail)
{
sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), item_guid_low, item_template, mail->messageID);
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
stmt->setUInt32(0, item_guid_low);
CharacterDatabase.Execute(stmt);
continue;
@@ -18281,7 +18255,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
/*** SAVE SYSTEM ***/
/*********************************************************/
-void Player::SaveToDB()
+void Player::SaveToDB(bool create /*=false*/)
{
// delay auto save at any saves (manual, in code, or autosave)
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
@@ -18299,156 +18273,228 @@ void Player::SaveToDB()
sLog->outDebug(LOG_FILTER_UNITS, "The value of player %s at save: ", m_name.c_str());
outDebugValues();
- std::string sql_name = m_name;
- CharacterDatabase.EscapeString(sql_name);
+ PreparedStatement* stmt = NULL;
+ uint16 index = 0;
- std::ostringstream ss;
- ss << "REPLACE INTO characters (guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
- "map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, "
- "taximask, online, cinematic, "
- "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
- "trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
- "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
- "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
- "power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels) VALUES ("
- << GetGUIDLow() << ','
- << GetSession()->GetAccountId() << ", '"
- << sql_name << "', "
- << uint32(getRace()) << ','
- << uint32(getClass()) << ','
- << uint32(getGender()) << ','
- << uint32(getLevel()) << ','
- << GetUInt32Value(PLAYER_XP) << ','
- << GetMoney() << ','
- << GetUInt32Value(PLAYER_BYTES) << ','
- << GetUInt32Value(PLAYER_BYTES_2) << ','
- << GetUInt32Value(PLAYER_FLAGS) << ',';
-
- if (!IsBeingTeleported())
- {
- ss << GetMapId() << ','
- << (uint32)GetInstanceId() << ','
- << uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ','
- << finiteAlways(GetPositionX()) << ','
- << finiteAlways(GetPositionY()) << ','
- << finiteAlways(GetPositionZ()) << ','
- << finiteAlways(GetOrientation()) << ',';
- }
- else
+ if (create)
{
- ss << GetTeleportDest().GetMapId() << ','
- << (uint32)0 << ','
- << uint32(uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4) << ','
- << finiteAlways(GetTeleportDest().GetPositionX()) << ','
- << finiteAlways(GetTeleportDest().GetPositionY()) << ','
- << finiteAlways(GetTeleportDest().GetPositionZ()) << ','
- << finiteAlways(GetTeleportDest().GetOrientation()) << ',';
- }
-
- ss << m_taxi << ','; // string with TaxiMaskSize numbers
-
- ss << (IsInWorld() ? 1 : 0) << ',';
-
- ss << uint32(m_cinematic) << ',';
+ //! Insert query
+ //! TO DO: Filter out more redundant fields that can take their default value at player create
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHARACTER);
+ stmt->setUInt32(index++, GetGUIDLow());
+ stmt->setUInt32(index++, GetSession()->GetAccountId());
+ stmt->setString(index++, GetName());
+ stmt->setUInt8(index++, getRace());
+ stmt->setUInt8(index++, getClass());
+ stmt->setUInt8(index++, getGender());
+ stmt->setUInt8(index++, getLevel());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_XP));
+ stmt->setUInt32(index++, GetMoney());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES_2));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
+ stmt->setUInt16(index++, (uint16)GetMapId());
+ stmt->setUInt32(index++, (uint32)GetInstanceId());
+ stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
+ stmt->setFloat(index++, finiteAlways(GetPositionX()));
+ stmt->setFloat(index++, finiteAlways(GetPositionY()));
+ stmt->setFloat(index++, finiteAlways(GetPositionZ()));
+ stmt->setFloat(index++, finiteAlways(GetOrientation()));
+
+ std::ostringstream ss;
+ ss << m_taxi;
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, m_cinematic);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
+ stmt->setFloat(index++, finiteAlways(m_rest_bonus));
+ stmt->setUInt32(index++, uint32(time(NULL)));
+ stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
+ //save, far from tavern/city
+ //save, but in tavern/city
+ stmt->setUInt32(index++, m_resetTalentsCost);
+ stmt->setUInt32(index++, m_resetTalentsTime);
+ stmt->setUInt16(index++, (uint16)m_ExtraFlags);
+ stmt->setUInt8(index++, m_stableSlots);
+ stmt->setUInt16(index++, (uint16)m_atLoginFlags);
+ stmt->setUInt16(index++, GetZoneId());
+ stmt->setUInt32(index++, m_deathExpireTime);
+
+ ss.str("");
+ ss << m_taxi.SaveTaxiDestinationsToString();
+
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetArenaPoints());
+ stmt->setUInt32(index++, GetHonorPoints());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
+ 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->setUInt32(index++, GetHealth());
+
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
+ stmt->setUInt32(index++, GetPower(Powers(i)));
+
+ stmt->setUInt32(index++, GetSession()->GetLatency());
+
+ stmt->setUInt8(index++, m_specsCount);
+ stmt->setUInt8(index++, m_activeSpec);
+
+ ss.str("");
+ for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
+ stmt->setString(index++, ss.str());
+
+ ss.str("");
+ // cache equipment...
+ for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
+ ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
+
+ // ...and bags for enum opcode
+ for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
+ {
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ ss << item->GetEntry();
+ else
+ ss << '0';
+ ss << " 0 ";
+ }
- ss << m_Played_time[PLAYED_TIME_TOTAL] << ',';
- ss << m_Played_time[PLAYED_TIME_LEVEL] << ',';
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
- ss << finiteAlways(m_rest_bonus) << ',';
- ss << uint32(time(NULL)) << ',';
- ss << (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0) << ',';
- //save, far from tavern/city
- //save, but in tavern/city
- ss << m_resetTalentsCost << ',';
- ss << uint32(m_resetTalentsTime) << ',';
+ ss.str("");
+ for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
+ ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << ' ';
- ss << finiteAlways(m_movementInfo.t_pos.GetPositionX()) << ',';
- ss << finiteAlways(m_movementInfo.t_pos.GetPositionY()) << ',';
- ss << finiteAlways(m_movementInfo.t_pos.GetPositionZ()) << ',';
- ss << finiteAlways(m_movementInfo.t_pos.GetOrientation()) << ',';
- if (m_transport)
- ss << m_transport->GetGUIDLow();
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
+ stmt->setUInt32(index++, m_grantableLevels);
+ }
else
- ss << '0';
- ss << ',';
-
- ss << m_ExtraFlags << ',';
-
- ss << uint32(m_stableSlots) << ','; // to prevent save uint8 as char
-
- ss << uint32(m_atLoginFlags) << ',';
-
- ss << GetZoneId() << ',';
-
- ss << uint32(m_deathExpireTime) << ", '";
-
- ss << m_taxi.SaveTaxiDestinationsToString() << "', ";
-
- ss << GetArenaPoints() << ',';
-
- ss << GetHonorPoints() << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION) << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION) << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) << ',';
-
- ss << GetUInt16Value(PLAYER_FIELD_KILLS, 0) << ',';
-
- ss << GetUInt16Value(PLAYER_FIELD_KILLS, 1) << ',';
-
- ss << GetUInt32Value(PLAYER_CHOSEN_TITLE) << ',';
-
- ss << GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES) << ',';
-
- ss << GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX) << ',';
-
- ss << (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE) << ',';
-
- ss << GetHealth();
-
- for (uint32 i = 0; i < MAX_POWERS; ++i)
- ss << ',' << GetPower(Powers(i));
- ss << ',';
- ss << GetSession()->GetLatency();
- ss << ',';
- ss << uint32(m_specsCount);
- ss << ',';
- ss << uint32(m_activeSpec) << ", '";
- for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
- ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
-
- // cache equipment...
- ss << "', '";
- for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
- ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
-
- // ...and bags for enum opcode
- for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{
- if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- ss << item->GetEntry();
+ // Update query
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER);
+ stmt->setString(index++, GetName());
+ stmt->setUInt8(index++, getRace());
+ stmt->setUInt8(index++, getClass());
+ stmt->setUInt8(index++, getGender());
+ stmt->setUInt8(index++, getLevel());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_XP));
+ stmt->setUInt32(index++, GetMoney());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES_2));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
+
+ if (!IsBeingTeleported())
+ {
+ stmt->setUInt16(index++, (uint16)GetMapId());
+ stmt->setUInt32(index++, (uint32)GetInstanceId());
+ stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
+ stmt->setFloat(index++, finiteAlways(GetPositionX()));
+ stmt->setFloat(index++, finiteAlways(GetPositionY()));
+ stmt->setFloat(index++, finiteAlways(GetPositionZ()));
+ stmt->setFloat(index++, finiteAlways(GetOrientation()));
+ }
else
- ss << '0';
- ss << " 0 ";
- }
+ {
+ stmt->setUInt16(index++, (uint16)GetTeleportDest().GetMapId());
+ stmt->setUInt32(index++, (uint32)0);
+ stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionX()));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionY()));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionZ()));
+ stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetOrientation()));
+ }
+
+ std::ostringstream ss;
+ ss << m_taxi;
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, m_cinematic);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
+ stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
+ stmt->setFloat(index++, finiteAlways(m_rest_bonus));
+ stmt->setUInt32(index++, uint32(time(NULL)));
+ stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
+ //save, far from tavern/city
+ //save, but in tavern/city
+ stmt->setUInt32(index++, m_resetTalentsCost);
+ stmt->setUInt32(index++, m_resetTalentsTime);
+ stmt->setUInt16(index++, (uint16)m_ExtraFlags);
+ stmt->setUInt8(index++, m_stableSlots);
+ stmt->setUInt16(index++, (uint16)m_atLoginFlags);
+ stmt->setUInt16(index++, GetZoneId());
+ stmt->setUInt32(index++, m_deathExpireTime);
+
+ ss.str("");
+ ss << m_taxi.SaveTaxiDestinationsToString();
+
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetArenaPoints());
+ stmt->setUInt32(index++, GetHonorPoints());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
+ stmt->setUInt16(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
+ 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->setUInt32(index++, GetHealth());
+
+ for (uint32 i = 0; i < MAX_POWERS; ++i)
+ stmt->setUInt32(index++, GetPower(Powers(i)));
+
+ stmt->setUInt32(index++, GetSession()->GetLatency());
+
+ stmt->setUInt8(index++, m_specsCount);
+ stmt->setUInt8(index++, m_activeSpec);
+
+ ss.str("");
+ for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
+ stmt->setString(index++, ss.str());
+
+ ss.str("");
+ // cache equipment...
+ for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
+ ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' ';
+
+ // ...and bags for enum opcode
+ for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
+ {
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ ss << item->GetEntry();
+ else
+ ss << '0';
+ ss << " 0 ";
+ }
- ss << "',";
+ stmt->setString(index++, ss.str());
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID));
- ss << GetUInt32Value(PLAYER_AMMO_ID) << ", '";
- for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
- ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << ' ';
+ ss.str("");
+ for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i)
+ ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << ' ';
- ss << "',";
- ss << uint32(GetByteValue(PLAYER_FIELD_BYTES, 2));
- ss << ",";
- ss << uint32(m_grantableLevels);
- ss << ')';
+ stmt->setString(index++, ss.str());
+ stmt->setUInt8(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
+ stmt->setUInt32(index++, m_grantableLevels);
+
+ stmt->setUInt8(index++, IsInWorld() ? 1 : 0);
+ // Index
+ stmt->setUInt32(index++, GetGUIDLow());
+ }
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- trans->Append(ss.str().c_str());
+ trans->Append(stmt);
if (m_mailsUpdated) //save mails only when needed
_SaveMail(trans);
@@ -19357,7 +19403,7 @@ inline void Player::BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std:
*data << uint64(GetGUID());
*data << uint32(text.length() + 1);
*data << text;
- *data << uint8(chatTag());
+ *data << uint8(GetChatTag());
}
void Player::Say(const std::string& text, const uint32 language)
@@ -20141,9 +20187,9 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
if (sWorld->getBoolConfig(CONFIG_INSTANT_TAXI))
{
- TaxiNodesEntry const* lastnode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]);
+ TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]);
m_taxi.ClearTaxiDestinations();
- TeleportTo(lastnode->map_id, lastnode->x, lastnode->y, lastnode->z, GetOrientation());
+ TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation());
return false;
}
else
@@ -22018,10 +22064,10 @@ bool Player::HasQuestForGO(int32 GOId) const
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
- if (qinfo->ReqCreatureOrGOId[j] >= 0) //skip non GO case
+ if (qinfo->RequiredNpcOrGo[j] >= 0) //skip non GO case
continue;
- if ((-1)*GOId == qinfo->ReqCreatureOrGOId[j] && qs.m_creatureOrGOcount[j] < qinfo->ReqCreatureOrGOCount[j])
+ if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.m_creatureOrGOcount[j] < qinfo->RequiredNpcOrGoCount[j])
return true;
}
}
@@ -22868,7 +22914,6 @@ bool Player::CanCaptureTowerPoint()
}
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin)
-
{
uint8 level = getLevel();
@@ -24346,9 +24391,9 @@ void Player::ActivateSpec(uint8 spec)
// Let client clear his current Actions
SendActionButtons(2);
// m_actionButtons.clear() is called in the next _LoadActionButtons
- for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
+ for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
{
- TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
+ TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
if (!talentInfo)
continue;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 7d0803a4c8a..651b99e7cb4 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -395,10 +395,10 @@ enum PlayerFlags
PLAYER_FLAGS_NO_XP_GAIN = 0x02000000,
PLAYER_FLAGS_UNK26 = 0x04000000,
PLAYER_FLAGS_UNK27 = 0x08000000,
- PLAYER_FLAGS_UNK28 = 0x01000000,
- PLAYER_FLAGS_UNK29 = 0x02000000,
- PLAYER_FLAGS_UNK30 = 0x04000000,
- PLAYER_FLAGS_UNK31 = 0x08000000,
+ PLAYER_FLAGS_UNK28 = 0x10000000,
+ PLAYER_FLAGS_UNK29 = 0x20000000,
+ PLAYER_FLAGS_UNK30 = 0x40000000,
+ PLAYER_FLAGS_UNK31 = 0x80000000,
};
// used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
@@ -768,6 +768,16 @@ enum EnviromentalDamage
DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
};
+enum PlayerChatTag
+{
+ CHAT_TAG_NONE = 0x00,
+ CHAT_TAG_AFK = 0x01,
+ CHAT_TAG_DND = 0x02,
+ CHAT_TAG_GM = 0x04,
+ CHAT_TAG_COM = 0x08, // Commentator
+ CHAT_TAG_DEV = 0x10,
+};
+
enum PlayedTimeIndex
{
PLAYED_TIME_TOTAL = 0,
@@ -1125,7 +1135,7 @@ class Player : public Unit, public GridObject<Player>
bool ToggleDND();
bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
- uint8 chatTag() const;
+ uint8 GetChatTag() const;
std::string afkMsg;
std::string dndMsg;
@@ -1400,10 +1410,11 @@ class Player : public Unit, public GridObject<Player>
void IncompleteQuest(uint32 quest_id);
void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
void FailQuest(uint32 quest_id);
- bool SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg);
+ bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
bool SatisfyQuestLevel(Quest const* qInfo, bool msg);
bool SatisfyQuestLog(bool msg);
bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg);
+ bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
bool SatisfyQuestRace(Quest const* qInfo, bool msg);
bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
bool SatisfyQuestStatus(Quest const* qInfo, bool msg);
@@ -1483,7 +1494,7 @@ class Player : public Unit, public GridObject<Player>
void SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver);
void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
void SendQuestTimerFailed(uint32 quest_id);
- void SendCanTakeQuestResponse(uint32 msg);
+ void SendCanTakeQuestResponse(uint32 msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint32 msg);
void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count);
@@ -1520,7 +1531,7 @@ class Player : public Unit, public GridObject<Player>
/*** SAVE SYSTEM ***/
/*********************************************************/
- void SaveToDB();
+ void SaveToDB(bool create = false);
void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
void SaveGoldToDB(SQLTransaction& trans);
@@ -2290,6 +2301,7 @@ class Player : public Unit, public GridObject<Player>
m_mover = target;
m_mover->m_movedPlayer = this;
}
+
void SetSeer(WorldObject* target) { m_seer = target; }
void SetViewpoint(WorldObject* target, bool apply);
WorldObject* GetViewpoint() const;
@@ -2328,7 +2340,7 @@ class Player : public Unit, public GridObject<Player>
bool IsNeverVisible() const;
- bool IsVisibleGloballyFor(Player* pl) const;
+ bool IsVisibleGloballyFor(Player* player) const;
void SendInitialVisiblePackets(Unit* target);
void UpdateObjectVisibility(bool forced = true);
@@ -2483,6 +2495,41 @@ class Player : public Unit, public GridObject<Player>
void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); }
bool IsInWhisperWhiteList(uint64 guid);
+ //! Return collision height sent to client
+ float GetCollisionHeight(bool mounted)
+ {
+ if (mounted)
+ {
+ CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID));
+ if (!mountDisplayInfo)
+ return GetCollisionHeight(false);
+
+ CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId);
+ if (!mountModelData)
+ return GetCollisionHeight(false);
+
+ CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
+ ASSERT(displayInfo);
+ CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
+ ASSERT(modelData);
+
+ float scaleMod = GetFloatValue(OBJECT_FIELD_SCALE_X); // 99% sure about this
+
+ return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f;
+ }
+ else
+ {
+ //! Dismounting case - use basic default model data
+ CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
+ ASSERT(displayInfo);
+ CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
+ ASSERT(modelData);
+
+ return modelData->CollisionHeight;
+ }
+ //! TODO: Need a proper calculation for collision height when mounted
+ }
+
protected:
// Gamemaster whisper whitelist
WhisperListContainer WhisperList;
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index 4d343d02146..dbb18496515 100755
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
@@ -114,23 +114,23 @@ void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note)
m_playerSocialMap[friend_guid].Note = note;
}
-void PlayerSocial::SendSocialList(Player* plr)
+void PlayerSocial::SendSocialList(Player* player)
{
- if (!plr)
+ if (!player)
return;
uint32 size = m_playerSocialMap.size();
WorldPacket data(SMSG_CONTACT_LIST, (4+4+size*25)); // just can guess size
- data << uint32(7); // unk flag (0x1, 0x2, 0x4), 0x7 if it include ignore list
+ data << uint32(7); // 0x1 = Friendlist update. 0x2 = Ignorelist update. 0x4 = Mutelist update.
data << uint32(size); // friends count
for (PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
{
- sSocialMgr->GetFriendInfo(plr, itr->first, itr->second);
+ sSocialMgr->GetFriendInfo(player, itr->first, itr->second);
data << uint64(itr->first); // player guid
- data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?)
+ data << uint32(itr->second.Flags); // player flag (0x1 = Friend, 0x2 = Ignored, 0x4 = Muted)
data << itr->second.Note; // string note
if (itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend()
{
@@ -144,7 +144,7 @@ void PlayerSocial::SendSocialList(Player* plr)
}
}
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST");
}
diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h
index 5faa8f1987c..78965c13948 100755
--- a/src/server/game/Entities/Player/SocialMgr.h
+++ b/src/server/game/Entities/Player/SocialMgr.h
@@ -124,7 +124,7 @@ class PlayerSocial
void RemoveFromSocialList(uint32 friend_guid, bool ignore);
void SetFriendNote(uint32 friend_guid, std::string note);
// Packet send's
- void SendSocialList(Player* plr);
+ void SendSocialList(Player* player);
// Misc
bool HasFriend(uint32 friend_guid);
bool HasIgnore(uint32 ignore_guid);
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 28d916fe0af..b92e1ad21dc 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -98,7 +98,7 @@ void MapManager::LoadTransports()
m_TransportsByMap[*i].insert(t);
//If we someday decide to use the grid to track transports, here:
- t->SetMap(sMapMgr->CreateMap(mapid, t, 0));
+ t->SetMap(sMapMgr->CreateBaseMap(mapid));
t->AddToWorld();
++count;
@@ -365,9 +365,9 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
if (keyFrames[keyFrames.size() - 1].node->mapid != keyFrames[0].node->mapid)
teleport = true;
- WayPoint pos(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
+ m_WayPoints[0] = WayPoint(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
keyFrames[0].node->arrivalEventID, keyFrames[0].node->departureEventID);
- m_WayPoints[0] = pos;
+
t += keyFrames[0].node->delay * 1000;
uint32 cM = keyFrames[0].node->mapid;
@@ -387,12 +387,11 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
if (d > 0)
{
- float newX, newY, newZ;
- newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
- newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
- newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
+ float newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
+ float newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
+ float newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
- bool teleport = false;
+ teleport = false;
if (keyFrames[i].node->mapid != cM)
{
teleport = true;
@@ -400,9 +399,8 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
}
// sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
- WayPoint pos(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
if (teleport)
- m_WayPoints[t] = pos;
+ m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
}
if (tFrom < tTo) // caught in tFrom dock's "gravitational pull"
@@ -439,25 +437,18 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
else
t += (long)keyFrames[i + 1].tTo % 100;
- bool teleport = false;
+ teleport = false;
if ((keyFrames[i + 1].node->actionFlag == 1) || (keyFrames[i + 1].node->mapid != keyFrames[i].node->mapid))
{
teleport = true;
cM = keyFrames[i + 1].node->mapid;
}
- WayPoint pos(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
+ 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);
-/*
- if (keyFrames[i+1].delay > 5)
- pos.delayed = true;
-*/
- //if (teleport)
- m_WayPoints[t] = pos;
t += keyFrames[i + 1].node->delay * 1000;
- // sLog->outString("------");
}
uint32 timer = t;
@@ -489,13 +480,13 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();)
{
- Player* plr = *itr;
+ Player* player = *itr;
++itr;
- if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
- plr->ResurrectPlayer(1.0f);
+ if (player->isDead() && !player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ player->ResurrectPlayer(1.0f);
- plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
+ player->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
}
//we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference...
@@ -503,7 +494,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
RemoveFromWorld();
ResetMap();
- Map* newMap = sMapMgr->CreateMap(newMapid, this, 0);
+ Map* newMap = sMapMgr->CreateBaseMap(newMapid);
SetMap(newMap);
ASSERT (GetMap());
AddToWorld();
@@ -584,13 +575,13 @@ void Transport::Update(uint32 p_diff)
void Transport::UpdateForMap(Map const* targetMap)
{
- Map::PlayerList const& pl = targetMap->GetPlayers();
- if (pl.isEmpty())
+ Map::PlayerList const& player = targetMap->GetPlayers();
+ if (player.isEmpty())
return;
if (GetMapId() == targetMap->GetId())
{
- for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
+ for (Map::PlayerList::const_iterator itr = player.begin(); itr != player.end(); ++itr)
{
if (this != itr->getSource()->GetTransport())
{
@@ -609,7 +600,7 @@ void Transport::UpdateForMap(Map const* targetMap)
WorldPacket out_packet;
transData.BuildPacket(&out_packet);
- for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
+ for (Map::PlayerList::const_iterator itr = player.begin(); itr != player.end(); ++itr)
if (this != itr->getSource()->GetTransport())
itr->getSource()->SendDirectMessage(&out_packet);
}
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 594203e0c46..3ab2f786086 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -641,20 +641,21 @@ const float m_diminishing_k[MAX_CLASSES] =
float Player::GetMissPercentageFromDefence() const
{
- const float miss_cap[MAX_CLASSES] =
+ float const miss_cap[MAX_CLASSES] =
{
- 16.00f, // Warrior //correct
- 16.00f, // Paladin //correct
- 16.00f, // Hunter //?
- 16.00f, // Rogue //?
- 16.00f, // Priest //?
- 16.00f, // DK //correct
- 16.00f, // Shaman //?
- 16.00f, // Mage //?
- 16.00f, // Warlock //?
- 0.0f, // ??
- 16.00f // Druid //?
+ 16.00f, // Warrior //correct
+ 16.00f, // Paladin //correct
+ 16.00f, // Hunter //?
+ 16.00f, // Rogue //?
+ 16.00f, // Priest //?
+ 16.00f, // DK //correct
+ 16.00f, // Shaman //?
+ 16.00f, // Mage //?
+ 16.00f, // Warlock //?
+ 0.0f, // ??
+ 16.00f // Druid //?
};
+
float diminishing = 0.0f, nondiminishing = 0.0f;
// Modify value from defense skill (only bonus from defense rating diminishes)
nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
@@ -669,17 +670,17 @@ void Player::UpdateParryPercentage()
{
const float parry_cap[MAX_CLASSES] =
{
- 47.003525f, // Warrior
- 47.003525f, // Paladin
- 145.560408f, // Hunter
- 145.560408f, // Rogue
- 0.0f, // Priest
- 47.003525f, // DK
- 145.560408f, // Shaman
- 0.0f, // Mage
- 0.0f, // Warlock
- 0.0f, // ??
- 0.0f // Druid
+ 47.003525f, // Warrior
+ 47.003525f, // Paladin
+ 145.560408f, // Hunter
+ 145.560408f, // Rogue
+ 0.0f, // Priest
+ 47.003525f, // DK
+ 145.560408f, // Shaman
+ 0.0f, // Mage
+ 0.0f, // Warlock
+ 0.0f, // ??
+ 0.0f // Druid
};
// No parry
@@ -706,17 +707,17 @@ void Player::UpdateDodgePercentage()
{
const float dodge_cap[MAX_CLASSES] =
{
- 88.129021f, // Warrior
- 88.129021f, // Paladin
- 145.560408f, // Hunter
- 145.560408f, // Rogue
- 150.375940f, // Priest
- 88.129021f, // DK
- 145.560408f, // Shaman
- 150.375940f, // Mage
- 150.375940f, // Warlock
- 0.0f, // ??
- 116.890707f // Druid
+ 88.129021f, // Warrior
+ 88.129021f, // Paladin
+ 145.560408f, // Hunter
+ 145.560408f, // Rogue
+ 150.375940f, // Priest
+ 88.129021f, // DK
+ 145.560408f, // Shaman
+ 150.375940f, // Mage
+ 150.375940f, // Warlock
+ 0.0f, // ??
+ 116.890707f // Druid
};
float diminishing = 0.0f, nondiminishing = 0.0f;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index d23c3c842d6..5a9456be6c8 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -181,7 +181,8 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this)
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
m_SummonSlot[i] = 0;
- m_ObjectSlot[0] = m_ObjectSlot[1] = m_ObjectSlot[2] = m_ObjectSlot[3] = 0;
+ for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
+ m_ObjectSlot[i] = 0;
m_auraUpdateIterator = m_ownedAuras.end();
@@ -1513,8 +1514,8 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
if (GetTypeId() == TYPEID_PLAYER)
{
- AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
- for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr)
+ AuraEffectList const& ArPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
+ for (AuraEffectList::const_iterator itr = ArPenAuras.begin(); itr != ArPenAuras.end(); ++itr)
{
// item neutral spell
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
@@ -1583,7 +1584,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
// Magic damage, check for resists
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
{
- float victimResistance = float(victim->GetResistance(GetFirstSchoolInMask(schoolMask)));
+ float victimResistance = float(victim->GetResistance(schoolMask));
victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
if (Player* player = ToPlayer())
@@ -1595,7 +1596,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
static uint32 const BOSS_LEVEL = 83;
static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
- uint32 level = getLevel();
+ uint32 level = victim->getLevel();
float resistanceConstant = 0.0f;
if (level == BOSS_LEVEL)
@@ -1686,12 +1687,12 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
if (currentAbsorb < 0)
currentAbsorb = 0;
- uint32 absorb = currentAbsorb;
+ uint32 tempAbsorb = uint32(currentAbsorb);
bool defaultPrevented = false;
- absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented);
- currentAbsorb = absorb;
+ absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
+ currentAbsorb = tempAbsorb;
if (defaultPrevented)
continue;
@@ -1704,8 +1705,8 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
dmgInfo.AbsorbDamage(currentAbsorb);
- absorb = currentAbsorb;
- absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, absorb);
+ tempAbsorb = currentAbsorb;
+ absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
// Check if our aura is using amount to count damage
if (absorbAurEff->GetAmount() >= 0)
@@ -1737,12 +1738,12 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
if (currentAbsorb < 0)
currentAbsorb = 0;
- uint32 absorb = currentAbsorb;
+ uint32 tempAbsorb = currentAbsorb;
bool defaultPrevented = false;
- absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented);
- currentAbsorb = absorb;
+ absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
+ currentAbsorb = tempAbsorb;
if (defaultPrevented)
continue;
@@ -1765,8 +1766,8 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
dmgInfo.AbsorbDamage(currentAbsorb);
- absorb = currentAbsorb;
- absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb);
+ tempAbsorb = currentAbsorb;
+ absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
// Check if our aura is using amount to count damage
if (absorbAurEff->GetAmount() >= 0)
@@ -2219,22 +2220,23 @@ void Unit::SendMeleeAttackStart(Unit* victim)
WorldPacket data(SMSG_ATTACKSTART, 8 + 8);
data << uint64(GetGUID());
data << uint64(victim->GetGUID());
-
SendMessageToSet(&data, true);
sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART");
}
void Unit::SendMeleeAttackStop(Unit* victim)
{
- if (!victim)
- return;
-
WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); // we guess size
data.append(GetPackGUID());
- data.append(victim->GetPackGUID()); // can be 0x00...
- data << uint32(0); // can be 0x1
+ data.append(victim ? victim->GetPackGUID() : 0); // can be 0x00...
+ data << uint32(0); // can be 0x1
SendMessageToSet(&data, true);
- sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
+ sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART");
+
+ if (victim)
+ sLog->outDetail("%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());
}
bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType)
@@ -3011,7 +3013,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
Spell* spell = m_currentSpells[spellType];
if (spell
&& (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
- && (withInstant || spell->CalcCastTime() > 0))
+ && (withInstant || spell->GetCastTime() > 0))
{
// for example, do not let self-stun aura interrupt itself
if (!spell->IsInterruptable())
@@ -3048,7 +3050,7 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip
// Maybe later some special spells will be excluded too.
// if skipInstant then instant spells shouldn't count as being casted
- if (skipInstant && m_currentSpells[CURRENT_GENERIC_SPELL] && !m_currentSpells[CURRENT_GENERIC_SPELL]->CalcCastTime())
+ if (skipInstant && m_currentSpells[CURRENT_GENERIC_SPELL] && !m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
return false;
// generic spells are casted when they are not finished and not delayed
@@ -3099,7 +3101,7 @@ Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const
{
if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
- return spell->CalcCastTime();
+ return spell->GetCastTime();
return 0;
}
@@ -3475,10 +3477,10 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
i = m_ownedAuras.begin();
}
-void Unit::RemoveOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
+void Unit::RemoveOwnedAura(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
- if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster))
+ if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
{
RemoveOwnedAura(itr, removeMode);
itr = m_ownedAuras.lower_bound(spellId);
@@ -3581,13 +3583,13 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
RemoveAura(aurApp, mode);
}
-void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
+void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
{
Aura const* aura = iter->second->GetBase();
if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
- && (!caster || aura->GetCasterGUID() == caster))
+ && (!casterGUID || aura->GetCasterGUID() == casterGUID))
{
RemoveAura(iter, removeMode);
iter = m_appliedAuras.lower_bound(spellId);
@@ -3597,13 +3599,13 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster, uint8 reqEffMask
}
}
-void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster, AuraRemoveMode removeMode)
+void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
{
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
{
Aura* aura = iter->second;
if ((aura->GetType() == UNIT_AURA_TYPE)
- && (!caster || aura->GetCasterGUID() == caster))
+ && (!casterGUID || aura->GetCasterGUID() == casterGUID))
{
aura->ModStackAmount(-1, removeMode);
return;
@@ -3742,13 +3744,13 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
// Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
- if (Aura* newAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
+ if (Aura* oldAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
{
if (stealCharge)
- newAura->ModCharges(1);
+ oldAura->ModCharges(1);
else
- newAura->ModStackAmount(1);
- newAura->SetDuration(int32(dur));
+ oldAura->ModStackAmount(1);
+ oldAura->SetDuration(int32(dur));
}
else
{
@@ -4661,7 +4663,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
gameObj->SetOwnerGUID(0);
- for (uint32 i = 0; i < 4; ++i)
+ for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
{
if (m_ObjectSlot[i] == gameObj->GetGUID())
{
@@ -4721,12 +4723,13 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
void Unit::RemoveAllGameObjects()
{
// remove references to unit
- for (GameObjectList::iterator i = m_gameObj.begin(); i != m_gameObj.end();)
+ while (!m_gameObj.empty())
{
+ GameObjectList::iterator i = m_gameObj.begin();
(*i)->SetOwnerGUID(0);
(*i)->SetRespawnTime(0);
(*i)->Delete();
- i = m_gameObj.erase(i);
+ m_gameObj.erase(i);
}
}
@@ -5239,6 +5242,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
break;
case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011
case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011
+ case CLASS_DEATH_KNIGHT:
triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011);
cooldown_spell_id = 39511;
break;
@@ -5286,7 +5290,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
{
// triggered at positive/self casts also, current attack target used then
- if (IsFriendlyTo(target))
+ if (target && IsFriendlyTo(target))
{
target = getVictim();
if (!target)
@@ -5763,11 +5767,11 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Glyph of Ice Block
case 56372:
{
- Player* plr = ToPlayer();
- if (!plr)
+ Player* player = ToPlayer();
+ if (!player)
return false;
- SpellCooldowns const cooldowns = plr->GetSpellCooldowns();
+ SpellCooldowns const cooldowns = player->GetSpellCooldowns();
// remove cooldowns on all ranks of Frost Nova
for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
{
@@ -5775,7 +5779,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Frost Nova
if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
&& cdSpell->SpellFamilyFlags[0] & 0x00000040)
- plr->RemoveSpellCooldown(cdSpell->Id, true);
+ player->RemoveSpellCooldown(cdSpell->Id, true);
}
break;
}
@@ -6287,7 +6291,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
{
- if (target->GetTypeId() == TYPEID_UNIT)
+ if (target && target->GetTypeId() == TYPEID_UNIT)
{
triggered_spell_id = 54820;
break;
@@ -7057,26 +7061,26 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Windfury Weapon (Passive) 1-5 Ranks
case 33757:
{
- Player* plr = ToPlayer();
- if (!plr || !castItem || !castItem->IsEquipped() || !victim || !victim->isAlive())
+ Player* player = ToPlayer();
+ if (!player || !castItem || !castItem->IsEquipped() || !victim || !victim->isAlive())
return false;
// custom cooldown processing case
- if (cooldown && plr->HasSpellCooldown(dummySpell->Id))
+ if (cooldown && player->HasSpellCooldown(dummySpell->Id))
return false;
if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
return false;
- WeaponAttackType attType = WeaponAttackType(plr->GetAttackBySlot(castItem->GetSlot()));
+ WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || !isAttackReady(attType))
return false;
// Now compute real proc chance...
uint32 chance = 20;
- plr->ApplySpellMod(dummySpell->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
+ player->ApplySpellMod(dummySpell->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
- Item* addWeapon = plr->GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK, true);
+ Item* addWeapon = player->GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK, true);
uint32 enchant_id_add = addWeapon ? addWeapon->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)) : 0;
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id_add);
if (pEnchant && pEnchant->spellid[0] == dummySpell->Id)
@@ -7121,7 +7125,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// apply cooldown before cast to prevent processing itself
if (cooldown)
- plr->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
+ player->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
// Attack Twice
for (uint32 i = 0; i < 2; ++i)
@@ -7247,7 +7251,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Item - Shaman T10 Elemental 4P Bonus
case 70817:
{
- if(!target)
+ if (!target)
return false;
// try to find spell Flame Shock on the target
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x0, 0x0, GetGUID()))
@@ -7998,11 +8002,8 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
else if (dummySpell->SpellIconID == 3015)
{
*handled = true;
- if (procSpell->Category == SPELLCATEGORY_JUDGEMENT)
- {
- CastSpell(victim, 68055, true);
- return true;
- }
+ CastSpell(victim, 68055, true);
+ return true;
}
// Glyph of Divinity
else if (dummySpell->Id == 54939)
@@ -8072,9 +8073,9 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
{
*handled = true;
// Convert recently used Blood Rune to Death Rune
- if (Player* plr = ToPlayer())
+ if (Player* player = ToPlayer())
{
- if (plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (player->getClass() != CLASS_DEATH_KNIGHT)
return false;
RuneType rune = ToPlayer()->GetLastUsedRune();
@@ -8098,22 +8099,22 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
{
if (dummySpell->SpellIconID == 2622)
{
- if (plr->GetCurrentRune(i) == RUNE_DEATH ||
- plr->GetBaseRune(i) == RUNE_BLOOD)
+ if (player->GetCurrentRune(i) == RUNE_DEATH ||
+ player->GetBaseRune(i) == RUNE_BLOOD)
continue;
}
else
{
- if (plr->GetCurrentRune(i) == RUNE_DEATH ||
- plr->GetBaseRune(i) != RUNE_BLOOD)
+ if (player->GetCurrentRune(i) == RUNE_DEATH ||
+ player->GetBaseRune(i) != RUNE_BLOOD)
continue;
}
- if (plr->GetRuneCooldown(i) != plr->GetRuneBaseCooldown(i))
+ if (player->GetRuneCooldown(i) != player->GetRuneBaseCooldown(i))
continue;
--runesLeft;
// Mark aura as used
- plr->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
+ player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
}
return true;
}
@@ -8407,6 +8408,13 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
+ // Item - Hunter T9 4P Bonus
+ if (auraSpellInfo->Id == 67151)
+ {
+ trigger_spell_id = 68130;
+ target = this;
+ break;
+ }
break;
}
case SPELLFAMILY_PALADIN:
@@ -8749,7 +8757,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 63156:
case 63158:
// Can proc only if target has hp below 35%
- if (!victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
+ if (!victim || !victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
return false;
break;
// Deathbringer Saurfang - Blood Beast's Blood Link
@@ -8789,11 +8797,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Blade Barrier
if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85)
{
- Player* plr = ToPlayer();
- if (!plr || plr->getClass() != CLASS_DEATH_KNIGHT)
+ Player* player = ToPlayer();
+ if (!player || player->getClass() != CLASS_DEATH_KNIGHT)
return false;
- if (!plr->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
+ if (!player->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
return false;
}
@@ -10142,20 +10150,20 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
// only called in Player::SetSeer
// so move it to Player?
-void Unit::AddPlayerToVision(Player* plr)
+void Unit::AddPlayerToVision(Player* player)
{
if (m_sharedVision.empty())
{
setActive(true);
SetWorldObject(true);
}
- m_sharedVision.push_back(plr);
+ m_sharedVision.push_back(player);
}
// only called in Player::SetSeer
-void Unit::RemovePlayerFromVision(Player* plr)
+void Unit::RemovePlayerFromVision(Player* player)
{
- m_sharedVision.remove(plr);
+ m_sharedVision.remove(player);
if (m_sharedVision.empty())
{
setActive(false);
@@ -10893,12 +10901,6 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
if (victim->HasAura(6788))
crit_chance+=(*i)->GetAmount();
break;
- case 21: // Test of Faith
- case 6935:
- case 6918:
- if (victim->HealthBelowPct(50))
- crit_chance+=(*i)->GetAmount();
- break;
default:
break;
}
@@ -11123,11 +11125,6 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32
case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
DoneTotal += (*i)->GetAmount();
break;
- case 7997: // Renewed Hope
- case 7998:
- if (victim->HasAura(6788))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
- break;
case 21: // Test of Faith
case 6935:
case 6918:
@@ -11752,23 +11749,6 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
- // Blessing of Sanctuary
- // Greater Blessing of Sanctuary
- case 19:
- case 1804:
- {
- if ((*i)->GetSpellInfo()->SpellFamilyName != SPELLFAMILY_PALADIN)
- continue;
-
- if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
- break;
- }
- // Ebon Plague
- case 1933:
- if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
- break;
}
}
@@ -11892,7 +11872,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
- if (Player* plr = ToPlayer())
+ if (Player* player = ToPlayer())
{
// mount as a vehicle
if (VehicleId)
@@ -11908,7 +11888,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
SendMessageToSet(&data, true);
data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
// mounts can also have accessories
GetVehicleKit()->InstallAllAccessories(false);
@@ -11916,7 +11896,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
}
// unsummon pet
- Pet* pet = plr->GetPet();
+ Pet* pet = player->GetPet();
if (pet)
{
Battleground* bg = ToPlayer()->GetBattleground();
@@ -11924,8 +11904,14 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
if (bg && bg->isArena())
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
else
- plr->UnsummonPetTemporaryIfAny();
+ player->UnsummonPetTemporaryIfAny();
}
+
+ WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
+ data.append(GetPackGUID());
+ data << uint32(sWorld->GetGameTime()); // Packet counter
+ data << player->GetCollisionHeight(true);
+ player->GetSession()->SendPacket(&data);
}
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);
@@ -11939,6 +11925,15 @@ void Unit::Unmount()
SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
+ if (Player* thisPlayer = ToPlayer())
+ {
+ WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
+ data.append(GetPackGUID());
+ data << uint32(sWorld->GetGameTime()); // Packet counter
+ data << thisPlayer->GetCollisionHeight(false);
+ thisPlayer->GetSession()->SendPacket(&data);
+ }
+
WorldPacket data(SMSG_DISMOUNT, 8);
data.appendPackGUID(GetGUID());
SendMessageToSet(&data, true);
@@ -11947,7 +11942,7 @@ void Unit::Unmount()
if (GetTypeId() == TYPEID_PLAYER && GetVehicleKit())
{
// Send other players that we are no longer a vehicle
- WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
+ data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8+4);
data.appendPackGUID(GetGUID());
data << uint32(0);
ToPlayer()->SendMessageToSet(&data, true);
@@ -11960,15 +11955,15 @@ void Unit::Unmount()
// only resummon old pet if the player is already added to a map
// this prevents adding a pet to a not created map which would otherwise cause a crash
// (it could probably happen when logging in after a previous crash)
- if (Player* plr = ToPlayer())
+ if (Player* player = ToPlayer())
{
- if (Pet* pPet = plr->GetPet())
+ if (Pet* pPet = player->GetPet())
{
if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STAT_STUNNED))
pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
else
- plr->ResummonPetTemporaryUnSummonedIfAny();
+ player->ResummonPetTemporaryUnSummonedIfAny();
}
}
@@ -13042,16 +13037,16 @@ int32 Unit::CalcSpellDuration(SpellInfo const* spellProto)
return duration;
}
-int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive)
+int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask)
{
- // don't mod permament auras duration
+ // don't mod permanent auras duration
if (duration < 0)
return duration;
// cut duration only of negative effects
if (!positive)
{
- int32 mechanic = spellProto->GetAllEffectsMechanicMask();
+ int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask);
int32 durationMod;
int32 durationMod_always = 0;
@@ -13554,10 +13549,10 @@ void Unit::SetHealth(uint32 val)
SetUInt32Value(UNIT_FIELD_HEALTH, val);
// group update
- if (Player* plr = ToPlayer())
+ if (Player* player = ToPlayer())
{
- if (plr->GetGroup())
- plr->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
+ if (player->GetGroup())
+ player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
}
else if (Pet* pet = ToCreature()->ToPet())
{
@@ -14329,7 +14324,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
}
if (!handled)
- for (uint8 effIndex = 0; effIndex<MAX_SPELL_EFFECTS; ++effIndex)
+ for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
if (!(i->effMask & (1<<effIndex)))
continue;
@@ -14349,10 +14344,14 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
}
case SPELL_AURA_PROC_TRIGGER_DAMAGE:
{
+ // target has to be valid
+ if (!target)
+ return;
+
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 damage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
- CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
+ uint32 newDamage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
+ CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo);
DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
SendSpellNonMeleeDamageLog(&damageInfo);
DealSpellDamage(&damageInfo, true);
@@ -14766,9 +14765,9 @@ void Unit::ClearComboPointHolders()
{
uint32 lowguid = *m_ComboPointHolders.begin();
- Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
- if (plr && plr->GetComboTarget() == GetGUID()) // recheck for safe
- plr->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
+ Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
+ if (player && player->GetComboTarget() == GetGUID()) // recheck for safe
+ player->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
else
m_ComboPointHolders.erase(lowguid); // or remove manually
}
@@ -15335,9 +15334,9 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
return;
// Inform pets (if any) when player kills target)
- if (Player* plr = ToPlayer())
+ if (Player* player = ToPlayer())
{
- Pet* pet = plr->GetPet();
+ Pet* pet = player->GetPet();
if (pet && pet->isAlive() && pet->isControlled())
pet->AI()->KilledUnit(victim);
}
@@ -15632,6 +15631,9 @@ void Unit::SetControlled(bool apply, UnitState state)
case UNIT_STAT_CONFUSED:
if (!HasUnitState(UNIT_STAT_STUNNED))
{
+ ClearUnitState(UNIT_STAT_MELEE_ATTACKING);
+ SendMeleeAttackStop();
+ // SendAutoRepeatCancel ?
SetConfused(true);
CastStop();
}
@@ -15639,6 +15641,9 @@ void Unit::SetControlled(bool apply, UnitState state)
case UNIT_STAT_FLEEING:
if (!HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_CONFUSED))
{
+ ClearUnitState(UNIT_STAT_MELEE_ATTACKING);
+ SendMeleeAttackStop();
+ // SendAutoRepeatCancel ?
SetFeared(true);
CastStop();
}
@@ -15909,10 +15914,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
}
else
{
- Player* plr = ToPlayer();
- if (plr->isAFK())
- plr->ToggleAFK();
- plr->SetClientControl(this, 0);
+ Player* player = ToPlayer();
+ if (player->isAFK())
+ player->ToggleAFK();
+ player->SetClientControl(this, 0);
}
// charm is set by aura, and aura effect remove handler was called during apply handler execution
@@ -16556,10 +16561,9 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
if (Player const* player = ToPlayer())
return player->GetRatingBonusValue(cr);
// Player's pet get resilience from owner
- else if (isPet())
- if (Unit* owner = GetOwner())
- if (Player* player = owner->ToPlayer())
- return player->GetRatingBonusValue(cr);
+ else if (isPet() && GetOwner())
+ if (Player* owner = GetOwner()->ToPlayer())
+ return owner->GetRatingBonusValue(cr);
return 0.0f;
}
@@ -16975,25 +16979,25 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
if (aurApp && aurApp->GetRemoveMode())
return;
- if (Player* plr = ToPlayer())
+ if (Player* player = ToPlayer())
{
- if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && plr->isInCombat())
+ if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->isInCombat())
return;
InterruptNonMeleeSpells(false);
- plr->StopCastingCharm();
- plr->StopCastingBindSight();
+ player->StopCastingCharm();
+ player->StopCastingBindSight();
Unmount();
RemoveAurasByType(SPELL_AURA_MOUNTED);
// drop flag at invisible in bg
- if (Battleground* bg = plr->GetBattleground())
- bg->EventPlayerDroppedFlag(plr);
+ if (Battleground* bg = player->GetBattleground())
+ bg->EventPlayerDroppedFlag(player);
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
- plr->UnsummonPetTemporaryIfAny();
+ player->UnsummonPetTemporaryIfAny();
}
ASSERT(!m_vehicle);
@@ -17067,8 +17071,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
SendMonsterMoveExitVehicle(&pos);
Relocate(&pos);
- if (Player* plr = ToPlayer())
- plr->ResummonPetTemporaryUnSummonedIfAny();
+ if (Player* player = ToPlayer())
+ player->ResummonPetTemporaryUnSummonedIfAny();
WorldPacket data2;
BuildHeartBeatMsg(&data2);
@@ -17383,7 +17387,7 @@ uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);
for (AuraEffectList::const_iterator i = periodicAuras.begin(); i != periodicAuras.end(); ++i)
{
- if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex || (*i)->GetTotalTicks() == 0)
+ if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex || !(*i)->GetTotalTicks())
continue;
amount += uint32(((*i)->GetAmount() * std::max<int32>((*i)->GetTotalTicks() - int32((*i)->GetTickNumber()), 0)) / (*i)->GetTotalTicks());
break;
@@ -17399,6 +17403,17 @@ void Unit::SendClearTarget()
SendMessageToSet(&data, false);
}
+uint32 Unit::GetResistance(SpellSchoolMask mask) const
+{
+ int32 resist = -1;
+ for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
+ if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
+ resist = int32(GetResistance(SpellSchools(i)));
+
+ // resist value will never be negative here
+ return uint32(resist);
+}
+
void CharmInfo::SetIsCommandAttack(bool val)
{
m_isCommandAttack = val;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 064542bb013..5906a7f3a2b 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -44,8 +44,8 @@ enum SpellInterruptFlags
{
SPELL_INTERRUPT_FLAG_MOVEMENT = 0x01, // why need this for instant?
SPELL_INTERRUPT_FLAG_PUSH_BACK = 0x02, // push back
- SPELL_INTERRUPT_FLAG_INTERRUPT = 0x04, // interrupt
- SPELL_INTERRUPT_FLAG_AUTOATTACK = 0x08, // enter combat
+ SPELL_INTERRUPT_FLAG_UNK3 = 0x04, // any info?
+ SPELL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10, // _complete_ interrupt on direct damage
//SPELL_INTERRUPT_UNK = 0x20 // unk, 564 of 727 spells having this spell start with "Glyph"
};
@@ -53,7 +53,8 @@ enum SpellInterruptFlags
// See SpellAuraInterruptFlags for other values definitions
enum SpellChannelInterruptFlags
{
- CHANNEL_FLAG_DELAY = 0x4000
+ CHANNEL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
+ CHANNEL_FLAG_DELAY = 0x4000
};
enum SpellAuraInterruptFlags
@@ -1007,8 +1008,8 @@ enum CurrentSpellTypes
{
CURRENT_MELEE_SPELL = 0,
CURRENT_GENERIC_SPELL = 1,
- CURRENT_AUTOREPEAT_SPELL = 2,
- CURRENT_CHANNELED_SPELL = 3
+ CURRENT_CHANNELED_SPELL = 2,
+ CURRENT_AUTOREPEAT_SPELL = 3
};
#define CURRENT_FIRST_NON_MELEE_SPELL 1
@@ -1208,6 +1209,8 @@ enum ReactiveType
#define SUMMON_SLOT_QUEST 6
#define MAX_SUMMON_SLOT 7
+#define MAX_GAMEOBJECT_SLOT 4
+
enum PlayerTotemType
{
SUMMON_TYPE_TOTEM_FIRE = 63,
@@ -1307,7 +1310,7 @@ class Unit : public WorldObject
void CombatStopWithPets(bool includingCast = false);
void StopAttackFaction(uint32 faction_id);
Unit* SelectNearbyTarget(float dist = NOMINAL_MELEE_RANGE) const;
- void SendMeleeAttackStop(Unit* victim);
+ void SendMeleeAttackStop(Unit* victim = NULL);
void SendMeleeAttackStart(Unit* pVictim);
void AddUnitState(uint32 f) { m_state |= f; }
@@ -1343,6 +1346,7 @@ class Unit : public WorldObject
void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); }
uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); }
+ uint32 GetResistance(SpellSchoolMask mask) const;
void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES+school, val); }
uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); }
@@ -1514,7 +1518,7 @@ class Unit : public WorldObject
{
value = soft_cap + ((value - soft_cap) / 2);
}
-
+
return value;
}
uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
@@ -1727,8 +1731,8 @@ class Unit : public WorldObject
//Player* GetMoverSource() const;
Player* m_movedPlayer;
SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
- void AddPlayerToVision(Player* plr);
- void RemovePlayerFromVision(Player* plr);
+ void AddPlayerToVision(Player* player);
+ void RemovePlayerFromVision(Player* player);
bool HasSharedVision() const { return !m_sharedVision.empty(); }
void RemoveBindSightAuras();
void RemoveCharmAuras();
@@ -1755,7 +1759,7 @@ class Unit : public WorldObject
AuraMap const& GetOwnedAuras() const { return m_ownedAuras; }
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveOwnedAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const;
@@ -1765,12 +1769,12 @@ class Unit : public WorldObject
AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; }
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAuraFromStack(uint32 spellId, uint64 caster = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer);
void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId);
@@ -1891,7 +1895,7 @@ class Unit : public WorldObject
uint32 m_addDmgOnce;
uint64 m_SummonSlot[MAX_SUMMON_SLOT];
- uint64 m_ObjectSlot[4];
+ uint64 m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_2, 3)); }
void SetShapeshiftForm(ShapeshiftForm form)
@@ -2068,7 +2072,7 @@ class Unit : public WorldObject
float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const;
int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
int32 CalcSpellDuration(SpellInfo const* spellProto);
- int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive);
+ int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask);
void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell=NULL);
float CalculateLevelPenalty(SpellInfo const* spellProto) const;
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 107e275d47b..fe018ec78ce 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -172,8 +172,12 @@ void Vehicle::ApplyAllImmunities()
// Different immunities for vehicles goes below
switch (GetVehicleInfo()->m_ID)
{
- case 160:
+ // code below prevents a bug with movable cannons
+ case 160: // Strand of the Ancients
+ case 244: // Wintergrasp
+ case 510: // Isle of Conquest
_me->SetControlled(true, UNIT_STAT_ROOT);
+ // why we need to apply this? we can simple add immunities to slow mechanic in DB
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true);
break;
default:
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 2570e50c55a..dbcb07e88f5 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -1170,7 +1170,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
sObjectMgr->AddCreatureToGrid(*itr, data);
// Spawn if necessary (loaded grids only)
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid));
+ Map* map = sMapMgr->CreateBaseMap(data->mapid);
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
@@ -1199,7 +1199,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
sObjectMgr->AddGameobjectToGrid(*itr, data);
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid));
+ Map* map = sMapMgr->CreateBaseMap(data->mapid);
// We use current coords to unspawn, not spawn coords since creature can have changed grid
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
@@ -1590,15 +1590,15 @@ void GameEventMgr::SaveWorldEventStateToDB(uint16 event_id)
CharacterDatabase.CommitTransaction(trans);
}
-void GameEventMgr::SendWorldStateUpdate(Player* plr, uint16 event_id)
+void GameEventMgr::SendWorldStateUpdate(Player* player, uint16 event_id)
{
GameEventConditionMap::const_iterator itr;
for (itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr)
{
if (itr->second.done_world_state)
- plr->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
+ player->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
if (itr->second.max_world_state)
- plr->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
+ player->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
}
}
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index 7337110fd65..a2a35a85098 100755
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
@@ -115,11 +115,11 @@ class GameEventMgr
bool StartEvent(uint16 event_id, bool overwrite = false);
void StopEvent(uint16 event_id, bool overwrite = false);
void HandleQuestComplete(uint32 quest_id); // called on world event type quest completions
- void HandleWorldEventGossip(Player* plr, Creature* c);
+ void HandleWorldEventGossip(Player* player, Creature* c);
uint32 GetNPCFlag(Creature* cr);
uint32 GetNpcTextId(uint32 guid);
private:
- void SendWorldStateUpdate(Player* plr, uint16 event_id);
+ void SendWorldStateUpdate(Player* player, uint16 event_id);
void AddActiveEvent(uint16 event_id) { m_ActiveEvents.insert(event_id); }
void RemoveActiveEvent(uint16 event_id) { m_ActiveEvents.erase(event_id); }
void ApplyNewEvent(uint16 event_id);
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index 84d27efc8d9..82532e6ae29 100755
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -165,7 +165,7 @@ Unit* ObjectAccessor::FindUnit(uint64 guid)
Player* ObjectAccessor::FindPlayerByName(const char* name)
{
- ACE_READ_GUARD_RETURN(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock(), NULL);
+ TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter)
if (iter->second->IsInWorld() && strcmp(name, iter->second->GetName()) == 0)
@@ -176,7 +176,7 @@ Player* ObjectAccessor::FindPlayerByName(const char* name)
void ObjectAccessor::SaveAllPlayers()
{
- ACE_READ_GUARD(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock());
+ TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
itr->second->SaveToDB();
@@ -184,7 +184,7 @@ void ObjectAccessor::SaveAllPlayers()
Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid)
{
- ACE_GUARD_RETURN(LockType, guard, i_corpseGuard, NULL);
+ TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, i_corpseLock);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid);
if (iter == i_player2corpse.end())
@@ -199,17 +199,25 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse)
{
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
+ //TODO: more works need to be done for corpse and other world object
if (Map* map = corpse->FindMap())
{
corpse->DestroyForNearbyPlayers();
- map->RemoveFromMap(corpse, false);
+ if (corpse->IsInGrid())
+ map->RemoveFromMap(corpse, false);
+ else
+ {
+ corpse->RemoveFromWorld();
+ corpse->ResetMap();
+ }
}
else
+
corpse->RemoveFromWorld();
// Critical section
{
- ACE_GUARD(LockType, g, i_corpseGuard);
+ TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID());
if (iter == i_player2corpse.end()) // TODO: Fix this
@@ -231,7 +239,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse)
// Critical section
{
- ACE_GUARD(LockType, g, i_corpseGuard);
+ TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock);
ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end());
i_player2corpse[corpse->GetOwnerGUID()] = corpse;
@@ -246,10 +254,14 @@ void ObjectAccessor::AddCorpse(Corpse* corpse)
void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map)
{
- ACE_GUARD(LockType, g, i_corpseGuard);
+ TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, i_corpseLock);
for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter)
{
+ // We need this check otherwise a corpose may be added to a grid twice
+ if (iter->second->IsInGrid())
+ continue;
+
if (iter->second->GetGridCoord() == gridpair)
{
// verify, if the corpse in our instance (add only corpses which are)
@@ -281,6 +293,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
// remove corpse from player_guid -> corpse map and from current map
RemoveCorpse(corpse);
+
// remove corpse from DB
SQLTransaction trans = CharacterDatabase.BeginTransaction();
corpse->DeleteFromDB(trans);
@@ -346,17 +359,12 @@ void ObjectAccessor::Update(uint32 /*diff*/)
{
UpdateDataMapType update_players;
- // Critical section
+ while (!i_objects.empty())
{
- ACE_GUARD(LockType, g, i_updateGuard);
-
- while (!i_objects.empty())
- {
- Object* obj = *i_objects.begin();
- ASSERT(obj && obj->IsInWorld());
- i_objects.erase(i_objects.begin());
- obj->BuildUpdate(update_players);
- }
+ Object* obj = *i_objects.begin();
+ ASSERT(obj && obj->IsInWorld());
+ i_objects.erase(i_objects.begin());
+ obj->BuildUpdate(update_players);
}
WorldPacket packet; // here we allocate a std::vector with a size of 0x10000
diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h
index ae88ae3673f..25fa20dce70 100755
--- a/src/server/game/Globals/ObjectAccessor.h
+++ b/src/server/game/Globals/ObjectAccessor.h
@@ -52,19 +52,19 @@ class HashMapHolder
static void Insert(T* o)
{
- ACE_WRITE_GUARD(LockType, Guard, i_lock);
+ TRINITY_WRITE_GUARD(LockType, i_lock);
m_objectMap[o->GetGUID()] = o;
}
static void Remove(T* o)
{
- ACE_WRITE_GUARD(LockType, Guard, i_lock);
+ TRINITY_WRITE_GUARD(LockType, i_lock);
m_objectMap.erase(o->GetGUID());
}
static T* Find(uint64 guid)
{
- ACE_READ_GUARD_RETURN(LockType, Guard, i_lock, NULL);
+ TRINITY_READ_GUARD(LockType, i_lock);
typename MapType::iterator itr = m_objectMap.find(guid);
return (itr != m_objectMap.end()) ? itr->second : NULL;
}
@@ -84,8 +84,7 @@ class HashMapHolder
class ObjectAccessor
{
- friend class ACE_Singleton<ObjectAccessor, ACE_Thread_Mutex>;
- friend class WorldRunnable;
+ friend class ACE_Singleton<ObjectAccessor, ACE_Null_Mutex>;
private:
ObjectAccessor();
~ObjectAccessor();
@@ -93,15 +92,13 @@ class ObjectAccessor
ObjectAccessor& operator=(const ObjectAccessor&);
public:
- typedef UNORDERED_MAP<uint64, Corpse*> Player2CorpsesMapType;
- typedef UNORDERED_MAP<Player*, UpdateData>::value_type UpdateDataValueType;
-
// TODO: override these template functions for each holder type and add assertions
template<class T> static T* GetObjectInOrOutOfWorld(uint64 guid, T* /*typeSpecifier*/)
{
return HashMapHolder<T>::Find(guid);
}
+
static Unit* GetObjectInOrOutOfWorld(uint64 guid, Unit* /*typeSpecifier*/)
{
if (IS_PLAYER_GUID(guid))
@@ -195,10 +192,10 @@ class ObjectAccessor
static Pet* FindPet(uint64);
static Player* FindPlayer(uint64);
static Unit* FindUnit(uint64);
- Player* FindPlayerByName(const char* name);
+ static Player* FindPlayerByName(const char* name);
// when using this, you must use the hashmapholder's lock
- HashMapHolder<Player>::MapType const& GetPlayers() const
+ static HashMapHolder<Player>::MapType const& GetPlayers()
{
return HashMapHolder<Player>::GetContainer();
}
@@ -215,63 +212,57 @@ class ObjectAccessor
// return HashMapHolder<GameObject>::GetContainer();
//}
- template<class T> void AddObject(T* object)
+ template<class T> static void AddObject(T* object)
{
HashMapHolder<T>::Insert(object);
}
- template<class T> void RemoveObject(T* object)
+ template<class T> static void RemoveObject(T* object)
{
HashMapHolder<T>::Remove(object);
}
- void RemoveObject(Player* pl)
- {
- HashMapHolder<Player>::Remove(pl);
- RemoveUpdateObject((Object*)pl);
- }
-
- void SaveAllPlayers();
+ static void SaveAllPlayers();
+ //non-static functions
void AddUpdateObject(Object* obj)
{
- ACE_GUARD(LockType, Guard, i_updateGuard);
+ TRINITY_GUARD(ACE_Thread_Mutex, i_objectLock);
i_objects.insert(obj);
}
void RemoveUpdateObject(Object* obj)
{
- ACE_GUARD(LockType, Guard, i_updateGuard);
+ TRINITY_GUARD(ACE_Thread_Mutex, i_objectLock);
i_objects.erase(obj);
}
- void Update(uint32 diff);
-
+ //Thread safe
Corpse* GetCorpseForPlayerGUID(uint64 guid);
void RemoveCorpse(Corpse* corpse);
void AddCorpse(Corpse* corpse);
void AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map);
Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false);
- void RemoveOldCorpses();
- typedef ACE_Thread_Mutex LockType;
-
- protected:
+ //Thread unsafe
+ void Update(uint32 diff);
+ void RemoveOldCorpses();
void UnloadAll();
private:
-
- Player2CorpsesMapType i_player2corpse;
-
static void _buildChangeObjectForPlayer(WorldObject*, UpdateDataMapType&);
static void _buildPacket(Player*, Object*, UpdateDataMapType&);
void _update();
+ typedef UNORDERED_MAP<uint64, Corpse*> Player2CorpsesMapType;
+ typedef UNORDERED_MAP<Player*, UpdateData>::value_type UpdateDataValueType;
+
std::set<Object*> i_objects;
+ Player2CorpsesMapType i_player2corpse;
- LockType i_updateGuard;
- LockType i_corpseGuard;
+ ACE_Thread_Mutex i_objectLock;
+ ACE_RW_Thread_Mutex i_corpseLock;
};
-#define sObjectAccessor ACE_Singleton<ObjectAccessor, ACE_Thread_Mutex>::instance()
+#define sObjectAccessor ACE_Singleton<ObjectAccessor, ACE_Null_Mutex>::instance()
#endif
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index e1ff0821bf8..6b0601d9663 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1599,7 +1599,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
if (!goinfo)
return 0;
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(mapId));
+ Map* map = sMapMgr->CreateBaseMap(mapId);
if (!map)
return 0;
@@ -1660,7 +1660,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
AddCreatureToGrid(guid, &data);
// Spawn if necessary (loaded grids only)
- if (Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(mapId)))
+ if (Map* map = sMapMgr->CreateBaseMap(mapId))
{
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsGridLoaded(data.posX, data.posY))
@@ -1713,7 +1713,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
AddCreatureToGrid(guid, &data);
// Spawn if necessary (loaded grids only)
- if (Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(mapId)))
+ if (Map* map = sMapMgr->CreateBaseMap(mapId))
{
// We use spawn coords to spawn
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
@@ -3691,42 +3691,41 @@ void ObjectMgr::LoadQuests()
mExclusiveQuestGroups.clear();
- // 0 1 2 3 4 5 6 7 8 9
- QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClassMask, MinLevel, MaxLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue, "
- // 10 11 12 13 14 15 16 17 18 19
- "RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime, "
- // 20 21 22 23 24 25 26 27 28 29 30 31 32 33
- "QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, RewardArenaPoints, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, RewXPId, SrcItemId, SrcItemCount, SrcSpell, "
- // 34 35 36 37 38 39 40 41 42 43 44
- "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, "
- // 45 46 47 48 49 50 51 52 53 54 55 56
- "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6, "
- // 57 58 59 60 61 62 63 64
- "ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, "
- // 65 66 67 68 69 70 71 72
- "ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4, "
- // 73 74 75 76
- "ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, "
- // 77 78 79 80 81 82
- "RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, "
- // 83 84 85 86 87 88
- "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6, "
- // 89 90 91 92 93 94 95 96
- "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4, "
- // 97 98 99 100 101 102 103 104 105 106
- "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValueId1, RewRepValueId2, RewRepValueId3, RewRepValueId4, RewRepValueId5, "
- // 107 108 109 110 111
- "RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5, "
- // 112 113 114 115 116 117 118 119 120 121 122 123
- "RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt, "
- // 124 125 126 127 128 129 130 131
- "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, "
- // 132 133 134 135 136 137
- "IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, "
- // 138 139 140 141
- "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, "
- // 142 143
- "StartScript, CompleteScript"
+ QueryResult result = WorldDatabase.Query("SELECT "
+ //0 1 2 3 4 5 6 7 8 9 10 11 12
+ "Id, Method, Level, MinLevel, MaxLevel, ZoneOrSort, Type, SuggestedPlayers, LimitTime, RequiredClasses, RequiredRaces, RequiredSkillId, RequiredSkillPoints, "
+ // 13 14 15 16 17 18 19 20
+ "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, "
+ // 21 22 23 24 25 26 27 28 29 30 31
+ "PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestIdChain, RewardXPId, RewardOrRequiredMoney, RewardMoneyMaxLevel, RewardSpell, RewardSpellCast, RewardHonor, RewardHonorMultiplier, "
+ // 32 33 34 35 36 37 38 39 40 41 42
+ "RewardMailTemplateId, RewardMailDelay, SourceItemId, SourceItemCount, SourceSpellId, Flags, SpecialFlags, RewardTitleId, RequiredPlayerKills, RewardTalents, RewardArenaPoints, "
+ // 43 44 45 46 47 48 49 50
+ "RewardItemId1, RewardItemId2, RewardItemId3, RewardItemId4, RewardItemCount1, RewardItemCount2, RewardItemCount3, RewardItemCount4, "
+ // 51 52 53 54 55 56 57 58 59 60 61 62
+ "RewardChoiceItemId1, RewardChoiceItemId2, RewardChoiceItemId3, RewardChoiceItemId4, RewardChoiceItemId5, RewardChoiceItemId6, RewardChoiceItemCount1, RewardChoiceItemCount2, RewardChoiceItemCount3, RewardChoiceItemCount4, RewardChoiceItemCount5, RewardChoiceItemCount6, "
+ // 63 64 65 66 67 68 69 70 71 72
+ "RewardFactionId1, RewardFactionId2, RewardFactionId3, RewardFactionId4, RewardFactionId5, RewardFactionValueId1, RewardFactionValueId2, RewardFactionValueId3, RewardFactionValueId4, RewardFactionValueId5, "
+ // 73 74 75 76 77
+ "RewardFactionValueIdOverride1, RewardFactionValueIdOverride2, RewardFactionValueIdOverride3, RewardFactionValueIdOverride4, RewardFactionValueIdOverride5, "
+ // 78 79 80 81
+ "PointMapId, PointX, PointY, PointOption, "
+ // 82 83 84 85 86 87 88
+ "Title, Objectives, Details, EndText, OfferRewardText, RequestItemsText, CompletedText, "
+ // 89 90 91 92 93 94 95 96
+ "RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, "
+ // 97 98 99 100 101 102 103 104
+ "RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4, RequiredSourceItemCount1, RequiredSourceItemCount2, RequiredSourceItemCount3, RequiredSourceItemCount4, "
+ // 105 106 107 108 109 110 111 112 113 114 115 116
+ "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, "
+ // 117 118 119 120 121 122 123 124 125
+ "RequiredSpellCast1, RequiredSpellCast2, RequiredSpellCast3, RequiredSpellCast4, Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, "
+ // 126 127 128 129 130 131 132 133 134 135
+ "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, EmoteOnIncomplete, EmoteOnComplete, "
+ // 136 137 138 139 140 141 142 143
+ "OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, "
+ // 144 145 146
+ "StartScript, CompleteScript, WDBVerified"
" FROM quest_template");
if (!result)
{
@@ -3764,45 +3763,45 @@ void ObjectMgr::LoadQuests()
sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
}
- if (qinfo->QuestFlags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
+ if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
{
sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
- qinfo->GetQuestId(), qinfo->QuestFlags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20);
- qinfo->QuestFlags &= QUEST_TRINITY_FLAGS_DB_ALLOWED;
+ qinfo->GetQuestId(), qinfo->Flags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20);
+ qinfo->Flags &= QUEST_TRINITY_FLAGS_DB_ALLOWED;
}
- if (qinfo->QuestFlags & QUEST_FLAGS_DAILY && qinfo->QuestFlags & QUEST_FLAGS_WEEKLY)
+ if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY)
{
- sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `QuestFlags`, removed daily flag.", qinfo->GetQuestId());
- qinfo->QuestFlags &= ~QUEST_FLAGS_DAILY;
+ sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
+ qinfo->Flags &= ~QUEST_FLAGS_DAILY;
}
- if (qinfo->QuestFlags & QUEST_FLAGS_DAILY)
+ if (qinfo->Flags & QUEST_FLAGS_DAILY)
{
- if (!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE))
+ if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
sLog->outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
- qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE;
+ qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
- if (qinfo->QuestFlags & QUEST_FLAGS_WEEKLY)
+ if (qinfo->Flags & QUEST_FLAGS_WEEKLY)
{
- if (!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE))
+ if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
sLog->outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
- qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE;
+ qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
- if (qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED)
+ if (qinfo->Flags & QUEST_FLAGS_AUTO_REWARDED)
{
- // at auto-reward can be rewarded only RewChoiceItemId[0]
+ // at auto-reward can be rewarded only RewardChoiceItemId[0]
for (int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{
- if (uint32 id = qinfo->RewChoiceItemId[j])
+ if (uint32 id = qinfo->RewardChoiceItemId[j])
{
- sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item from `RewChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
+ sLog->outErrorDb("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
}
@@ -3829,77 +3828,68 @@ void ObjectMgr::LoadQuests()
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)
}
- //check SkillOrClass value (class case).
- if (ClassByQuestSort(-int32(qinfo->ZoneOrSort)))
- {
- // SkillOrClass should not have class case when class case already set in ZoneOrSort.
- if (qinfo->SkillOrClassMask < 0)
- {
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (class sort case) and `SkillOrClassMask` = %i (class case), redundant.",
- qinfo->GetQuestId(), qinfo->ZoneOrSort, qinfo->SkillOrClassMask);
- }
- }
- //check for proper SkillOrClass value (skill case)
+ //check for proper RequiredSkillId value (skill case)
if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
{
- // skill is positive value in SkillOrClass
- if (qinfo->SkillOrClassMask != skill_id)
+ if (qinfo->RequiredSkillId != skill_id)
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClassMask` does not have a corresponding value (%i).",
+ sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%i).",
qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id);
//override, and force proper value here?
}
}
}
- // SkillOrClassMask (class case)
- if (qinfo->SkillOrClassMask < 0)
+ // RequiredClasses, can be 0/CLASSMASK_ALL_PLAYABLE to allow any class
+ if (qinfo->RequiredClasses)
{
- if (!(-int32(qinfo->SkillOrClassMask) & CLASSMASK_ALL_PLAYABLE))
+ if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Quest %u has `SkillOrClassMask` = %i (class case) but classmask does not have valid class",
- qinfo->GetQuestId(), qinfo->SkillOrClassMask);
+ sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
+ qinfo->RequiredClasses = 0;
}
}
- // SkillOrClassMask (skill case)
- if (qinfo->SkillOrClassMask > 0)
+ // RequiredRaces, can be 0/RACEMASK_ALL_PLAYABLE to allow any race
+ if (qinfo->RequiredRaces)
+ {
+ 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);
+ qinfo->RequiredRaces = 0;
+ }
+ }
+ // RequiredSkillId, can be 0
+ if (qinfo->RequiredSkillId)
{
- if (!sSkillLineStore.LookupEntry(qinfo->SkillOrClassMask))
+ if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId))
{
- sLog->outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist",
- qinfo->GetQuestId(), qinfo->SkillOrClassMask, qinfo->SkillOrClassMask);
+ sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist",
+ qinfo->GetQuestId(), qinfo->RequiredSkillId);
}
}
- if (qinfo->RequiredSkillValue)
+ if (qinfo->RequiredSkillPoints)
{
- if (qinfo->RequiredSkillValue > sWorld->GetConfigMaxSkillValue())
+ if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue())
{
- sLog->outErrorDb("Quest %u has `RequiredSkillValue` = %u but max possible skill is %u, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredSkillValue, sWorld->GetConfigMaxSkillValue());
+ sLog->outErrorDb("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
}
-
- if (qinfo->SkillOrClassMask <= 0)
- {
- sLog->outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.",
- qinfo->GetQuestId(), qinfo->RequiredSkillValue, qinfo->SkillOrClassMask);
- // no changes, quest can't be done for this requirement (fail at wrong skill id)
- }
}
// else Skill quests can have 0 skill level, this is ok
- if (qinfo->RepObjectiveFaction2 && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction2))
+ if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2))
{
- sLog->outErrorDb("Quest %u has `RepObjectiveFaction2` = %u but faction template %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RepObjectiveFaction2, qinfo->RepObjectiveFaction2);
+ sLog->outErrorDb("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->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction))
+ if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1))
{
- sLog->outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RepObjectiveFaction, qinfo->RepObjectiveFaction);
+ sLog->outErrorDb("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
}
@@ -3931,17 +3921,17 @@ void ObjectMgr::LoadQuests()
// no changes, quest can't be done for this requirement
}
- if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue != 0)
+ if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0)
{
- sLog->outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect",
- qinfo->GetQuestId(), qinfo->RepObjectiveValue);
+ sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect",
+ qinfo->GetQuestId(), qinfo->RequiredFactionValue1);
// warning
}
- if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 != 0)
+ if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0)
{
- sLog->outErrorDb("Quest %u has `RepObjectiveValue2` = %d but `RepObjectiveFaction2` is 0, value has no effect",
- qinfo->GetQuestId(), qinfo->RepObjectiveValue2);
+ sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect",
+ qinfo->GetQuestId(), qinfo->RequiredFactionValue2);
// warning
}
@@ -3959,61 +3949,61 @@ void ObjectMgr::LoadQuests()
// warning
}
- if (qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId))
+ if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId))
{
- sLog->outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
+ sLog->outErrorDb("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->CharTitleId = 0;
+ qinfo->RewardTitleId = 0;
// quest can't reward this title
}
- if (qinfo->SrcItemId)
+ if (qinfo->SourceItemId)
{
- if (!sObjectMgr->GetItemTemplate(qinfo->SrcItemId))
+ if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId))
{
- sLog->outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->SrcItemId, qinfo->SrcItemId);
- qinfo->SrcItemId = 0; // quest can't be done for this requirement
+ sLog->outErrorDb("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->SrcItemCount == 0)
+ else if (qinfo->SourceItemIdCount == 0)
{
- sLog->outErrorDb("Quest %u has `SrcItemId` = %u but `SrcItemCount` = 0, set to 1 but need fix in DB.",
- qinfo->GetQuestId(), qinfo->SrcItemId);
- qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB
+ sLog->outErrorDb("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->SrcItemCount>0)
+ else if (qinfo->SourceItemIdCount>0)
{
- sLog->outErrorDb("Quest %u has `SrcItemId` = 0 but `SrcItemCount` = %u, useless value.",
- qinfo->GetQuestId(), qinfo->SrcItemCount);
- qinfo->SrcItemCount=0; // no quest work changes in fact
+ sLog->outErrorDb("Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.",
+ qinfo->GetQuestId(), qinfo->SourceItemIdCount);
+ qinfo->SourceItemIdCount=0; // no quest work changes in fact
}
- if (qinfo->SrcSpell)
+ if (qinfo->SourceSpellid)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SrcSpell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->SrcSpell, qinfo->SrcSpell);
- qinfo->SrcSpell = 0; // quest can't be done for this requirement
+ sLog->outErrorDb("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 `SrcSpell` = %u but spell %u is broken, quest can't be done.",
- qinfo->GetQuestId(), qinfo->SrcSpell, qinfo->SrcSpell);
- qinfo->SrcSpell = 0; // quest can't be done for this requirement
+ sLog->outErrorDb("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
}
}
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
{
- uint32 id = qinfo->ReqItemId[j];
+ uint32 id = qinfo->RequiredItemId[j];
if (id)
{
- if (qinfo->ReqItemCount[j] == 0)
+ if (qinfo->RequiredItemCount[j] == 0)
{
- sLog->outErrorDb("Quest %u has `ReqItemId%d` = %u but `ReqItemCount%d` = 0, quest can't be done.",
+ sLog->outErrorDb("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
}
@@ -4022,37 +4012,37 @@ void ObjectMgr::LoadQuests()
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `ReqItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outErrorDb("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->ReqItemCount[j] = 0; // prevent incorrect work of quest
+ qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest
}
}
- else if (qinfo->ReqItemCount[j]>0)
+ else if (qinfo->RequiredItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `ReqItemId%d` = 0 but `ReqItemCount%d` = %u, quest can't be done.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->ReqItemCount[j]);
- qinfo->ReqItemCount[j] = 0; // prevent incorrect work of quest
+ sLog->outErrorDb("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
}
}
for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
{
- uint32 id = qinfo->ReqSourceId[j];
+ uint32 id = qinfo->RequiredSourceItemid[j];
if (id)
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `ReqSourceId%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outErrorDb("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
}
}
else
{
- if (qinfo->ReqSourceCount[j]>0)
+ if (qinfo->RequiredSourceItemId[j]>0)
{
- sLog->outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceCount%d` = %u.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->ReqSourceCount[j]);
+ sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = 0 but `RequiredSourceItemId%d` = %u.",
+ qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemId[j]);
// no changes, quest ignore this data
}
}
@@ -4060,7 +4050,7 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
- uint32 id = qinfo->ReqSpell[j];
+ uint32 id = qinfo->RequiredSpellCast[j];
if (id)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
@@ -4071,12 +4061,12 @@ void ObjectMgr::LoadQuests()
continue;
}
- if (!qinfo->ReqCreatureOrGOId[j])
+ if (!qinfo->RequiredNpcOrGo[j])
{
bool found = false;
for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
{
- if ((spellInfo->Effects[k].Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->Effects[k].MiscValue) == qinfo->QuestId) ||
+ if ((spellInfo->Effects[k].Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->Effects[k].MiscValue) == qinfo->Id) ||
spellInfo->Effects[k].Effect == SPELL_EFFECT_SEND_EVENT)
{
found = true;
@@ -4088,7 +4078,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 ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->QuestId, j+1, j+1);
+ 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);
// this will prevent quest completing without objective
const_cast<Quest*>(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -4096,7 +4086,7 @@ void ObjectMgr::LoadQuests()
}
else
{
- sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u and ReqCreatureOrGOId%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->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.",
qinfo->GetQuestId(), j+1, id, j+1, id);
// no changes, quest can't be done for this requirement
}
@@ -4106,19 +4096,19 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
- int32 id = qinfo->ReqCreatureOrGOId[j];
+ int32 id = qinfo->RequiredNpcOrGo[j];
if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id))
{
- sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.",
+ sLog->outErrorDb("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->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
+ qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement
}
if (id > 0 && !sObjectMgr->GetCreatureTemplate(id))
{
- sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.",
+ sLog->outErrorDb("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->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement
+ qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement
}
if (id)
@@ -4127,179 +4117,179 @@ void ObjectMgr::LoadQuests()
qinfo->SetFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO);
- if (!qinfo->ReqCreatureOrGOCount[j])
+ if (!qinfo->RequiredNpcOrGoCount[j])
{
- sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %u but `ReqCreatureOrGOCount%d` = 0, quest can't be done.",
+ sLog->outErrorDb("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->ReqCreatureOrGOCount[j]>0)
+ else if (qinfo->RequiredNpcOrGoCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = 0 but `ReqCreatureOrGOCount%d` = %u.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->ReqCreatureOrGOCount[j]);
+ sLog->outErrorDb("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
}
}
for (uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j)
{
- uint32 id = qinfo->RewChoiceItemId[j];
+ uint32 id = qinfo->RewardChoiceItemId[j];
if (id)
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
+ sLog->outErrorDb("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->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
+ qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this
}
- if (!qinfo->RewChoiceItemCount[j])
+ if (!qinfo->RewardChoiceItemCount[j])
{
- sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but `RewChoiceItemCount%d` = 0, quest can't be done.",
+ sLog->outErrorDb("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->RewChoiceItemCount[j]>0)
+ else if (qinfo->RewardChoiceItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = 0 but `RewChoiceItemCount%d` = %u.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->RewChoiceItemCount[j]);
+ sLog->outErrorDb("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
}
}
for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j)
{
- uint32 id = qinfo->RewItemId[j];
+ uint32 id = qinfo->RewardItemId[j];
if (id)
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RewItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
+ sLog->outErrorDb("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->RewItemId[j] = 0; // no changes, quest will not reward this item
+ qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item
}
- if (!qinfo->RewItemCount[j])
+ if (!qinfo->RewardItemIdCount[j])
{
- sLog->outErrorDb("Quest %u has `RewItemId%d` = %u but `RewItemCount%d` = 0, quest will not reward this item.",
+ sLog->outErrorDb("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->RewItemCount[j]>0)
+ else if (qinfo->RewardItemIdCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RewItemId%d` = 0 but `RewItemCount%d` = %u.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->RewItemCount[j]);
+ sLog->outErrorDb("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
}
}
for (uint8 j = 0; j < QUEST_REPUTATIONS_COUNT; ++j)
{
- if (qinfo->RewRepFaction[j])
+ if (qinfo->RewardFactionId[j])
{
- if (abs(qinfo->RewRepValueId[j]) > 9)
+ if (abs(qinfo->RewardFactionValueId[j]) > 9)
{
- sLog->outErrorDb("Quest %u has RewRepValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewRepValueId[j]);
+ 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]);
}
- if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
+ if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j]))
{
- sLog->outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewRepFaction[j], qinfo->RewRepFaction[j]);
- qinfo->RewRepFaction[j] = 0; // quest will not reward this
+ 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]);
+ qinfo->RewardFactionId[j] = 0; // quest will not reward this
}
}
- else if (qinfo->RewRepValue[j] != 0)
+ else if (qinfo->RewardFactionValueIdOverride[j] != 0)
{
- sLog->outErrorDb("Quest %u has `RewRepFaction%d` = 0 but `RewRepValue%d` = %i.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->RewRepValue[j]);
+ sLog->outErrorDb("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
}
}
- if (qinfo->RewSpell)
+ if (qinfo->RewardSpell)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardSpell);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u does not exist, spell removed as display reward.",
- qinfo->GetQuestId(), qinfo->RewSpell, qinfo->RewSpell);
- qinfo->RewSpell = 0; // no spell reward will display for this quest
+ sLog->outErrorDb("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 `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewSpell, qinfo->RewSpell);
- qinfo->RewSpell = 0; // no spell reward will display for this quest
+ sLog->outErrorDb("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->RewSpell))
+ else if (GetTalentSpellCost(qinfo->RewardSpell))
{
- sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewSpell, qinfo->RewSpell);
- qinfo->RewSpell = 0; // no spell reward will display for this quest
+ sLog->outErrorDb("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
}
}
- if (qinfo->RewSpellCast > 0)
+ if (qinfo->RewardSpellCast > 0)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpellCast);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardSpellCast);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewSpellCast, qinfo->RewSpellCast);
- qinfo->RewSpellCast = 0; // no spell will be casted on player
+ sLog->outErrorDb("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 `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewSpellCast, qinfo->RewSpellCast);
- qinfo->RewSpellCast = 0; // no spell will be casted on player
+ sLog->outErrorDb("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->RewSpellCast))
+ else if (GetTalentSpellCost(qinfo->RewardSpellCast))
{
- sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewSpellCast, qinfo->RewSpellCast);
- qinfo->RewSpellCast = 0; // no spell will be casted on player
+ sLog->outErrorDb("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
}
}
- if (qinfo->RewMailTemplateId)
+ if (qinfo->RewardMailTemplateId)
{
- if (!sMailTemplateStore.LookupEntry(qinfo->RewMailTemplateId))
+ if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId))
{
- sLog->outErrorDb("Quest %u has `RewMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
- qinfo->GetQuestId(), qinfo->RewMailTemplateId, qinfo->RewMailTemplateId);
- qinfo->RewMailTemplateId = 0; // no mail will send to player
- qinfo->RewMailDelaySecs = 0; // no mail will send to player
+ sLog->outErrorDb("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
}
- else if (usedMailTemplates.find(qinfo->RewMailTemplateId) != usedMailTemplates.end())
+ else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end())
{
- std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewMailTemplateId);
- sLog->outErrorDb("Quest %u has `RewMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
- qinfo->GetQuestId(), qinfo->RewMailTemplateId, qinfo->RewMailTemplateId, used_mt_itr->second);
- qinfo->RewMailTemplateId = 0; // no mail will send to player
- qinfo->RewMailDelaySecs = 0; // no mail will send to player
+ 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.",
+ 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
}
else
- usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId();
+ usedMailTemplates[qinfo->RewardMailTemplateId] = qinfo->GetQuestId();
}
- if (qinfo->NextQuestInChain)
+ if (qinfo->NextQuestIdChain)
{
- QuestMap::iterator qNextItr = mQuestTemplates.find(qinfo->NextQuestInChain);
+ QuestMap::iterator qNextItr = mQuestTemplates.find(qinfo->NextQuestIdChain);
if (qNextItr == mQuestTemplates.end())
{
- sLog->outErrorDb("Quest %u has `NextQuestInChain` = %u but quest %u does not exist, quest chain will not work.",
- qinfo->GetQuestId(), qinfo->NextQuestInChain, qinfo->NextQuestInChain);
- qinfo->NextQuestInChain = 0;
+ sLog->outErrorDb("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;
}
else
qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
@@ -4336,7 +4326,7 @@ void ObjectMgr::LoadQuests()
mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
if (qinfo->LimitTime)
qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED);
- if (qinfo->PlayersSlain)
+ if (qinfo->RequiredPlayerKills)
qinfo->SetFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL);
}
@@ -5369,11 +5359,11 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
m->checked = fields[7].GetUInt32();
m->mailTemplateId = fields[8].GetInt16();
- Player* pl = NULL;
+ Player* player = NULL;
if (serverUp)
- pl = ObjectAccessor::FindPlayer((uint64)m->receiver);
+ player = ObjectAccessor::FindPlayer((uint64)m->receiver);
- if (pl && pl->m_mailsLoaded)
+ if (player && player->m_mailsLoaded)
{ // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
// his in mailbox and he has already listed his mails)
delete m;
@@ -5392,7 +5382,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
// mail open and then not returned
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
stmt->setUInt32(0, itr2->item_guid);
CharacterDatabase.Execute(stmt);
}
@@ -7084,13 +7074,13 @@ void ObjectMgr::LoadQuestPOI()
{
// The first result should have the highest questId
Field* fields = points->Fetch();
- uint32 questId = fields[0].GetUInt32();
- POIs.resize(questId + 1);
+ uint32 questIdMax = fields[0].GetUInt32();
+ POIs.resize(questIdMax + 1);
do
{
- Field* fields = points->Fetch();
+ fields = points->Fetch();
uint32 questId = fields[0].GetUInt32();
uint32 id = fields[1].GetUInt32();
@@ -8490,13 +8480,13 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, bool savetodb)
return true;
}
-bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
+bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
{
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
if (!cInfo)
{
- if (pl)
- ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
+ 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);
return false;
@@ -8506,8 +8496,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
{
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
{
- if (pl)
- ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
+ 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);
@@ -8519,8 +8509,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (!sObjectMgr->GetItemTemplate(item_id))
{
- if (pl)
- ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
+ 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);
return false;
@@ -8528,8 +8518,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
{
- if (pl)
- ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
+ 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);
return false;
@@ -8537,16 +8527,16 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (maxcount > 0 && incrtime == 0)
{
- if (pl)
- ChatHandler(pl).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
+ 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);
return false;
}
else if (maxcount == 0 && incrtime > 0)
{
- if (pl)
- ChatHandler(pl).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
+ 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);
return false;
@@ -8558,8 +8548,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (vItems->FindItemCostPair(item_id, ExtendedCost))
{
- if (pl)
- ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
+ 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);
return false;
@@ -8567,8 +8557,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
{
- if (pl)
- ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
+ 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);
return false;
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index c557af1c2b2..88c593a009d 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -1076,14 +1076,14 @@ class ObjectMgr
time_t GetCreatureRespawnTime(uint32 loguid, uint32 instance)
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, m_CreatureRespawnTimesMtx, 0);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_CreatureRespawnTimesMtx);
return mCreatureRespawnTimes[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)
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, m_GORespawnTimesMtx, 0);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_GORespawnTimesMtx);
return mGORespawnTimes[MAKE_PAIR64(loguid, instance)];
}
void SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t);
@@ -1140,7 +1140,7 @@ class ObjectMgr
}
void AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event
bool RemoveVendorItem(uint32 entry, uint32 item, bool savetodb = true); // for event
- bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
+ bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* player = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
void LoadScriptNames();
ScriptNameMap &GetScriptNames() { return m_scriptNames; }
diff --git a/src/server/game/Grids/Grid.h b/src/server/game/Grids/Grid.h
index a90915d49f0..448c4cb35fd 100755
--- a/src/server/game/Grids/Grid.h
+++ b/src/server/game/Grids/Grid.h
@@ -58,17 +58,19 @@ class Grid
*/
template<class SPECIFIC_OBJECT> void AddWorldObject(SPECIFIC_OBJECT *obj)
{
- if (!i_objects.template insert<SPECIFIC_OBJECT>(obj))
- ASSERT(false);
+ i_objects.template insert<SPECIFIC_OBJECT>(obj);
+ ASSERT(obj->IsInGrid());
}
/** an object of interested exits the grid
*/
- template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj)
- {
- if (!i_objects.template remove<SPECIFIC_OBJECT>(obj))
- ASSERT(false);
- }
+ //Actually an unlink is enough, no need to go through the container
+ //template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj)
+ //{
+ // ASSERT(obj->GetGridRef().isValid());
+ // i_objects.template remove<SPECIFIC_OBJECT>(obj);
+ // ASSERT(!obj->GetGridRef().isValid());
+ //}
/** Refreshes/update the grid. This required for remote grids.
*/
@@ -104,17 +106,18 @@ class Grid
*/
template<class SPECIFIC_OBJECT> void AddGridObject(SPECIFIC_OBJECT *obj)
{
- if (!i_container.template insert<SPECIFIC_OBJECT>(obj))
- ASSERT(false);
+ i_container.template insert<SPECIFIC_OBJECT>(obj);
+ ASSERT(obj->IsInGrid());
}
/** Removes a containter type object from the grid
*/
- template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj)
- {
- if (!i_container.template remove<SPECIFIC_OBJECT>(obj))
- ASSERT(false);
- }
+ //template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj)
+ //{
+ // ASSERT(obj->GetGridRef().isValid());
+ // i_container.template remove<SPECIFIC_OBJECT>(obj);
+ // ASSERT(!obj->GetGridRef().isValid());
+ //}
/*bool NoWorldObjectInGrid() const
{
diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp
index fd5e3c68a51..5f88516c9ac 100755
--- a/src/server/game/Grids/GridStates.cpp
+++ b/src/server/game/Grids/GridStates.cpp
@@ -21,13 +21,11 @@
#include "Grid.h"
#include "Log.h"
-void
-InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32) const
+void InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32) const
{
}
-void
-ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 t_diff) const
+void ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 t_diff) const
{
// Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
info.UpdateTimeTracker(t_diff);
@@ -48,16 +46,14 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 t_dif
}
}
-void
-IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32) const
+void IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32) const
{
m.ResetGridExpiry(grid);
grid.SetGridState(GRID_STATE_REMOVAL);
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), m.GetId());
}
-void
-RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 t_diff) const
+void RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 t_diff) const
{
if (!info.getUnloadLock())
{
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h
index b814fd386a5..97a47f7d272 100755
--- a/src/server/game/Grids/NGrid.h
+++ b/src/server/game/Grids/NGrid.h
@@ -120,6 +120,7 @@ class NGrid
void ResetTimeTracker(time_t interval) { i_GridInfo.ResetTimeTracker(interval); }
void UpdateTimeTracker(time_t diff) { i_GridInfo.UpdateTimeTracker(diff); }
+ /*
template<class SPECIFIC_OBJECT> void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj)
{
GetGridType(x, y).AddWorldObject(obj);
@@ -139,6 +140,7 @@ class NGrid
{
GetGridType(x, y).RemoveGridObject(obj);
}
+ */
// Visit all Grids (cells) in NGrid (grid)
template<class T, class TT>
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index 0377713a520..ca61a82e840 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -30,8 +30,7 @@
using namespace Trinity;
-void
-VisibleNotifier::SendToSelf()
+void VisibleNotifier::SendToSelf()
{
// at this moment i_clientGUIDs have guids that not iterate at grid level checks
// but exist one case when this possible and object not out of range: transports
@@ -56,9 +55,9 @@ VisibleNotifier::SendToSelf()
if (IS_PLAYER_GUID(*it))
{
- Player* plr = ObjectAccessor::FindPlayer(*it);
- if (plr && plr->IsInWorld() && !plr->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
- plr->UpdateVisibilityOf(&i_player);
+ Player* player = ObjectAccessor::FindPlayer(*it);
+ if (player && player->IsInWorld() && !player->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ player->UpdateVisibilityOf(&i_player);
}
}
@@ -73,10 +72,9 @@ VisibleNotifier::SendToSelf()
i_player.SendInitialVisiblePackets(*it);
}
-void
-VisibleChangesNotifier::Visit(PlayerMapType &m)
+void VisibleChangesNotifier::Visit(PlayerMapType &m)
{
- for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
+ for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
if (iter->getSource() == &i_object)
continue;
@@ -91,8 +89,7 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
}
}
-void
-VisibleChangesNotifier::Visit(CreatureMapType &m)
+void VisibleChangesNotifier::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if (!iter->getSource()->GetSharedVisionList().empty())
@@ -102,8 +99,7 @@ VisibleChangesNotifier::Visit(CreatureMapType &m)
(*i)->UpdateVisibilityOf(&i_object);
}
-void
-VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
+void VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
@@ -126,16 +122,16 @@ void PlayerRelocationNotifier::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
- Player* plr = iter->getSource();
+ Player* player = iter->getSource();
- vis_guids.erase(plr->GetGUID());
+ vis_guids.erase(player->GetGUID());
- i_player.UpdateVisibilityOf(plr, i_data, i_visibleNow);
+ i_player.UpdateVisibilityOf(player, i_data, i_visibleNow);
- if (plr->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ if (player->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
continue;
- plr->UpdateVisibilityOf(&i_player);
+ player->UpdateVisibilityOf(&i_player);
}
}
@@ -160,12 +156,12 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
- Player* pl = iter->getSource();
+ Player* player = iter->getSource();
- if (!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
- pl->UpdateVisibilityOf(&i_creature);
+ if (!player->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
+ player->UpdateVisibilityOf(&i_creature);
- CreatureUnitRelocationWorker(&i_creature, pl);
+ CreatureUnitRelocationWorker(&i_creature, player);
}
}
@@ -241,8 +237,7 @@ void AIRelocationNotifier::Visit(CreatureMapType &m)
}
}
-void
-MessageDistDeliverer::Visit(PlayerMapType &m)
+void MessageDistDeliverer::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
@@ -312,17 +307,17 @@ void MessageDistDeliverer::Visit(DynamicObjectMapType &m)
/*
void
-MessageDistDeliverer::VisitObject(Player* plr)
+MessageDistDeliverer::VisitObject(Player* player)
{
- if (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()))
+ if (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && player->GetTeam() == ((Player&)i_source).GetTeam()))
{
- SendPacket(plr);
+ SendPacket(player);
}
}
*/
-template<class T> void
-ObjectUpdater::Visit(GridRefManager<T> &m)
+template<class T>
+void ObjectUpdater::Visit(GridRefManager<T> &m)
{
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index af86af25db5..239c3710b5b 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -61,7 +61,7 @@ namespace Trinity
struct PlayerRelocationNotifier : public VisibleNotifier
{
- PlayerRelocationNotifier(Player &pl) : VisibleNotifier(pl) {}
+ PlayerRelocationNotifier(Player &player) : VisibleNotifier(player) {}
template<class T> void Visit(GridRefManager<T> &m) { VisibleNotifier::Visit(m); }
void Visit(CreatureMapType &);
@@ -137,16 +137,16 @@ namespace Trinity
void Visit(DynamicObjectMapType &m);
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
- void SendPacket(Player* plr)
+ void SendPacket(Player* player)
{
// never send packet to self
- if (plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
+ if (player == i_source || (team && player->GetTeam() != team) || skipped_receiver == player)
return;
- if (!plr->HaveAtClient(i_source))
+ if (!player->HaveAtClient(i_source))
return;
- if (WorldSession* session = plr->GetSession())
+ if (WorldSession* session = player->GetSession())
session->SendPacket(i_message);
}
};
diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
index dcd4207e3e1..543a1d1e280 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
@@ -28,8 +28,7 @@
#include "SpellAuras.h"
template<class T>
-inline void
-Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
+inline void Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
{
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
@@ -38,8 +37,7 @@ Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
}
}
-inline void
-Trinity::ObjectUpdater::Visit(CreatureMapType &m)
+inline void Trinity::ObjectUpdater::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if (iter->getSource()->IsInWorld())
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index a696e02fdec..56c6410e6d7 100755
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -77,7 +77,7 @@ template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellCoord const&
template <class T>
void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj)
{
- obj->GetGridRef().link(&m, obj);
+ obj->AddToGrid(m);
ObjectGridLoader::SetObjectCell(obj, cell);
obj->AddToWorld();
if (obj->isActiveObject())
@@ -126,12 +126,17 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapTyp
// in that case map == currMap
obj->SetMap(map);
+ if (obj->IsInGrid())
+ {
+ obj->AddToWorld();
+ continue;
+ }
+
AddObjectHelper(cell, m, count, map, obj);
}
}
-void
-ObjectGridLoader::Visit(GameObjectMapType &m)
+void ObjectGridLoader::Visit(GameObjectMapType &m)
{
uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX();
uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY();
@@ -156,8 +161,7 @@ ObjectGridLoader::Visit(CreatureMapType &m)
LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map);
}
-void
-ObjectWorldLoader::Visit(CorpseMapType &m)
+void ObjectWorldLoader::Visit(CorpseMapType &m)
{
uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX();
uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY();
@@ -207,6 +211,11 @@ void ObjectGridUnloader::Visit(GridRefManager<T> &m)
// if option set then object already saved at this moment
if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
obj->SaveRespawnTime();
+ //Some creatures may summon other temp summons in CleanupsBeforeDelete()
+ //So we need this even after cleaner (maybe we can remove cleaner)
+ //Example: Flame Leviathan Turret 33139 is summoned when a creature is deleted
+ //TODO: Check if that script has the correct logic. Do we really need to summons something before deleting?
+ obj->CleanupsBeforeDelete();
///- object will get delinked from the manager when deleted
delete obj;
}
@@ -227,23 +236,18 @@ void ObjectGridStoper::Visit(CreatureMapType &m)
}
}
-void ObjectGridCleaner::Visit(CreatureMapType &m)
-{
- for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
- iter->getSource()->CleanupsBeforeDelete();
-}
-
template<class T>
void ObjectGridCleaner::Visit(GridRefManager<T> &m)
{
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
- iter->getSource()->RemoveFromWorld();
+ iter->getSource()->CleanupsBeforeDelete();
}
template void ObjectGridUnloader::Visit(CreatureMapType &);
template void ObjectGridUnloader::Visit(GameObjectMapType &);
template void ObjectGridUnloader::Visit(DynamicObjectMapType &);
template void ObjectGridUnloader::Visit(CorpseMapType &);
+template void ObjectGridCleaner::Visit(CreatureMapType &);
template void ObjectGridCleaner::Visit<GameObject>(GameObjectMapType &);
template void ObjectGridCleaner::Visit<DynamicObject>(DynamicObjectMapType &);
template void ObjectGridCleaner::Visit<Corpse>(CorpseMapType &);
diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h
index 411cae10a90..09a8fb2af9c 100755
--- a/src/server/game/Grids/ObjectGridLoader.h
+++ b/src/server/game/Grids/ObjectGridLoader.h
@@ -74,7 +74,6 @@ class ObjectGridEvacuator
class ObjectGridCleaner
{
public:
- void Visit(CreatureMapType &m);
template<class T> void Visit(GridRefManager<T> &);
};
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 5f73485c06e..6311066f597 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -1274,12 +1274,12 @@ void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int
{
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
- Player* plr = itr->getSource();
- if (!plr || (ignore != 0 && plr->GetGUID() == ignore) || (ignorePlayersInBGRaid && plr->GetGroup() != this))
+ Player* player = itr->getSource();
+ if (!player || (ignore != 0 && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this))
continue;
- if (plr->GetSession() && (group == -1 || itr->getSubGroup() == group))
- plr->GetSession()->SendPacket(packet);
+ if (player->GetSession() && (group == -1 || itr->getSubGroup() == group))
+ player->GetSession()->SendPacket(packet);
}
}
@@ -1287,10 +1287,10 @@ void Group::BroadcastReadyCheck(WorldPacket* packet)
{
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
- Player* plr = itr->getSource();
- if (plr && plr->GetSession())
- if (IsLeader(plr->GetGUID()) || IsAssistant(plr->GetGUID()))
- plr->GetSession()->SendPacket(packet);
+ Player* player = itr->getSource();
+ if (player && player->GetSession())
+ if (IsLeader(player->GetGUID()) || IsAssistant(player->GetGUID()))
+ player->GetSession()->SendPacket(packet);
}
}
@@ -1298,8 +1298,8 @@ void Group::OfflineReadyCheck()
{
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
- Player* plr = ObjectAccessor::FindPlayer(citr->guid);
- if (!plr || !plr->GetSession())
+ Player* player = ObjectAccessor::FindPlayer(citr->guid);
+ if (!player || !player->GetSession())
{
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
data << uint64(citr->guid);
@@ -1425,10 +1425,10 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
Player* pNewLooter = NULL;
for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
{
- if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
- if (pl->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
+ if (player->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
{
- pNewLooter = pl;
+ pNewLooter = player;
break;
}
}
@@ -1438,10 +1438,10 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
// search from start
for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
{
- if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
- if (pl->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
+ if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
+ if (player->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
{
- pNewLooter = pl;
+ pNewLooter = player;
break;
}
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index bc2648ed02b..7a2368161d8 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -309,11 +309,11 @@ void InstanceSaveManager::LoadResetTimes()
while (result->NextRow());
// update reset time for normal instances with the max creature respawn time + X hours
- if (PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_GET_MAX_CREATURE_RESPAWNS)))
+ if (PreparedQueryResult result2 = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_GET_MAX_CREATURE_RESPAWNS)))
{
do
{
- Field* fields = result->Fetch();
+ Field* fields = result2->Fetch();
uint32 instance = fields[1].GetUInt32();
time_t resettime = time_t(fields[0].GetUInt32() + 2 * HOUR);
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
@@ -511,7 +511,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr)
void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
{
sLog->outDebug(LOG_FILTER_MAPS, "InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
- Map* map = (MapInstanced*)sMapMgr->CreateBaseMap(mapid);
+ Map const* map = sMapMgr->CreateBaseMap(mapid);
if (!map->Instanceable())
return;
@@ -521,7 +521,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
DeleteInstanceFromDB(instanceId); // even if save not loaded
- Map* iMap = ((MapInstanced*)map)->FindMap(instanceId);
+ Map* iMap = ((MapInstanced*)map)->FindInstanceMap(instanceId);
if (iMap && iMap->IsDungeon())
((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index dec50e40127..b4e97f40f87 100755
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
@@ -80,8 +80,8 @@ class InstanceSave
/* online players bound to the instance (perm/solo)
does not include the members of the group unless they have permanent saves */
- void AddPlayer(Player* player) { ACE_GUARD(ACE_Thread_Mutex, guard, _lock); m_playerList.push_back(player); }
- bool RemovePlayer(Player* player) { ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, _lock, false); m_playerList.remove(player); return UnloadIfEmpty(); }
+ void AddPlayer(Player* player) { TRINITY_GUARD(ACE_Thread_Mutex, _lock); m_playerList.push_back(player); }
+ bool RemovePlayer(Player* player) { TRINITY_GUARD(ACE_Thread_Mutex, _lock); m_playerList.remove(player); return UnloadIfEmpty(); }
/* all groups bound to the instance */
void AddGroup(Group* group) { m_groupList.push_back(group); }
bool RemoveGroup(Group* group) { m_groupList.remove(group); return UnloadIfEmpty(); }
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index f0e21f7f709..b8987be9adb 100755
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -305,7 +305,6 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
void InstanceScript::DoSendNotifyToInstance(const char *format, ...)
{
InstanceMap::PlayerList const &PlayerList = instance->GetPlayers();
- InstanceMap::PlayerList::const_iterator i;
if (!PlayerList.isEmpty())
{
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index eff811b14eb..dd17e8277d6 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -436,8 +436,8 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
roundRobinPlayer = lootOwner->GetGUID();
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- if (Player* pl = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
- FillNotNormalLootFor(pl, pl->IsAtGroupRewardDistance(lootOwner));
+ if (Player* player = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
+ FillNotNormalLootFor(player, player->IsAtGroupRewardDistance(lootOwner));
for (uint8 i = 0; i < items.size(); ++i)
{
@@ -453,28 +453,28 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
return true;
}
-void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting)
+void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
{
- uint32 plguid = pl->GetGUIDLow();
+ uint32 plguid = player->GetGUIDLow();
QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
if (qmapitr == PlayerQuestItems.end())
- FillQuestLoot(pl);
+ FillQuestLoot(player);
qmapitr = PlayerFFAItems.find(plguid);
if (qmapitr == PlayerFFAItems.end())
- FillFFALoot(pl);
+ FillFFALoot(player);
qmapitr = PlayerNonQuestNonFFAConditionalItems.find(plguid);
if (qmapitr == PlayerNonQuestNonFFAConditionalItems.end())
- FillNonQuestNonFFAConditionalLoot(pl, presentAtLooting);
+ FillNonQuestNonFFAConditionalLoot(player, presentAtLooting);
// if not auto-processed player will have to come and pick it up manually
if (!presentAtLooting)
return;
// Process currency items
- uint32 max_slot = GetMaxSlotInLootFor(pl);
+ uint32 max_slot = GetMaxSlotInLootFor(player);
LootItem const* item = NULL;
uint32 itemsSize = uint32(items.size());
for (uint32 i = 0; i < max_slot; ++i)
@@ -484,10 +484,10 @@ void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting)
else
item = &quest_items[i-itemsSize];
- if (!item->is_looted && item->freeforall && item->AllowedForPlayer(pl))
+ 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)
- pl->StoreLootItem(i, this);
+ player->StoreLootItem(i, this);
}
}
@@ -592,8 +592,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
{
i_next = i;
++i_next;
- if (Player* pl = ObjectAccessor::FindPlayer(*i))
- pl->SendNotifyLootItemRemoved(lootIndex);
+ if (Player* player = ObjectAccessor::FindPlayer(*i))
+ player->SendNotifyLootItemRemoved(lootIndex);
else
PlayersLooting.erase(i);
}
@@ -607,8 +607,8 @@ void Loot::NotifyMoneyRemoved()
{
i_next = i;
++i_next;
- if (Player* pl = ObjectAccessor::FindPlayer(*i))
- pl->SendNotifyLootMoneyRemoved();
+ if (Player* player = ObjectAccessor::FindPlayer(*i))
+ player->SendNotifyLootMoneyRemoved();
else
PlayersLooting.erase(i);
}
@@ -626,9 +626,9 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
{
i_next = i;
++i_next;
- if (Player* pl = ObjectAccessor::FindPlayer(*i))
+ if (Player* player = ObjectAccessor::FindPlayer(*i))
{
- QuestItemMap::const_iterator pq = PlayerQuestItems.find(pl->GetGUIDLow());
+ QuestItemMap::const_iterator pq = PlayerQuestItems.find(player->GetGUIDLow());
if (pq != PlayerQuestItems.end() && pq->second)
{
// find where/if the player has the given item in it's vector
@@ -640,7 +640,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
break;
if (j < pql.size())
- pl->SendNotifyLootItemRemoved(items.size()+j);
+ player->SendNotifyLootItemRemoved(items.size()+j);
}
}
else
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index ebeac025f1d..bd419482b5b 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -256,16 +256,6 @@ void Map::AddToGrid(Creature* obj, Cell const& cell)
}
template<class T>
-void Map::RemoveFromGrid(T* obj, Cell const& cell)
-{
- NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
- if (obj->m_isWorldObject)
- grid->GetGridType(cell.CellX(), cell.CellY()).template RemoveWorldObject<T>(obj);
- else
- grid->GetGridType(cell.CellX(), cell.CellY()).template RemoveGridObject<T>(obj);
-}
-
-template<class T>
void Map::SwitchGridContainers(T* obj, bool on)
{
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
@@ -285,16 +275,11 @@ void Map::SwitchGridContainers(T* obj, bool on)
GridType &grid = ngrid->GetGridType(cell.CellX(), cell.CellY());
+ obj->RemoveFromGrid(); //This step is not really necessary but we want to do ASSERT in remove/add
if (on)
- {
- grid.RemoveGridObject<T>(obj);
grid.AddWorldObject<T>(obj);
- }
else
- {
- grid.RemoveWorldObject<T>(obj);
grid.AddGridObject<T>(obj);
- }
obj->m_isWorldObject = on;
}
@@ -309,10 +294,11 @@ void Map::DeleteFromWorld(T* obj)
}
template<>
-void Map::DeleteFromWorld(Player* pl)
+void Map::DeleteFromWorld(Player* player)
{
- sObjectAccessor->RemoveObject(pl);
- delete pl;
+ sObjectAccessor->RemoveObject(player);
+ sObjectAccessor->RemoveUpdateObject(player); //TODO: I do not know why we need this, it should be removed in ~Object anyway
+ delete player;
}
//Create NGrid so the object can be added to it
@@ -321,7 +307,7 @@ void Map::EnsureGridCreated(const GridCoord &p)
{
if (!getNGrid(p.x_coord, p.y_coord))
{
- ACE_GUARD(ACE_Thread_Mutex, Guard, Lock);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
if (!getNGrid(p.x_coord, p.y_coord))
{
sLog->outDebug(LOG_FILTER_MAPS, "Creating grid[%u, %u] for map %u instance %u", p.x_coord, p.y_coord, GetId(), i_InstanceId);
@@ -389,23 +375,22 @@ void Map::LoadGrid(float x, float y)
EnsureGridLoaded(Cell(x, y));
}
-bool Map::AddToMap(Player* player)
+bool Map::AddPlayerToMap(Player* player)
{
- // Check if we are adding to correct map
- ASSERT (player->GetMap() == this);
- CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
- if (!p.IsCoordValid())
+ 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(), p.x_coord, p.y_coord);
+ 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);
return false;
}
- player->SetMap(this);
-
- Cell cell(p);
+ Cell cell(cellCoord);
EnsureGridLoadedForActiveObject(cell, player);
AddToGrid(player, cell);
+ // Check if we are adding to correct map
+ ASSERT (player->GetMap() == this);
+ player->SetMap(this);
player->AddToWorld();
SendInitSelf(player);
@@ -430,38 +415,40 @@ void Map::InitializeObject(Creature* obj)
}
template<class T>
-void
-Map::AddToMap(T *obj)
+void Map::AddToMap(T *obj)
{
- CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
- if (!p.IsCoordValid())
+ //TODO: Needs clean up. An object should not be added to map twice.
+ if (obj->IsInWorld())
{
- sLog->outError("Map::Add: 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);
+ ASSERT(obj->IsInGrid());
+ obj->UpdateObjectVisibility(true);
return;
}
- Cell cell(p);
- if (obj->IsInWorld()) // need some clean up later
+ CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
+ if (!cellCoord.IsCoordValid())
{
- obj->UpdateObjectVisibility(true);
+ 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);
return;
}
+ Cell cell(cellCoord);
if (obj->isActiveObject())
EnsureGridLoadedForActiveObject(cell, 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());
+
+ //Must already be set before AddToMap. Usually during obj->Create.
//obj->SetMap(this);
obj->AddToWorld();
+
InitializeObject(obj);
if (obj->isActiveObject())
AddToActive(obj);
- sLog->outStaticDebug("Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
-
//something, such as vehicle, needs to be update immediately
//also, trigger needs to cast spell, if not update, cannot see visual
obj->UpdateObjectVisibility(true);
@@ -505,11 +492,11 @@ void Map::Update(const uint32 t_diff)
/// update worldsessions for existing players
for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter)
{
- Player* plr = m_mapRefIter->getSource();
- if (plr && plr->IsInWorld())
+ Player* player = m_mapRefIter->getSource();
+ if (player && player->IsInWorld())
{
- //plr->Update(t_diff);
- WorldSession* pSession = plr->GetSession();
+ //player->Update(t_diff);
+ WorldSession* pSession = player->GetSession();
MapSessionFilter updater(pSession);
pSession->Update(t_diff, updater);
}
@@ -527,15 +514,15 @@ void Map::Update(const uint32 t_diff)
// to make sure calls to Map::Remove don't invalidate it
for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter)
{
- Player* plr = m_mapRefIter->getSource();
+ Player* player = m_mapRefIter->getSource();
- if (!plr || !plr->IsInWorld())
+ if (!player || !player->IsInWorld())
continue;
// update players at tick
- plr->Update(t_diff);
+ player->Update(t_diff);
- VisitNearbyCellsOf(plr, grid_object_update, world_object_update);
+ VisitNearbyCellsOf(player, grid_object_update, world_object_update);
}
// non-player active objects, increasing iterator in the loop in case of object removal
@@ -655,26 +642,16 @@ void Map::ProcessRelocationNotifies(const uint32 diff)
}
}
-void Map::RemoveFromMap(Player* player, bool remove)
+void Map::RemovePlayerFromMap(Player* player, bool remove)
{
player->RemoveFromWorld();
SendRemoveTransports(player);
- CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
- if (!p.IsCoordValid())
- sLog->outCrash("Map::Remove: Player is in invalid cell!");
+ player->UpdateObjectVisibility(true);
+ if (player->IsInGrid())
+ player->RemoveFromGrid();
else
- {
- Cell cell(p);
- if (!getNGrid(cell.data.Part.grid_x, cell.data.Part.grid_y))
- sLog->outError("Map::Remove() i_grids was NULL x:%d, y:%d", cell.data.Part.grid_x, cell.data.Part.grid_y);
- else
- {
- sLog->outStaticDebug("Remove player %s from grid[%u, %u]", player->GetName(), cell.GridX(), cell.GridY());
- player->UpdateObjectVisibility(true);
- RemoveFromGrid(player, cell);
- }
- }
+ ASSERT(remove); //maybe deleted in logoutplayer when player is not in a map
if (remove)
DeleteFromWorld(player);
@@ -690,19 +667,8 @@ Map::RemoveFromMap(T *obj, bool remove)
if (obj->isActiveObject())
RemoveFromActive(obj);
- CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
- if (!p.IsCoordValid())
- sLog->outError("Map::Remove: 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);
- else
- {
- Cell cell(p);
- if (IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
- {
- sLog->outStaticDebug("Remove object " UI64FMTD " from grid[%u, %u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y);
- obj->UpdateObjectVisibility(true);
- RemoveFromGrid(obj, cell);
- }
- }
+ obj->UpdateObjectVisibility(true);
+ obj->RemoveFromGrid();
obj->ResetMap();
@@ -729,7 +695,7 @@ Map::PlayerRelocation(Player* player, float x, float y, float z, float orientati
{
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());
- RemoveFromGrid(player, old_cell);
+ player->RemoveFromGrid();
if (old_cell.DiffGrid(new_cell))
EnsureGridLoadedForActiveObject(new_cell, player);
@@ -855,7 +821,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell)
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved in grid[%u, %u] from cell[%u, %u] to cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY());
#endif
- RemoveFromGrid(c, old_cell);
+ c->RemoveFromGrid();
AddToGrid(c, new_cell);
}
else
@@ -877,7 +843,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell)
sLog->outDebug(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
#endif
- RemoveFromGrid(c, old_cell);
+ c->RemoveFromGrid();
AddToGrid(c, new_cell);
return true;
@@ -890,7 +856,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell)
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
#endif
- RemoveFromGrid(c, old_cell);
+ c->RemoveFromGrid();
EnsureGridCreated(GridCoord(new_cell.GridX(), new_cell.GridY()));
AddToGrid(c, new_cell);
@@ -1010,12 +976,12 @@ void Map::RemoveAllPlayers()
{
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
- Player* plr = itr->getSource();
- if (!plr->IsBeingTeleportedFar())
+ Player* player = itr->getSource();
+ 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!", plr->GetName(), GetId());
- plr->TeleportTo(plr->m_homebindMapId, plr->m_homebindX, plr->m_homebindY, plr->m_homebindZ, plr->GetOrientation());
+ sLog->outError("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());
}
}
}
@@ -2108,9 +2074,9 @@ bool Map::ActiveObjectsNearGrid(NGridType const& ngrid) const
for (MapRefManager::const_iterator iter = m_mapRefManager.begin(); iter != m_mapRefManager.end(); ++iter)
{
- Player* plr = iter->getSource();
+ Player* player = iter->getSource();
- CellCoord p = Trinity::ComputeCellCoord(plr->GetPositionX(), plr->GetPositionY());
+ CellCoord p = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
(cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
return true;
@@ -2274,14 +2240,14 @@ bool InstanceMap::CanEnter(Player* player)
/*
Do map specific checks and add the player to the map if successful.
*/
-bool InstanceMap::AddToMap(Player* player)
+bool InstanceMap::AddPlayerToMap(Player* player)
{
// TODO: Not sure about checking player level: already done in HandleAreaTriggerOpcode
// GMs still can teleport player in instance.
// Is it needed?
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, Lock, false);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
// Check moved to void WorldSession::HandleMoveWorldportAckOpcode()
//if (!CanEnter(player))
//return false;
@@ -2384,7 +2350,7 @@ bool InstanceMap::AddToMap(Player* player)
}
// this will acquire the same mutex so it cannot be in the previous block
- Map::AddToMap(player);
+ Map::AddPlayerToMap(player);
if (i_data)
i_data->OnPlayerEnter(player);
@@ -2400,13 +2366,13 @@ void InstanceMap::Update(const uint32 t_diff)
i_data->Update(t_diff);
}
-void InstanceMap::RemoveFromMap(Player* player, bool remove)
+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());
//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);
- Map::RemoveFromMap(player, remove);
+ Map::RemovePlayerFromMap(player, remove);
// for normal instances schedule the reset after all players have left
SetResetSchedule(true);
}
@@ -2485,7 +2451,7 @@ bool InstanceMap::Reset(uint8 method)
return m_mapRefManager.isEmpty();
}
-void InstanceMap::PermBindAllPlayers(Player* player)
+void InstanceMap::PermBindAllPlayers(Player* source)
{
if (!IsDungeon())
return;
@@ -2493,28 +2459,28 @@ void InstanceMap::PermBindAllPlayers(Player* player)
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)!", player->GetGUIDLow(), player->GetName(), player->GetMap()->GetMapName(), player->GetMapId(), GetInstanceId());
+ 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());
return;
}
- Group* group = player->GetGroup();
+ Group* group = source->GetGroup();
// group members outside the instance group don't get bound
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
- Player* plr = itr->getSource();
+ Player* player = itr->getSource();
// players inside an instance cannot be bound to other instances
// some players may already be permanently bound, in this case nothing happens
- InstancePlayerBind* bind = plr->GetBoundInstance(save->GetMapId(), save->GetDifficulty());
+ InstancePlayerBind* bind = player->GetBoundInstance(save->GetMapId(), save->GetDifficulty());
if (!bind || !bind->perm)
{
- plr->BindToInstance(save, true);
+ player->BindToInstance(save, true);
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
data << uint32(0);
- plr->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
// if the leader is not in the instance the group will not get a perm bind
- if (group && group->GetLeaderGUID() == plr->GetGUID())
+ if (group && group->GetLeaderGUID() == player->GetGUID())
group->BindToInstance(save, true);
}
}
@@ -2620,23 +2586,23 @@ bool BattlegroundMap::CanEnter(Player* player)
return Map::CanEnter(player);
}
-bool BattlegroundMap::AddToMap(Player* player)
+bool BattlegroundMap::AddPlayerToMap(Player* player)
{
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, Lock, false);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
//Check moved to void WorldSession::HandleMoveWorldportAckOpcode()
//if (!CanEnter(player))
//return false;
// reset instance validity, battleground maps do not homebind
player->m_InstanceValid = true;
}
- return Map::AddToMap(player);
+ return Map::AddPlayerToMap(player);
}
-void BattlegroundMap::RemoveFromMap(Player* player, bool remove)
+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());
- Map::RemoveFromMap(player, remove);
+ Map::RemovePlayerFromMap(player, remove);
}
void BattlegroundMap::SetUnload()
@@ -2648,9 +2614,9 @@ void BattlegroundMap::RemoveAllPlayers()
{
if (HavePlayers())
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
- if (Player* plr = itr->getSource())
- if (!plr->IsBeingTeleportedFar())
- plr->TeleportTo(plr->GetBattlegroundEntryPoint());
+ if (Player* player = itr->getSource())
+ if (!player->IsBeingTeleportedFar())
+ player->TeleportTo(player->GetBattlegroundEntryPoint());
}
Creature*
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 053759a3ab3..9caef8457b8 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -244,8 +244,8 @@ class Map : public GridRefManager<NGridType>
return false;
}
- virtual bool AddToMap(Player*);
- virtual void RemoveFromMap(Player*, bool);
+ virtual bool AddPlayerToMap(Player*);
+ virtual void RemovePlayerFromMap(Player*, bool);
template<class T> void AddToMap(T *);
template<class T> void RemoveFromMap(T *, bool);
@@ -526,9 +526,6 @@ class Map : public GridRefManager<NGridType>
void AddToGrid(T* object, Cell const& cell);
template<class T>
- void RemoveFromGrid(T* object, Cell const& cell);
-
- template<class T>
void DeleteFromWorld(T*);
template<class T>
@@ -570,14 +567,14 @@ class InstanceMap : public Map
public:
InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
~InstanceMap();
- bool AddToMap(Player*);
- void RemoveFromMap(Player*, bool);
+ bool AddPlayerToMap(Player*);
+ void RemovePlayerFromMap(Player*, bool);
void Update(const uint32);
void CreateInstanceData(bool load);
bool Reset(uint8 method);
uint32 GetScriptId() { return i_script_id; }
InstanceScript* GetInstanceScript() { return i_data; }
- void PermBindAllPlayers(Player* player);
+ void PermBindAllPlayers(Player* source);
void UnloadAll();
bool CanEnter(Player* player);
void SendResetWarnings(uint32 timeLeft) const;
@@ -600,8 +597,8 @@ class BattlegroundMap : public Map
BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattlegroundMap();
- bool AddToMap(Player*);
- void RemoveFromMap(Player*, bool);
+ bool AddPlayerToMap(Player*);
+ void RemovePlayerFromMap(Player*, bool);
bool CanEnter(Player* player);
void SetUnload();
//void UnloadAll(bool pForce);
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index 418218a52b3..a56a193ba64 100755
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -110,7 +110,7 @@ void MapInstanced::UnloadAll()
- create the instance if it's not created already
- the player is not actually added to the instance (only in InstanceMap::Add)
*/
-Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
+Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
{
if (GetId() != mapId || !player)
return NULL;
@@ -124,7 +124,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
// the instance id is set in battlegroundid
NewInstanceId = player->GetBattlegroundId();
if (!NewInstanceId) return NULL;
- map = _FindMap(NewInstanceId);
+ map = FindInstanceMap(NewInstanceId);
if (!map)
map = CreateBattleground(NewInstanceId, player->GetBattleground());
}
@@ -151,7 +151,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
{
// solo/perm/group
NewInstanceId = pSave->GetInstanceId();
- map = _FindMap(NewInstanceId);
+ map = FindInstanceMap(NewInstanceId);
// it is possible that the save exists but the map doesn't
if (!map)
map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty());
@@ -163,7 +163,11 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
NewInstanceId = sMapMgr->GenerateInstanceId();
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid());
- map = CreateInstance(NewInstanceId, NULL, diff);
+ //Seems it is now possible, but I do not know if it should be allowed
+ //ASSERT(!FindInstanceMap(NewInstanceId));
+ map = FindInstanceMap(NewInstanceId);
+ if (!map)
+ map = CreateInstance(NewInstanceId, NULL, diff);
}
}
@@ -173,7 +177,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player)
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty)
{
// load/create a map
- ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
// make sure we have a valid map id
const MapEntry* entry = sMapStore.LookupEntry(GetId());
@@ -207,7 +211,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg)
{
// load/create a map
- ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId());
diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h
index af303ed0e9e..9b714cb7fb3 100755
--- a/src/server/game/Maps/MapInstanced.h
+++ b/src/server/game/Maps/MapInstanced.h
@@ -39,8 +39,12 @@ class MapInstanced : public Map
void UnloadAll();
bool CanEnter(Player* player);
- Map* CreateInstance(const uint32 mapId, Player* player);
- Map* FindMap(uint32 InstanceId) const { return _FindMap(InstanceId); }
+ Map* CreateInstanceForPlayer(const uint32 mapId, Player* player);
+ Map* FindInstanceMap(uint32 instanceId) const
+ {
+ InstancedMaps::const_iterator i = m_InstancedMaps.find(instanceId);
+ return(i == m_InstancedMaps.end() ? NULL : i->second);
+ }
bool DestroyInstance(InstancedMaps::iterator &itr);
void AddGridMapReference(const GridCoord &p)
@@ -60,18 +64,11 @@ class MapInstanced : public Map
virtual void InitVisibilityDistance();
private:
-
InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty);
BattlegroundMap* CreateBattleground(uint32 InstanceId, Battleground* bg);
InstancedMaps m_InstancedMaps;
- Map* _FindMap(uint32 InstanceId) const
- {
- InstancedMaps::const_iterator i = m_InstancedMaps.find(InstanceId);
- return(i == m_InstancedMaps.end() ? NULL : i->second);
- }
-
uint16 GridMapReference[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
};
#endif
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index 8b1c69362f2..f31f1348b44 100755
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -95,13 +95,13 @@ void MapManager::checkAndCorrectGridStatesArray()
++i_GridStateErrorCount;
}
-Map* MapManager::_createBaseMap(uint32 id)
+Map* MapManager::CreateBaseMap(uint32 id)
{
- Map* m = _findMap(id);
+ Map* m = FindBaseMap(id);
if (m == NULL)
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
const MapEntry* entry = sMapStore.LookupEntry(id);
if (entry && entry->Instanceable())
@@ -119,27 +119,34 @@ Map* MapManager::_createBaseMap(uint32 id)
return m;
}
-Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 /*instanceId*/)
+Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
{
- ASSERT(obj);
- //if (!obj->IsInWorld()) sLog->outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
- Map* m = _createBaseMap(id);
+ Map* map = FindBaseMap(mapId);
+ if(map && map->Instanceable())
+ return NULL;
+ return map;
+}
+
+Map* MapManager::CreateMap(uint32 id, Player* player)
+{
+ Map* m = CreateBaseMap(id);
- if (m && (obj->GetTypeId() == TYPEID_PLAYER) && m->Instanceable()) m = ((MapInstanced*)m)->CreateInstance(id, (Player*)obj);
+ if (m && m->Instanceable())
+ m = ((MapInstanced*)m)->CreateInstanceForPlayer(id, player);
return m;
}
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
{
- Map* map = _findMap(mapid);
+ Map* map = FindBaseMap(mapid);
if (!map)
return NULL;
if (!map->Instanceable())
return instanceId == 0 ? map : NULL;
- return ((MapInstanced*)map)->FindMap(instanceId);
+ return ((MapInstanced*)map)->FindInstanceMap(instanceId);
}
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
@@ -201,8 +208,8 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
if (corpseMap == mapid)
break;
- InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(corpseMap);
- corpseMap = instance ? instance->Parent : 0;
+ InstanceTemplate const* corpseInstance = sObjectMgr->GetInstanceTemplate(corpseMap);
+ corpseMap = corpseInstance ? corpseInstance->Parent : 0;
} while (corpseMap);
if (!corpseMap)
@@ -248,7 +255,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
instaceIdToCheck = save->GetInstanceId();
// instanceId can never be 0 - will not be found
- if (!player->CheckInstanceCount(instaceIdToCheck))
+ if (!player->CheckInstanceCount(instaceIdToCheck) && !player->isDead())
{
player->SendTransferAborted(mapid, TRANSFER_ABORT_TOO_MANY_INSTANCES);
return false;
@@ -280,8 +287,8 @@ void MapManager::Update(uint32 diff)
iter->second->DelayedUpdate(uint32(i_timer.GetCurrent()));
sObjectAccessor->Update(uint32(i_timer.GetCurrent()));
- for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
- (*iter)->Update(uint32(i_timer.GetCurrent()));
+ for (TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr)
+ (*itr)->Update(uint32(i_timer.GetCurrent()));
i_timer.SetCurrent(0);
}
@@ -335,7 +342,7 @@ void MapManager::UnloadAll()
uint32 MapManager::GetNumInstances()
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, 0);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
uint32 ret = 0;
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
@@ -352,7 +359,7 @@ uint32 MapManager::GetNumInstances()
uint32 MapManager::GetNumPlayersInInstances()
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, 0);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
uint32 ret = 0;
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h
index 926ff2c8051..3b168a57cd5 100755
--- a/src/server/game/Maps/MapManager.h
+++ b/src/server/game/Maps/MapManager.h
@@ -35,14 +35,14 @@ class MapManager
friend class ACE_Singleton<MapManager, ACE_Thread_Mutex>;
public:
-
- Map* CreateMap(uint32, const WorldObject* obj, uint32 instanceId);
- Map const* CreateBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_createBaseMap(id); }
- Map* FindMap(uint32 mapid, uint32 instanceId = 0) const;
+ Map* CreateBaseMap(uint32 mapId);
+ Map* FindBaseNonInstanceMap(uint32 mapId) const;
+ Map* CreateMap(uint32 mapId, Player* player);
+ Map* FindMap(uint32 mapId, uint32 instanceId) const;
uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const
{
- Map const* m = CreateBaseMap(mapid);
+ Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
return m->GetAreaFlag(x, y, z);
}
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
@@ -160,16 +160,15 @@ class MapManager
MapManager();
~MapManager();
- MapManager(const MapManager &);
- MapManager& operator=(const MapManager &);
-
- Map* _createBaseMap(uint32 id);
- Map* _findMap(uint32 id) const
+ Map* FindBaseMap(uint32 mapId) const
{
- MapMapType::const_iterator iter = i_maps.find(id);
+ MapMapType::const_iterator iter = i_maps.find(mapId);
return (iter == i_maps.end() ? NULL : iter->second);
}
+ MapManager(const MapManager &);
+ MapManager& operator=(const MapManager &);
+
ACE_Thread_Mutex Lock;
uint32 i_gridCleanUpDelay;
MapMapType i_maps;
diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp
index 7e6b2f03bd0..80025680753 100644
--- a/src/server/game/Maps/MapUpdater.cpp
+++ b/src/server/game/Maps/MapUpdater.cpp
@@ -81,7 +81,7 @@ int MapUpdater::deactivate()
int MapUpdater::wait()
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, m_mutex, -1);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
while (pending_requests > 0)
m_condition.wait();
@@ -91,7 +91,7 @@ int MapUpdater::wait()
int MapUpdater::schedule_update(Map& map, ACE_UINT32 diff)
{
- ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, m_mutex, -1);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
++pending_requests;
@@ -113,7 +113,7 @@ bool MapUpdater::activated()
void MapUpdater::update_finished()
{
- ACE_GUARD(ACE_Thread_Mutex, guard, m_mutex);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
if (pending_requests == 0)
{
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index f562010549b..cbcad520e5f 100755
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -156,7 +156,7 @@ namespace Trinity
return baseGain;
}
- inline uint32 Gain(Player* pl, Unit* u)
+ inline uint32 Gain(Player* player, Unit* u)
{
uint32 gain;
@@ -167,7 +167,7 @@ namespace Trinity
gain = 0;
else
{
- gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
+ gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
{
@@ -181,7 +181,7 @@ namespace Trinity
gain = uint32(gain * sWorld->getRate(RATE_XP_KILL));
}
- sScriptMgr->OnGainCalculation(gain, pl, u);
+ sScriptMgr->OnGainCalculation(gain, player, u);
return gain;
}
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index c9fa9346860..a99d0f37c02 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -2378,7 +2378,7 @@ enum QuestSort
QUEST_SORT_ROGUE = 162,
QUEST_SORT_ALCHEMY = 181,
QUEST_SORT_LEATHERWORKING = 182,
- QUEST_SORT_ENGINERING = 201,
+ QUEST_SORT_ENGINEERING = 201,
QUEST_SORT_TREASURE_MAP = 221,
QUEST_SORT_SUNKEN_TEMPLE_OLD = 241,
QUEST_SORT_HUNTER = 261,
@@ -2480,7 +2480,7 @@ enum SkillType
SKILL_PET_IMP = 188,
SKILL_PET_FELHUNTER = 189,
SKILL_TAILORING = 197,
- SKILL_ENGINERING = 202,
+ SKILL_ENGINEERING = 202,
SKILL_PET_SPIDER = 203,
SKILL_PET_VOIDWALKER = 204,
SKILL_PET_SUCCUBUS = 205,
@@ -2600,7 +2600,7 @@ inline uint32 SkillByQuestSort(int32 QuestSort)
case QUEST_SORT_BLACKSMITHING: return SKILL_BLACKSMITHING;
case QUEST_SORT_ALCHEMY: return SKILL_ALCHEMY;
case QUEST_SORT_LEATHERWORKING: return SKILL_LEATHERWORKING;
- case QUEST_SORT_ENGINERING: return SKILL_ENGINERING;
+ case QUEST_SORT_ENGINEERING: return SKILL_ENGINEERING;
case QUEST_SORT_TAILORING: return SKILL_TAILORING;
case QUEST_SORT_COOKING: return SKILL_COOKING;
case QUEST_SORT_FIRST_AID: return SKILL_FIRST_AID;
@@ -2816,7 +2816,8 @@ enum DiminishingGroup
DIMINISHING_SILENCE = 16,
DIMINISHING_SLEEP = 17,
DIMINISHING_TAUNT = 18,
- DIMINISHING_LIMITONLY = 19
+ DIMINISHING_LIMITONLY = 19,
+ DIMINISHING_DRAGONS_BREATH = 20,
};
enum SummonCategory
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index 991b03c44e4..7c3b26c2646 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -29,10 +29,9 @@
#endif
template<class T>
-void
-ConfusedMovementGenerator<T>::Initialize(T &unit)
+void ConfusedMovementGenerator<T>::Initialize(T &unit)
{
- const float wander_distance = 11;
+ float const wanderDistance = 4;
float x, y, z;
x = unit.GetPositionX();
y = unit.GetPositionY();
@@ -47,8 +46,8 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
for (uint8 idx = 0; idx <= MAX_CONF_WAYPOINTS; ++idx)
{
- float wanderX = x + wander_distance*(float)rand_norm() - wander_distance/2;
- float wanderY = y + wander_distance*(float)rand_norm() - wander_distance/2;
+ float wanderX = x + wanderDistance * (float)rand_norm() - wanderDistance/2;
+ float wanderY = y + wanderDistance * (float)rand_norm() - wanderDistance/2;
Trinity::NormalizeMapCoord(wanderX);
Trinity::NormalizeMapCoord(wanderY);
@@ -68,7 +67,7 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
}
// Taken from FleeingMovementGenerator
- if (!(new_z - z) || wander_distance / fabs(new_z - z) > 1.0f)
+ if (!(new_z - z) || wanderDistance / fabs(new_z - z) > 1.0f)
{
i_waypoints[idx][0] = wanderX;
i_waypoints[idx][1] = wanderY;
@@ -89,29 +88,26 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
unit.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit.CastStop();
unit.StopMoving();
- unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
+ unit.AddUnitMovementFlag(MOVEMENTFLAG_WALKING); // Should actually be splineflag
unit.AddUnitState(UNIT_STAT_CONFUSED);
}
template<>
-void
-ConfusedMovementGenerator<Creature>::_InitSpecific(Creature &creature, bool &is_water_ok, bool &is_land_ok)
+void ConfusedMovementGenerator<Creature>::_InitSpecific(Creature &creature, bool &is_water_ok, bool &is_land_ok)
{
is_water_ok = creature.canSwim();
is_land_ok = creature.canWalk();
}
template<>
-void
-ConfusedMovementGenerator<Player>::_InitSpecific(Player &, bool &is_water_ok, bool &is_land_ok)
+void ConfusedMovementGenerator<Player>::_InitSpecific(Player &, bool &is_water_ok, bool &is_land_ok)
{
is_water_ok = true;
is_land_ok = true;
}
template<class T>
-void
-ConfusedMovementGenerator<T>::Reset(T &unit)
+void ConfusedMovementGenerator<T>::Reset(T &unit)
{
i_nextMove = 1;
i_nextMoveTime.Reset(0);
@@ -120,8 +116,7 @@ ConfusedMovementGenerator<T>::Reset(T &unit)
}
template<class T>
-bool
-ConfusedMovementGenerator<T>::Update(T &unit, const uint32 diff)
+bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 diff)
{
if (!&unit)
return true;
@@ -141,7 +136,7 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 diff)
unit.ClearUnitState(UNIT_STAT_MOVE);
i_nextMove = urand(1, MAX_CONF_WAYPOINTS);
- i_nextMoveTime.Reset(urand(0, 1500-1)); // TODO: check the minimum reset time, should be probably higher
+ i_nextMoveTime.Reset(urand(100, 1000));
}
}
}
@@ -164,11 +159,11 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 diff)
}
template<class T>
-void
-ConfusedMovementGenerator<T>::Finalize(T &unit)
+void ConfusedMovementGenerator<T>::Finalize(T &unit)
{
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit.ClearUnitState(UNIT_STAT_CONFUSED);
+
if (unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
unit.SetTarget(unit.getVictim()->GetGUID());
}
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index 3484eb3d19e..6d5c803bea8 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -58,7 +58,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 diff)
arrived = true;
return false;
}
- else if (!unit.HasUnitState(UNIT_STAT_MOVE))
+ else if (!unit.HasUnitState(UNIT_STAT_MOVE) && !unit.HasUnitState(UNIT_STAT_JUMPING))
{
i_destinationHolder.StartTravel(traveller);
}
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 808d8318ea9..396b0c489f2 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -351,7 +351,7 @@ void FlightPathMovementGenerator::InitEndGridInfo()
void FlightPathMovementGenerator::PreloadEndGrid()
{
// used to preload the final grid where the flightmaster is
- Map* endMap = sMapMgr->FindMap(m_endMapId);
+ Map* endMap = sMapMgr->FindBaseNonInstanceMap(m_endMapId);
// Load the grid
if (endMap)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index b925150ef71..d641971faa0 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -36,22 +36,22 @@ m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
{
}
-bool OPvPCapturePoint::HandlePlayerEnter(Player* plr)
+bool OPvPCapturePoint::HandlePlayerEnter(Player* player)
{
if (m_capturePoint)
{
- plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
- plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
- plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ 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[plr->GetTeamId()].insert(plr).second;
+ return m_activePlayers[player->GetTeamId()].insert(player).second;
}
-void OPvPCapturePoint::HandlePlayerLeave(Player* plr)
+void OPvPCapturePoint::HandlePlayerLeave(Player* player)
{
if (m_capturePoint)
- plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
- m_activePlayers[plr->GetTeamId()].erase(plr);
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
+ m_activePlayers[player->GetTeamId()].erase(player);
}
void OPvPCapturePoint::SendChangePhase()
@@ -239,24 +239,24 @@ OutdoorPvP::~OutdoorPvP()
DeleteSpawns();
}
-void OutdoorPvP::HandlePlayerEnterZone(Player* plr, uint32 /*zone*/)
+void OutdoorPvP::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
{
- m_players[plr->GetTeamId()].insert(plr);
+ m_players[player->GetTeamId()].insert(player);
}
-void OutdoorPvP::HandlePlayerLeaveZone(Player* plr, uint32 /*zone*/)
+void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
{
// inform the objectives of the leaving
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- itr->second->HandlePlayerLeave(plr);
+ itr->second->HandlePlayerLeave(player);
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
- if (!plr->GetSession()->PlayerLogout())
- SendRemoveWorldStates(plr);
- m_players[plr->GetTeamId()].erase(plr);
- sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", plr->GetName());
+ if (!player->GetSession()->PlayerLogout())
+ SendRemoveWorldStates(player);
+ m_players[player->GetTeamId()].erase(player);
+ sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName());
}
-void OutdoorPvP::HandlePlayerResurrects(Player* /*plr*/, uint32 /*zone*/)
+void OutdoorPvP::HandlePlayerResurrects(Player* /*player*/, uint32 /*zone*/)
{
}
@@ -463,88 +463,88 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
}
}
-bool OutdoorPvP::IsInsideObjective(Player* plr) const
+bool OutdoorPvP::IsInsideObjective(Player* player) const
{
for (OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if (itr->second->IsInsideObjective(plr))
+ if (itr->second->IsInsideObjective(player))
return true;
return false;
}
-bool OPvPCapturePoint::IsInsideObjective(Player* plr) const
+bool OPvPCapturePoint::IsInsideObjective(Player* player) const
{
- return m_activePlayers[plr->GetTeamId()].find(plr) != m_activePlayers[plr->GetTeamId()].end();
+ return m_activePlayers[player->GetTeamId()].find(player) != m_activePlayers[player->GetTeamId()].end();
}
-bool OutdoorPvP::HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go)
+bool OutdoorPvP::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if (itr->second->HandleCustomSpell(plr, spellId, go))
+ if (itr->second->HandleCustomSpell(player, spellId, go))
return true;
return false;
}
-bool OPvPCapturePoint::HandleCustomSpell(Player* plr, uint32 /*spellId*/, GameObject* /*go*/)
+bool OPvPCapturePoint::HandleCustomSpell(Player* player, uint32 /*spellId*/, GameObject* /*go*/)
{
- if (!plr->IsOutdoorPvPActive())
+ if (!player->IsOutdoorPvPActive())
return false;
return false;
}
-bool OutdoorPvP::HandleOpenGo(Player* plr, uint64 guid)
+bool OutdoorPvP::HandleOpenGo(Player* player, uint64 guid)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if (itr->second->HandleOpenGo(plr, guid) >= 0)
+ if (itr->second->HandleOpenGo(player, guid) >= 0)
return true;
return false;
}
-bool OutdoorPvP::HandleGossipOption(Player* plr, uint64 guid, uint32 id)
+bool OutdoorPvP::HandleGossipOption(Player* player, uint64 guid, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if (itr->second->HandleGossipOption(plr, guid, id))
+ if (itr->second->HandleGossipOption(player, guid, id))
return true;
return false;
}
-bool OutdoorPvP::CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso)
+bool OutdoorPvP::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if (itr->second->CanTalkTo(plr, c, gso))
+ if (itr->second->CanTalkTo(player, c, gso))
return true;
return false;
}
-bool OutdoorPvP::HandleDropFlag(Player* plr, uint32 id)
+bool OutdoorPvP::HandleDropFlag(Player* player, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- if (itr->second->HandleDropFlag(plr, id))
+ if (itr->second->HandleDropFlag(player, id))
return true;
return false;
}
-bool OPvPCapturePoint::HandleGossipOption(Player* /*plr*/, uint64 /*guid*/, uint32 /*id*/)
+bool OPvPCapturePoint::HandleGossipOption(Player* /*player*/, uint64 /*guid*/, uint32 /*id*/)
{
return false;
}
-bool OPvPCapturePoint::CanTalkTo(Player* /*plr*/, Creature* /*c*/, GossipMenuItems const& /*gso*/)
+bool OPvPCapturePoint::CanTalkTo(Player* /*player*/, Creature* /*c*/, GossipMenuItems const& /*gso*/)
{
return false;
}
-bool OPvPCapturePoint::HandleDropFlag(Player* /*plr*/, uint32 /*id*/)
+bool OPvPCapturePoint::HandleDropFlag(Player* /*player*/, uint32 /*id*/)
{
return false;
}
-int32 OPvPCapturePoint::HandleOpenGo(Player* /*plr*/, uint64 guid)
+int32 OPvPCapturePoint::HandleOpenGo(Player* /*player*/, uint64 guid)
{
std::map<uint64, uint32>::iterator itr = m_ObjectTypes.find(guid);
if (itr != m_ObjectTypes.end())
@@ -554,7 +554,7 @@ int32 OPvPCapturePoint::HandleOpenGo(Player* /*plr*/, uint64 guid)
return -1;
}
-bool OutdoorPvP::HandleAreaTrigger(Player* /*plr*/, uint32 /*trigger*/)
+bool OutdoorPvP::HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/)
{
return false;
}
@@ -572,9 +572,9 @@ void OutdoorPvP::RegisterZone(uint32 zoneId)
sOutdoorPvPMgr->AddZone(zoneId, this);
}
-bool OutdoorPvP::HasPlayer(Player* plr) const
+bool OutdoorPvP::HasPlayer(Player* player) const
{
- return m_players[plr->GetTeamId()].find(plr) != m_players[plr->GetTeamId()].end();
+ return m_players[player->GetTeamId()].find(player) != m_players[player->GetTeamId()].end();
}
void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index 1969d1f98e1..c57eddc7f86 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -104,15 +104,15 @@ class OPvPCapturePoint
void SendObjectiveComplete(uint32 id, uint64 guid);
// used when player is activated/inactivated in the area
- virtual bool HandlePlayerEnter(Player* plr);
- virtual void HandlePlayerLeave(Player* plr);
+ virtual bool HandlePlayerEnter(Player* player);
+ virtual void HandlePlayerLeave(Player* player);
// checks if player is in range of a capture credit marker
- bool IsInsideObjective(Player* plr) const;
+ bool IsInsideObjective(Player* player) const;
- virtual bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go);
+ virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
- virtual int32 HandleOpenGo(Player* plr, uint64 guid);
+ virtual int32 HandleOpenGo(Player* player, uint64 guid);
// 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);
@@ -123,11 +123,11 @@ class OPvPCapturePoint
virtual void SendChangePhase();
- virtual bool HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid);
+ virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
- virtual bool CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso);
+ virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
- virtual bool HandleDropFlag(Player* plr, uint32 spellId);
+ virtual bool HandleDropFlag(Player* player, uint32 spellId);
virtual void DeleteSpawns();
@@ -208,13 +208,13 @@ class OutdoorPvP : public ZoneScript
virtual void FillInitialWorldStates(WorldPacket & /*data*/) {}
// called when a player triggers an areatrigger
- virtual bool HandleAreaTrigger(Player* plr, uint32 trigger);
+ virtual bool HandleAreaTrigger(Player* player, uint32 trigger);
// called on custom spell
- virtual bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go);
+ virtual bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
// called on go use
- virtual bool HandleOpenGo(Player* plr, uint64 guid);
+ virtual bool HandleOpenGo(Player* player, uint64 guid);
// setup stuff
virtual bool SetupOutdoorPvP() {return true;}
@@ -234,18 +234,18 @@ class OutdoorPvP : public ZoneScript
virtual void HandleKillImpl(Player* /*killer*/, Unit* /*killed*/) {}
// checks if player is in range of a capture credit marker
- bool IsInsideObjective(Player* plr) const;
+ bool IsInsideObjective(Player* player) const;
// awards rewards for player kill
- virtual void AwardKillBonus(Player* /*plr*/) {}
+ virtual void AwardKillBonus(Player* /*player*/) {}
uint32 GetTypeId() {return m_TypeId;}
- virtual bool HandleDropFlag(Player* plr, uint32 spellId);
+ virtual bool HandleDropFlag(Player* player, uint32 spellId);
- virtual bool HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid);
+ virtual bool HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
- virtual bool CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso);
+ virtual bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso);
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
@@ -261,14 +261,14 @@ class OutdoorPvP : public ZoneScript
bool m_sendUpdate;
// world state stuff
- virtual void SendRemoveWorldStates(Player* /*plr*/) {}
+ virtual void SendRemoveWorldStates(Player* /*player*/) {}
void BroadcastPacket(WorldPacket & data) const;
- virtual void HandlePlayerEnterZone(Player* plr, uint32 zone);
- virtual void HandlePlayerLeaveZone(Player* plr, uint32 zone);
+ virtual void HandlePlayerEnterZone(Player* player, uint32 zone);
+ virtual void HandlePlayerLeaveZone(Player* player, uint32 zone);
- virtual void HandlePlayerResurrects(Player* plr, uint32 zone);
+ virtual void HandlePlayerResurrects(Player* player, uint32 zone);
void AddCapturePoint(OPvPCapturePoint* cp)
{
@@ -285,7 +285,7 @@ class OutdoorPvP : public ZoneScript
void RegisterZone(uint32 zoneid);
- bool HasPlayer(Player* plr) const;
+ bool HasPlayer(Player* player) const;
void TeamCastSpell(TeamId team, int32 spellId);
};
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index dda0e7bcb61..4a0da1d3b55 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -115,31 +115,31 @@ void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
m_OutdoorPvPMap[zoneid] = handle;
}
-void OutdoorPvPMgr::HandlePlayerEnterZone(Player* plr, uint32 zoneid)
+void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
if (itr == m_OutdoorPvPMap.end())
return;
- if (itr->second->HasPlayer(plr))
+ if (itr->second->HasPlayer(player))
return;
- itr->second->HandlePlayerEnterZone(plr, zoneid);
- sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
+ itr->second->HandlePlayerEnterZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
}
-void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* plr, uint32 zoneid)
+void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
if (itr == m_OutdoorPvPMap.end())
return;
// teleport: remove once in removefromworld, once in updatezone
- if (!itr->second->HasPlayer(plr))
+ if (!itr->second->HasPlayer(player))
return;
- itr->second->HandlePlayerLeaveZone(plr, zoneid);
- sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
+ itr->second->HandlePlayerLeaveZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
}
OutdoorPvP* OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid)
@@ -164,11 +164,11 @@ void OutdoorPvPMgr::Update(uint32 diff)
}
}
-bool OutdoorPvPMgr::HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go)
+bool OutdoorPvPMgr::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if ((*itr)->HandleCustomSpell(plr, spellId, go))
+ if ((*itr)->HandleCustomSpell(player, spellId, go))
return true;
}
return false;
@@ -183,21 +183,21 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId)
return NULL;
}
-bool OutdoorPvPMgr::HandleOpenGo(Player* plr, uint64 guid)
+bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if ((*itr)->HandleOpenGo(plr, guid))
+ if ((*itr)->HandleOpenGo(player, guid))
return true;
}
return false;
}
-void OutdoorPvPMgr::HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid)
+void OutdoorPvPMgr::HandleGossipOption(Player* player, uint64 guid, uint32 gossipid)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if ((*itr)->HandleGossipOption(plr, guid, gossipid))
+ if ((*itr)->HandleGossipOption(player, guid, gossipid))
return;
}
}
@@ -212,21 +212,21 @@ bool OutdoorPvPMgr::CanTalkTo(Player* player, Creature* creature, GossipMenuItem
return false;
}
-void OutdoorPvPMgr::HandleDropFlag(Player* plr, uint32 spellId)
+void OutdoorPvPMgr::HandleDropFlag(Player* player, uint32 spellId)
{
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
{
- if ((*itr)->HandleDropFlag(plr, spellId))
+ if ((*itr)->HandleDropFlag(player, spellId))
return;
}
}
-void OutdoorPvPMgr::HandlePlayerResurrects(Player* plr, uint32 zoneid)
+void OutdoorPvPMgr::HandlePlayerResurrects(Player* player, uint32 zoneid)
{
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
if (itr == m_OutdoorPvPMap.end())
return;
- if (itr->second->HasPlayer(plr))
- itr->second->HandlePlayerResurrects(plr, zoneid);
+ if (itr->second->HasPlayer(player))
+ itr->second->HandlePlayerResurrects(player, zoneid);
}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index 6f0e0ba91b9..32639cb692e 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
@@ -49,22 +49,22 @@ class OutdoorPvPMgr
void InitOutdoorPvP();
// called when a player enters an outdoor pvp area
- void HandlePlayerEnterZone(Player* plr, uint32 areaflag);
+ void HandlePlayerEnterZone(Player* player, uint32 areaflag);
// called when player leaves an outdoor pvp area
- void HandlePlayerLeaveZone(Player* plr, uint32 areaflag);
+ void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
// called when player resurrects
- void HandlePlayerResurrects(Player* plr, uint32 areaflag);
+ void HandlePlayerResurrects(Player* player, uint32 areaflag);
// return assigned outdoor pvp
OutdoorPvP* GetOutdoorPvPToZoneId(uint32 zoneid);
// handle custom (non-exist in dbc) spell if registered
- bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go);
+ bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go);
// handle custom go if registered
- bool HandleOpenGo(Player* plr, uint64 guid);
+ bool HandleOpenGo(Player* player, uint64 guid);
ZoneScript* GetZoneScript(uint32 zoneId);
@@ -76,7 +76,7 @@ class OutdoorPvPMgr
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso);
- void HandleDropFlag(Player* plr, uint32 spellId);
+ void HandleDropFlag(Player* player, uint32 spellId);
private:
typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 293933c8bb9..bd8840ff8a8 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -260,7 +260,7 @@ void PoolGroup<Quest>::Despawn1Object(uint32 quest_id)
QuestRelations::iterator lastElement = questMap->upper_bound(itr->second);
for (; qitr != lastElement; ++qitr)
{
- if (qitr->first == itr->second)
+ if (qitr->first == itr->second && qitr->second == itr->first)
{
questMap->erase(qitr); // iterator is now no more valid
break; // but we can exit loop since the element is found
@@ -279,7 +279,7 @@ void PoolGroup<Quest>::Despawn1Object(uint32 quest_id)
QuestRelations::iterator lastElement = questMap->upper_bound(itr->second);
for (; qitr != lastElement; ++qitr)
{
- if (qitr->first == itr->second)
+ if (qitr->first == itr->second && qitr->second == itr->first)
{
questMap->erase(qitr); // iterator is now no more valid
break; // but we can exit loop since the element is found
@@ -359,7 +359,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
sObjectMgr->AddCreatureToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only)
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid));
+ Map* map = sMapMgr->CreateBaseMap(data->mapid);
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
@@ -385,7 +385,7 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj)
sObjectMgr->AddGameobjectToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid));
+ Map* map = sMapMgr->CreateBaseMap(data->mapid);
// We use current coords to unspawn, not spawn coords since creature can have changed grid
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 9650afb60e2..29bd95a73a3 100755
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -22,127 +22,132 @@
Quest::Quest(Field* questRecord)
{
- QuestId = questRecord[0].GetUInt32();
- QuestMethod = questRecord[1].GetUInt32();
- ZoneOrSort = questRecord[2].GetInt32();
- SkillOrClassMask = questRecord[3].GetInt32();
- MinLevel = questRecord[4].GetUInt32();
- MaxLevel = questRecord[5].GetUInt32();
- QuestLevel = questRecord[6].GetInt32();
- Type = questRecord[7].GetUInt32();
- RequiredRaces = questRecord[8].GetUInt32();
- RequiredSkillValue = questRecord[9].GetUInt32();
- RepObjectiveFaction = questRecord[10].GetUInt32();
- RepObjectiveValue = questRecord[11].GetInt32();
- RepObjectiveFaction2 = questRecord[12].GetUInt32();
- RepObjectiveValue2 = questRecord[13].GetInt32();
- RequiredMinRepFaction = questRecord[14].GetUInt32();
- RequiredMinRepValue = questRecord[15].GetInt32();
- RequiredMaxRepFaction = questRecord[16].GetUInt32();
- RequiredMaxRepValue = questRecord[17].GetInt32();
- SuggestedPlayers = questRecord[18].GetUInt32();
- LimitTime = questRecord[19].GetUInt32();
- QuestFlags = questRecord[20].GetUInt32();
- uint32 SpecialFlags = questRecord[21].GetUInt16();
- CharTitleId = questRecord[22].GetUInt32();
- PlayersSlain = questRecord[23].GetUInt32();
- BonusTalents = questRecord[24].GetUInt32();
- RewArenaPoints = questRecord[25].GetInt32();
- PrevQuestId = questRecord[26].GetInt32();
- NextQuestId = questRecord[27].GetInt32();
- ExclusiveGroup = questRecord[28].GetInt32();
- NextQuestInChain = questRecord[29].GetUInt32();
- XPId = questRecord[30].GetUInt32();
- SrcItemId = questRecord[31].GetUInt32();
- SrcItemCount = questRecord[32].GetUInt32();
- SrcSpell = questRecord[33].GetUInt32();
- Title = questRecord[34].GetString();
- Details = questRecord[35].GetString();
- Objectives = questRecord[36].GetString();
- OfferRewardText = questRecord[37].GetString();
- RequestItemsText = questRecord[38].GetString();
- EndText = questRecord[39].GetString();
- CompletedText = questRecord[40].GetString();
+ Id = questRecord[0].GetUInt32();
+ Method = questRecord[1].GetUInt32();
+ Level = questRecord[2].GetInt32();
+ MinLevel = questRecord[3].GetUInt32();
+ MaxLevel = questRecord[4].GetUInt32();
+ ZoneOrSort = questRecord[5].GetInt32();
+ Type = questRecord[6].GetUInt32();
+ SuggestedPlayers = questRecord[7].GetUInt32();
+ LimitTime = questRecord[8].GetUInt32();
+ RequiredClasses = questRecord[9].GetUInt32();
+ RequiredRaces = questRecord[10].GetUInt32();
+ RequiredSkillId = questRecord[11].GetUInt32();
+ RequiredSkillPoints = questRecord[12].GetUInt32();
+ RequiredFactionId1 = questRecord[13].GetUInt32();
+ RequiredFactionId2 = questRecord[14].GetUInt32();
+ RequiredFactionValue1 = questRecord[15].GetInt32();
+ RequiredFactionValue2 = questRecord[16].GetInt32();
+ RequiredMinRepFaction = questRecord[17].GetUInt32();
+ RequiredMaxRepFaction = questRecord[18].GetUInt32();
+ RequiredMinRepValue = questRecord[19].GetInt32();
+ RequiredMaxRepValue = questRecord[20].GetInt32();
+ PrevQuestId = questRecord[21].GetInt32();
+ NextQuestId = questRecord[22].GetInt32();
+ ExclusiveGroup = questRecord[23].GetInt32();
+ NextQuestIdChain = questRecord[24].GetUInt32();
+ RewardXPId = questRecord[25].GetUInt32();
+ RewardOrRequiredMoney = questRecord[26].GetInt32();
+ RewardMoneyMaxLevel = questRecord[27].GetUInt32();
+ RewardSpell = questRecord[28].GetUInt32();
+ RewardSpellCast = questRecord[29].GetInt32();
+ RewardHonor = questRecord[30].GetUInt32();
+ RewardHonorMultiplier = questRecord[31].GetFloat();
+ RewardMailTemplateId = questRecord[32].GetUInt32();
+ RewardMailDelay = questRecord[33].GetUInt32();
+ SourceItemId = questRecord[34].GetUInt32();
+ SourceItemIdCount = questRecord[35].GetUInt32();
+ SourceSpellid = questRecord[36].GetUInt32();
+ Flags = questRecord[37].GetUInt32();
+ uint32 SpecialFlags = questRecord[38].GetUInt16();
+ RewardTitleId = questRecord[39].GetUInt32();
+ RequiredPlayerKills = questRecord[40].GetUInt32();
+ RewardTalents = questRecord[41].GetUInt32();
+ RewardArenaPoints = questRecord[42].GetInt32();
- for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ObjectiveText[i] = questRecord[41+i].GetString();
+ for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ RewardItemId[i] = questRecord[43+i].GetUInt32();
- for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- ReqItemId[i] = questRecord[45+i].GetUInt32();
+ for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ RewardItemIdCount[i] = questRecord[47+i].GetUInt32();
- for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- ReqItemCount[i] = questRecord[51+i].GetUInt32();
+ for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ RewardChoiceItemId[i] = questRecord[51+i].GetUInt32();
- for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- ReqSourceId[i] = questRecord[57+i].GetUInt32();
+ for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ RewardChoiceItemCount[i] = questRecord[57+i].GetUInt32();
+
+ for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
+ RewardFactionId[i] = questRecord[63+i].GetUInt32();
- for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- ReqSourceCount[i] = questRecord[61+i].GetUInt32();
+ for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
+ RewardFactionValueId[i] = questRecord[68+i].GetInt32();
- for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ReqCreatureOrGOId[i] = questRecord[65+i].GetInt32();
+ for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
+ RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32();
+
+ PointMapId = questRecord[78].GetUInt32();
+ PointX = questRecord[79].GetFloat();
+ PointY = questRecord[80].GetFloat();
+ PointOption = questRecord[81].GetUInt32();
+ Title = questRecord[82].GetString();
+ Objectives = questRecord[83].GetString();
+ Details = questRecord[84].GetString();
+ EndText = questRecord[85].GetString();
+ OfferRewardText = questRecord[86].GetString();
+ RequestItemsText = questRecord[87].GetString();
+ CompletedText = questRecord[88].GetString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ReqCreatureOrGOCount[i] = questRecord[69+i].GetUInt32();
+ RequiredNpcOrGo[i] = questRecord[89+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ReqSpell[i] = questRecord[73+i].GetUInt32();
+ RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt32();
- for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewChoiceItemId[i] = questRecord[77+i].GetUInt32();
+ for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
+ RequiredSourceItemid[i] = questRecord[97+i].GetUInt32();
- for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewChoiceItemCount[i] = questRecord[83+i].GetUInt32();
+ for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
+ RequiredSourceItemId[i] = questRecord[101+i].GetUInt32();
- for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewItemId[i] = questRecord[89+i].GetUInt32();
+ for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
+ RequiredItemId[i] = questRecord[105+i].GetUInt32();
- for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewItemCount[i] = questRecord[93+i].GetUInt32();
+ for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
+ RequiredItemCount[i] = questRecord[111+i].GetUInt32();
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewRepFaction[i] = questRecord[97+i].GetUInt32();
+ for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ RequiredSpellCast[i] = questRecord[117+i].GetUInt32();
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewRepValueId[i] = questRecord[102+i].GetInt32();
+ // int8 Unknown0 = questRecord[121].GetUInt32();
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewRepValue[i] = questRecord[107+i].GetInt32();
-
- RewHonorAddition = questRecord[112].GetUInt32();
- RewHonorMultiplier = questRecord[113].GetFloat();
- RewOrReqMoney = questRecord[114].GetInt32();
- RewMoneyMaxLevel = questRecord[115].GetUInt32();
- RewSpell = questRecord[116].GetUInt32();
- RewSpellCast = questRecord[117].GetInt32();
- RewMailTemplateId = questRecord[118].GetUInt32();
- RewMailDelaySecs = questRecord[119].GetUInt32();
- PointMapId = questRecord[120].GetUInt32();
- PointX = questRecord[121].GetFloat();
- PointY = questRecord[122].GetFloat();
- PointOpt = questRecord[123].GetUInt32();
+ for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ ObjectiveText[i] = questRecord[122+i].GetString();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmote[i] = questRecord[124+i].GetUInt32();
+ DetailsEmote[i] = questRecord[126+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmoteDelay[i] = questRecord[128+i].GetUInt32();
+ DetailsEmoteDelay[i] = questRecord[130+i].GetUInt32();
- IncompleteEmote = questRecord[132].GetUInt32();
- CompleteEmote = questRecord[133].GetUInt32();
+ EmoteOnIncomplete = questRecord[134].GetUInt32();
+ EmoteOnComplete = questRecord[135].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmote[i] = questRecord[134+i].GetInt32();
+ OfferRewardEmote[i] = questRecord[136+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmoteDelay[i] = questRecord[138+i].GetInt32();
+ OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32();
+
+ StartScript = questRecord[144].GetUInt32();
+ CompleteScript = questRecord[145].GetUInt32();
- QuestStartScript = questRecord[142].GetUInt32();
- QuestCompleteScript = questRecord[143].GetUInt32();
+ // int32 WDBVerified = questRecord[146].GetInt32();
- QuestFlags |= SpecialFlags << 20;
- if (QuestFlags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
- QuestFlags |= QUEST_FLAGS_AUTO_ACCEPT;
+ Flags |= SpecialFlags << 20;
+ if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
+ Flags |= QUEST_FLAGS_AUTO_ACCEPT;
m_reqitemscount = 0;
m_reqCreatureOrGOcount = 0;
@@ -150,19 +155,19 @@ Quest::Quest(Field* questRecord)
m_rewchoiceitemscount = 0;
for (int i=0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- if (ReqItemId[i])
+ if (RequiredItemId[i])
++m_reqitemscount;
for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i)
- if (ReqCreatureOrGOId[i])
+ if (RequiredNpcOrGo[i])
++m_reqCreatureOrGOcount;
for (int i=0; i < QUEST_REWARDS_COUNT; ++i)
- if (RewItemId[i])
+ if (RewardItemId[i])
++m_rewitemscount;
for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- if (RewChoiceItemId[i])
+ if (RewardChoiceItemId[i])
++m_rewchoiceitemscount;
}
@@ -170,7 +175,7 @@ uint32 Quest::XPValue(Player* player) const
{
if (player)
{
- int32 quest_level = (QuestLevel == -1 ? player->getLevel() : QuestLevel);
+ int32 quest_level = (Level == -1 ? player->getLevel() : Level);
const QuestXPEntry* xpentry = sQuestXPStore.LookupEntry(quest_level);
if (!xpentry)
return 0;
@@ -181,7 +186,7 @@ uint32 Quest::XPValue(Player* player) const
else if (diffFactor > 10)
diffFactor = 10;
- uint32 xp = diffFactor * xpentry->Exp[XPId] / 10;
+ uint32 xp = diffFactor * xpentry->Exp[RewardXPId] / 10;
if (xp <= 100)
xp = 5 * ((xp + 2) / 5);
else if (xp <= 500)
@@ -199,15 +204,15 @@ uint32 Quest::XPValue(Player* player) const
int32 Quest::GetRewOrReqMoney() const
{
- if (RewOrReqMoney <= 0)
- return RewOrReqMoney;
+ if (RewardOrRequiredMoney <= 0)
+ return RewardOrRequiredMoney;
- return int32(RewOrReqMoney * sWorld->getRate(RATE_DROP_MONEY));
+ return int32(RewardOrRequiredMoney * sWorld->getRate(RATE_DROP_MONEY));
}
bool Quest::IsAutoComplete() const
{
- return QuestMethod == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE);
+ return Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE);
}
bool Quest::IsAllowedInRaid() const
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 90e52660160..fc9a432a11b 100755
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -141,7 +141,7 @@ enum __QuestFlags
QUEST_FLAGS_UNAVAILABLE = 0x00004000, // Used on quests that are not generically available
QUEST_FLAGS_WEEKLY = 0x00008000,
QUEST_FLAGS_AUTOCOMPLETE = 0x00010000, // auto complete
- QUEST_FLAGS_SPECIAL_ITEM = 0x00020000, // has something to do with ReqItemId and SrcItemId
+ QUEST_FLAGS_SPECIAL_ITEM = 0x00020000, // has something to do with RequiredItemId and SourceItemId
QUEST_FLAGS_OBJ_TEXT = 0x00040000, // use Objective text as Complete text
QUEST_FLAGS_AUTO_ACCEPT = 0x00080000, // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future.
@@ -185,24 +185,25 @@ class Quest
Quest(Field* questRecord);
uint32 XPValue(Player* player) const;
- bool HasFlag(uint32 flag) const { return (QuestFlags & flag) != 0; }
- void SetFlag(uint32 flag) { QuestFlags |= flag; }
+ bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; }
+ void SetFlag(uint32 flag) { Flags |= flag; }
// table data accessors:
- uint32 GetQuestId() const { return QuestId; }
- uint32 GetQuestMethod() const { return QuestMethod; }
+ uint32 GetQuestId() const { return Id; }
+ uint32 GetQuestMethod() const { return Method; }
int32 GetZoneOrSort() const { return ZoneOrSort; }
- int32 GetSkillOrClassMask() const { return SkillOrClassMask; }
uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; }
- uint32 GetQuestLevel() const { return QuestLevel; }
+ uint32 GetQuestLevel() const { return Level; }
uint32 GetType() const { return Type; }
+ uint32 GetRequiredClasses() const { return RequiredClasses; }
uint32 GetRequiredRaces() const { return RequiredRaces; }
- uint32 GetRequiredSkillValue() const { return RequiredSkillValue; }
- uint32 GetRepObjectiveFaction() const { return RepObjectiveFaction; }
- int32 GetRepObjectiveValue() const { return RepObjectiveValue; }
- uint32 GetRepObjectiveFaction2() const { return RepObjectiveFaction2; }
- int32 GetRepObjectiveValue2() const { return RepObjectiveValue2; }
+ uint32 GetRequiredSkill() const { return RequiredSkillId; }
+ uint32 GetRequiredSkillValue() const { return RequiredSkillPoints; }
+ uint32 GetRepObjectiveFaction() const { return RequiredFactionId1; }
+ int32 GetRepObjectiveValue() const { return RequiredFactionValue1; }
+ uint32 GetRepObjectiveFaction2() const { return RequiredFactionId2; }
+ int32 GetRepObjectiveValue2() const { return RequiredFactionValue2; }
uint32 GetRequiredMinRepFaction() const { return RequiredMinRepFaction; }
int32 GetRequiredMinRepValue() const { return RequiredMinRepValue; }
uint32 GetRequiredMaxRepFaction() const { return RequiredMaxRepFaction; }
@@ -212,15 +213,15 @@ class Quest
int32 GetPrevQuestId() const { return PrevQuestId; }
int32 GetNextQuestId() const { return NextQuestId; }
int32 GetExclusiveGroup() const { return ExclusiveGroup; }
- uint32 GetNextQuestInChain() const { return NextQuestInChain; }
- uint32 GetCharTitleId() const { return CharTitleId; }
- uint32 GetPlayersSlain() const { return PlayersSlain; }
- uint32 GetBonusTalents() const { return BonusTalents; }
- int32 GetRewArenaPoints() const {return RewArenaPoints; }
- uint32 GetXPId() const { return XPId; }
- uint32 GetSrcItemId() const { return SrcItemId; }
- uint32 GetSrcItemCount() const { return SrcItemCount; }
- uint32 GetSrcSpell() const { return SrcSpell; }
+ uint32 GetNextQuestInChain() const { return NextQuestIdChain; }
+ uint32 GetCharTitleId() const { return RewardTitleId; }
+ uint32 GetPlayersSlain() const { return RequiredPlayerKills; }
+ uint32 GetBonusTalents() const { return RewardTalents; }
+ int32 GetRewArenaPoints() const {return RewardArenaPoints; }
+ uint32 GetXPId() const { return RewardXPId; }
+ uint32 GetSrcItemId() const { return SourceItemId; }
+ uint32 GetSrcItemCount() const { return SourceItemIdCount; }
+ uint32 GetSrcSpell() const { return SourceSpellid; }
std::string GetTitle() const { return Title; }
std::string GetDetails() const { return Details; }
std::string GetObjectives() const { return Objectives; }
@@ -229,50 +230,50 @@ class Quest
std::string GetEndText() const { return EndText; }
std::string GetCompletedText() const { return CompletedText; }
int32 GetRewOrReqMoney() const;
- uint32 GetRewHonorAddition() const { return RewHonorAddition; }
- float GetRewHonorMultiplier() const { return RewHonorMultiplier; }
- uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; }
+ uint32 GetRewHonorAddition() const { return RewardHonor; }
+ float GetRewHonorMultiplier() const { return RewardHonorMultiplier; }
+ uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; }
// use in XP calculation at client
- uint32 GetRewSpell() const { return RewSpell; }
- int32 GetRewSpellCast() const { return RewSpellCast; }
- uint32 GetRewMailTemplateId() const { return RewMailTemplateId; }
- uint32 GetRewMailDelaySecs() const { return RewMailDelaySecs; }
+ uint32 GetRewSpell() const { return RewardSpell; }
+ int32 GetRewSpellCast() const { return RewardSpellCast; }
+ uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; }
+ uint32 GetRewMailDelaySecs() const { return RewardMailDelay; }
uint32 GetPointMapId() const { return PointMapId; }
float GetPointX() const { return PointX; }
float GetPointY() const { return PointY; }
- uint32 GetPointOpt() const { return PointOpt; }
- uint32 GetIncompleteEmote() const { return IncompleteEmote; }
- uint32 GetCompleteEmote() const { return CompleteEmote; }
- uint32 GetQuestStartScript() const { return QuestStartScript; }
- uint32 GetQuestCompleteScript() const { return QuestCompleteScript; }
- bool IsRepeatable() const { return QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE; }
+ uint32 GetPointOpt() const { return PointOption; }
+ uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; }
+ uint32 GetCompleteEmote() const { return EmoteOnComplete; }
+ uint32 GetQuestStartScript() const { return StartScript; }
+ uint32 GetQuestCompleteScript() const { return CompleteScript; }
+ bool IsRepeatable() const { return Flags & QUEST_TRINITY_FLAGS_REPEATABLE; }
bool IsAutoComplete() const;
- uint32 GetFlags() const { return QuestFlags; }
- bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; }
- bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; }
- bool IsDailyOrWeekly() const { return QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
- bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; }
+ uint32 GetFlags() const { return Flags; }
+ bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; }
+ bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; }
+ bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
+ bool IsAutoAccept() const { return Flags & QUEST_FLAGS_AUTO_ACCEPT; }
bool IsRaidQuest() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25; }
bool IsAllowedInRaid() const;
- bool IsDFQuest() const { return QuestFlags & QUEST_TRINITY_FLAGS_DF_QUEST; }
+ bool IsDFQuest() const { return Flags & QUEST_TRINITY_FLAGS_DF_QUEST; }
uint32 CalculateHonorGain(uint8 level) const;
// multiple values
std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
- uint32 ReqItemId[QUEST_ITEM_OBJECTIVES_COUNT];
- uint32 ReqItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
- uint32 ReqSourceId[QUEST_SOURCE_ITEM_IDS_COUNT];
- uint32 ReqSourceCount[QUEST_SOURCE_ITEM_IDS_COUNT];
- int32 ReqCreatureOrGOId[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject
- uint32 ReqCreatureOrGOCount[QUEST_OBJECTIVES_COUNT];
- uint32 ReqSpell[QUEST_OBJECTIVES_COUNT];
- uint32 RewChoiceItemId[QUEST_REWARD_CHOICES_COUNT];
- uint32 RewChoiceItemCount[QUEST_REWARD_CHOICES_COUNT];
- uint32 RewItemId[QUEST_REWARDS_COUNT];
- uint32 RewItemCount[QUEST_REWARDS_COUNT];
- uint32 RewRepFaction[QUEST_REPUTATIONS_COUNT];
- int32 RewRepValueId[QUEST_REPUTATIONS_COUNT];
- int32 RewRepValue[QUEST_REPUTATIONS_COUNT];
+ uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT];
+ uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
+ uint32 RequiredSourceItemid[QUEST_SOURCE_ITEM_IDS_COUNT];
+ uint32 RequiredSourceItemId[QUEST_SOURCE_ITEM_IDS_COUNT];
+ int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject
+ uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT];
+ uint32 RequiredSpellCast[QUEST_OBJECTIVES_COUNT];
+ uint32 RewardChoiceItemId[QUEST_REWARD_CHOICES_COUNT];
+ uint32 RewardChoiceItemCount[QUEST_REWARD_CHOICES_COUNT];
+ uint32 RewardItemId[QUEST_REWARDS_COUNT];
+ uint32 RewardItemIdCount[QUEST_REWARDS_COUNT];
+ uint32 RewardFactionId[QUEST_REPUTATIONS_COUNT];
+ int32 RewardFactionValueId[QUEST_REPUTATIONS_COUNT];
+ int32 RewardFactionValueIdOverride[QUEST_REPUTATIONS_COUNT];
uint32 DetailsEmote[QUEST_EMOTE_COUNT];
uint32 DetailsEmoteDelay[QUEST_EMOTE_COUNT];
uint32 OfferRewardEmote[QUEST_EMOTE_COUNT];
@@ -297,39 +298,40 @@ class Quest
// table data
protected:
- uint32 QuestId;
- uint32 QuestMethod;
+ uint32 Id;
+ uint32 Method;
int32 ZoneOrSort;
- int32 SkillOrClassMask;
uint32 MinLevel;
uint32 MaxLevel;
- int32 QuestLevel;
+ int32 Level;
uint32 Type;
+ uint32 RequiredClasses;
uint32 RequiredRaces;
- uint32 RequiredSkillValue;
- uint32 RepObjectiveFaction;
- int32 RepObjectiveValue;
- uint32 RepObjectiveFaction2;
- int32 RepObjectiveValue2;
+ uint32 RequiredSkillId;
+ uint32 RequiredSkillPoints;
+ uint32 RequiredFactionId1;
+ int32 RequiredFactionValue1;
+ uint32 RequiredFactionId2;
+ int32 RequiredFactionValue2;
uint32 RequiredMinRepFaction;
int32 RequiredMinRepValue;
uint32 RequiredMaxRepFaction;
int32 RequiredMaxRepValue;
uint32 SuggestedPlayers;
uint32 LimitTime;
- uint32 QuestFlags;
- uint32 CharTitleId;
- uint32 PlayersSlain;
- uint32 BonusTalents;
- int32 RewArenaPoints;
+ uint32 Flags;
+ uint32 RewardTitleId;
+ uint32 RequiredPlayerKills;
+ uint32 RewardTalents;
+ int32 RewardArenaPoints;
int32 PrevQuestId;
int32 NextQuestId;
int32 ExclusiveGroup;
- uint32 NextQuestInChain;
- uint32 XPId;
- uint32 SrcItemId;
- uint32 SrcItemCount;
- uint32 SrcSpell;
+ uint32 NextQuestIdChain;
+ uint32 RewardXPId;
+ uint32 SourceItemId;
+ uint32 SourceItemIdCount;
+ uint32 SourceSpellid;
std::string Title;
std::string Details;
std::string Objectives;
@@ -337,22 +339,22 @@ class Quest
std::string RequestItemsText;
std::string EndText;
std::string CompletedText;
- uint32 RewHonorAddition;
- float RewHonorMultiplier;
- int32 RewOrReqMoney;
- uint32 RewMoneyMaxLevel;
- uint32 RewSpell;
- int32 RewSpellCast;
- uint32 RewMailTemplateId;
- uint32 RewMailDelaySecs;
+ uint32 RewardHonor;
+ float RewardHonorMultiplier;
+ int32 RewardOrRequiredMoney;
+ uint32 RewardMoneyMaxLevel;
+ uint32 RewardSpell;
+ int32 RewardSpellCast;
+ uint32 RewardMailTemplateId;
+ uint32 RewardMailDelay;
uint32 PointMapId;
float PointX;
float PointY;
- uint32 PointOpt;
- uint32 IncompleteEmote;
- uint32 CompleteEmote;
- uint32 QuestStartScript;
- uint32 QuestCompleteScript;
+ uint32 PointOption;
+ uint32 EmoteOnIncomplete;
+ uint32 EmoteOnComplete;
+ uint32 StartScript;
+ uint32 CompleteScript;
};
struct QuestStatusData
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 88c9795e896..4236ef49212 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -321,11 +321,11 @@ void Map::ScriptsProcess()
source = HashMapHolder<Corpse>::Find(step.sourceGUID);
break;
case HIGHGUID_MO_TRANSPORT:
- for (MapManager::TransportSet::iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
+ for (MapManager::TransportSet::iterator itr2 = sMapMgr->m_Transports.begin(); itr2 != sMapMgr->m_Transports.end(); ++itr2)
{
- if ((*iter)->GetGUID() == step.sourceGUID)
+ if ((*itr2)->GetGUID() == step.sourceGUID)
{
- source = *iter;
+ source = *itr2;
break;
}
}
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 120227c172d..925b352e616 100755
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -295,7 +295,6 @@ void ScriptMgr::Unload()
void ScriptMgr::LoadDatabase()
{
- sScriptSystemMgr->LoadVersion();
sScriptSystemMgr->LoadScriptTexts();
sScriptSystemMgr->LoadScriptTextsCustom();
sScriptSystemMgr->LoadScriptWaypoints();
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 8c6f5626101..d0f9a0380b0 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -23,25 +23,6 @@
ScriptPointVector const SystemMgr::_empty;
-void SystemMgr::LoadVersion()
-{
- // Get Version information
- QueryResult result = WorldDatabase.Query("SELECT script_version FROM version LIMIT 1");
-
- if (result)
- {
- Field* fields = result->Fetch();
-
- sLog->outString("TSCR: Database version is: %s", fields[0].GetCString());
- sLog->outString();
- }
- else
- {
- sLog->outError("TSCR: Missing `version`.`script_version` information.");
- sLog->outString();
- }
-}
-
void SystemMgr::LoadScriptTexts()
{
sLog->outString("TSCR: Loading Script Texts...");
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index a17033dc920..daa7fe0d596 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -64,7 +64,6 @@ class SystemMgr
typedef UNORDERED_MAP<uint32, ScriptPointVector> PointMoveMap;
//Database
- void LoadVersion();
void LoadScriptTexts();
void LoadScriptTextsCustom();
void LoadScriptWaypoints();
diff --git a/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp b/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp
index 9bbf98ce3fc..c7299eb0caa 100755
--- a/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp
@@ -107,9 +107,9 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
*Target << uint8(unk1);
if (unk1)
{
- uint8 unk2 = (crc != 0x4c1c776d); // If addon is Standard addon CRC
- *Target << uint8(unk2);
- if (unk2)
+ uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
+ *Target << uint8(unk);
+ if (unk)
Target->append(tdata, sizeof(tdata));
*Target << uint32(0);
diff --git a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp
index a67006382ff..2f8a27740be 100755
--- a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp
@@ -125,7 +125,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
recv_data >> buyout;
recv_data >> etime;
- Player* pl = GetPlayer();
+ Player* player = GetPlayer();
if (!item || !bid || !etime)
return; //check for cheaters
@@ -162,11 +162,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- Item* it = pl->GetItemByGuid(item);
+ Item* it = player->GetItemByGuid(item);
//do not allow to sell already auctioned items
if (sAuctionMgr->GetAItem(GUID_LOPART(item)))
{
- sLog->outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", pl->GetName(), GUID_LOPART(item));
+ sLog->outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", player->GetName(), GUID_LOPART(item));
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
return;
}
@@ -199,7 +199,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
//we have to take deposit :
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it, count);
- if (!pl->HasEnoughMoney(deposit))
+ if (!player->HasEnoughMoney(deposit))
{
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
return;
@@ -211,7 +211,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), count);
}
- pl->ModifyMoney(-int32(deposit));
+ player->ModifyMoney(-int32(deposit));
uint32 auction_time = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
@@ -223,7 +223,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
AH->auctioneer = GUID_LOPART(auctioneer);
AH->item_guidlow = GUID_LOPART(item);
AH->item_template = it->GetEntry();
- AH->owner = pl->GetGUIDLow();
+ AH->owner = player->GetGUIDLow();
AH->startbid = bid;
AH->bidder = 0;
AH->bid = 0;
@@ -236,13 +236,13 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
sAuctionMgr->AddAItem(it);
auctionHouse->AddAuction(AH);
- pl->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
+ player->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
it->DeleteFromInventoryDB(trans);
it->SaveToDB(trans); // recursive and not have transaction guard into self, not in inventiory and can be save standalone
AH->SaveToDB(trans);
- pl->SaveInventoryAndGoldToDB(trans);
+ player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
@@ -276,9 +276,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
- Player* pl = GetPlayer();
+ Player* player = GetPlayer();
- if (!auction || auction->owner == pl->GetGUIDLow())
+ if (!auction || auction->owner == player->GetGUIDLow())
{
//you cannot bid your own auction:
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
@@ -287,7 +287,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
// impossible have online own another character (use this for speedup check in case online owner)
Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
- if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
+ if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
@@ -306,7 +306,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
return;
}
- if (!pl->HasEnoughMoney(price))
+ if (!player->HasEnoughMoney(price))
{
//you don't have enought money!, client tests!
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
@@ -319,19 +319,19 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
{
if (auction->bidder > 0)
{
- if (auction->bidder == pl->GetGUIDLow())
- pl->ModifyMoney(-int32(price - auction->bid));
+ if (auction->bidder == player->GetGUIDLow())
+ player->ModifyMoney(-int32(price - auction->bid));
else
{
// mail to last bidder and return money
sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
- pl->ModifyMoney(-int32(price));
+ player->ModifyMoney(-int32(price));
}
}
else
- pl->ModifyMoney(-int32(price));
+ player->ModifyMoney(-int32(price));
- auction->bidder = pl->GetGUIDLow();
+ auction->bidder = player->GetGUIDLow();
auction->bid = price;
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
@@ -342,15 +342,15 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
else
{
//buyout:
- if (pl->GetGUIDLow() == auction->bidder)
- pl->ModifyMoney(-int32(auction->buyout - auction->bid));
+ if (player->GetGUIDLow() == auction->bidder)
+ player->ModifyMoney(-int32(auction->buyout - auction->bid));
else
{
- pl->ModifyMoney(-int32(auction->buyout));
+ player->ModifyMoney(-int32(auction->buyout));
if (auction->bidder) //buyout for bidded auction ..
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
}
- auction->bidder = pl->GetGUIDLow();
+ auction->bidder = player->GetGUIDLow();
auction->bid = auction->buyout;
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
@@ -367,7 +367,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
sAuctionMgr->RemoveAItem(auction->item_guidlow);
auctionHouse->RemoveAuction(auction, item_template);
}
- pl->SaveInventoryAndGoldToDB(trans);
+ player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
@@ -394,10 +394,10 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
- Player* pl = GetPlayer();
+ Player* player = GetPlayer();
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- if (auction && auction->owner == pl->GetGUIDLow())
+ if (auction && auction->owner == player->GetGUIDLow())
{
Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
if (pItem)
@@ -405,11 +405,11 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
{
uint32 auctionCut = auction->GetAuctionCut();
- if (!pl->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
+ if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
return;
//some auctionBidderNotification would be needed, but don't know that parts..
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
- pl->ModifyMoney(-int32(auctionCut));
+ player->ModifyMoney(-int32(auctionCut));
}
// Return the item by mail
std::ostringstream msgAuctionCanceledOwner;
@@ -418,7 +418,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
// item will deleted or added to received mail list
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
.AddItem(pItem)
- .SendMailTo(trans, pl, auction, MAIL_CHECK_MASK_COPIED);
+ .SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
}
else
{
@@ -431,7 +431,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", pl->GetGUIDLow(), auctionId);
+ sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
return;
}
@@ -440,7 +440,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
// Now remove the auction
- pl->SaveInventoryAndGoldToDB(trans);
+ player->SaveInventoryAndGoldToDB(trans);
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
@@ -479,7 +479,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
- Player* pl = GetPlayer();
+ Player* player = GetPlayer();
data << (uint32) 0; //add 0 as count
uint32 count = 0;
uint32 totalcount = 0;
@@ -496,7 +496,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
}
}
- auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
+ auctionHouse->BuildListBidderItems(data, player, count, totalcount);
data.put<uint32>(0, count); // add count to placeholder
data << totalcount;
data << (uint32)300; //unk 2.3.0
diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
index a468d05bcdf..83b9ab048ad 100755
--- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
@@ -658,7 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login
// Player created, save it now
- newChar.SaveToDB();
+ newChar.SaveToDB(true);
createInfo->CharCount += 1;
SQLTransaction trans = LoginDatabase.BeginTransaction();
@@ -920,7 +920,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
}
}
- if (!pCurrChar->GetMap()->AddToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
+ if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
{
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
if (at)
@@ -1170,6 +1170,8 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult result, std:
data << uint64(guid);
data << newname;
SendPacket(&data);
+
+ sWorld->UpdateCharacterNameData(guidLow, newname);
}
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
@@ -1407,9 +1409,9 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
}
CharacterDatabase.EscapeString(newname);
- if (QueryResult result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
+ if (QueryResult oldNameResult = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
{
- std::string oldname = result->Fetch()[0].GetString();
+ std::string oldname = oldNameResult->Fetch()[0].GetString();
std::string IP_str = GetRemoteAddress();
sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), IP_str.c_str(), oldname.c_str(), GUID_LOPART(guid), newname.c_str());
}
@@ -1634,7 +1636,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
trans->PAppend("UPDATE `characters` SET name='%s', race='%u', at_login=at_login & ~ %u WHERE guid='%u'", newname.c_str(), race, used_loginFlag, lowGuid);
trans->PAppend("DELETE FROM character_declinedname WHERE guid ='%u'", lowGuid);
- sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
+ sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
BattlegroundTeamId team = BG_TEAM_ALLIANCE;
diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp
index 70dc0ace8eb..852549b3f53 100755
--- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp
@@ -495,8 +495,8 @@ namespace Trinity
class EmoteChatBuilder
{
public:
- EmoteChatBuilder(Player const& pl, uint32 text_emote, uint32 emote_num, Unit const* target)
- : i_player(pl), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
+ EmoteChatBuilder(Player const& player, uint32 text_emote, uint32 emote_num, Unit const* target)
+ : i_player(player), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
void operator()(WorldPacket& data, LocaleConstant loc_idx)
{
diff --git a/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp b/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp
index 48bc305ce30..b1e6f3fdc3f 100755
--- a/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp
@@ -27,7 +27,7 @@
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
{
uint64 guid;
- Player* pl;
+ Player* player;
Player* plTarget;
recvPacket >> guid;
@@ -35,21 +35,21 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
- pl = GetPlayer();
- plTarget = pl->duel->opponent;
+ player = GetPlayer();
+ plTarget = player->duel->opponent;
- if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
+ if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
return;
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
- sLog->outStaticDebug("Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
+ sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
time_t now = time(NULL);
- pl->duel->startTimer = now;
+ player->duel->startTimer = now;
plTarget->duel->startTimer = now;
- pl->SendDuelCountdown(3000);
+ player->SendDuelCountdown(3000);
plTarget->SendDuelCountdown(3000);
}
diff --git a/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp b/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp
index 404a949371a..65865280459 100755
--- a/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp
@@ -306,9 +306,9 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
return;
}
- if (Player* plr = grp->GetInvited(guid))
+ if (Player* player = grp->GetInvited(guid))
{
- plr->UninviteFromGroup();
+ player->UninviteFromGroup();
return;
}
@@ -350,9 +350,9 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
return;
}
- if (Player* plr = grp->GetInvited(membername))
+ if (Player* player = grp->GetInvited(membername))
{
- plr->UninviteFromGroup();
+ player->UninviteFromGroup();
return;
}
diff --git a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp
index fab7bf841c2..3df59b9bba1 100755
--- a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp
@@ -205,14 +205,14 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data
ItemTemplate const* iProto = NULL;
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
- if (!qRew->RewItemId[i])
+ if (!qRew->RewardItemId[i])
continue;
- iProto = sObjectMgr->GetItemTemplate(qRew->RewItemId[i]);
+ iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]);
- data << uint32(qRew->RewItemId[i]);
+ data << uint32(qRew->RewardItemId[i]);
data << uint32(iProto ? iProto->DisplayInfoID : 0);
- data << uint32(qRew->RewItemCount[i]);
+ data << uint32(qRew->RewardItemIdCount[i]);
}
}
}
@@ -419,8 +419,8 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
- Player* plr = ObjectAccessor::FindPlayer(guid);
- data << uint8(plr ? plr->getLevel() : 0); // Level
+ Player* player = ObjectAccessor::FindPlayer(guid);
+ data << uint8(player ? player->getLevel() : 0); // Level
for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
{
@@ -432,8 +432,8 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
- plr = ObjectAccessor::FindPlayer(guid);
- data << uint8(plr ? plr->getLevel() : 0); // Level
+ player = ObjectAccessor::FindPlayer(guid);
+ data << uint8(player ? player->getLevel() : 0); // Level
}
}
SendPacket(&data);
@@ -495,14 +495,14 @@ void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntr
ItemTemplate const* iProto = NULL;
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
- if (!qRew->RewItemId[i])
+ if (!qRew->RewardItemId[i])
continue;
- iProto = sObjectMgr->GetItemTemplate(qRew->RewItemId[i]);
+ iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]);
- data << uint32(qRew->RewItemId[i]);
+ data << uint32(qRew->RewardItemId[i]);
data << uint32(iProto ? iProto->DisplayInfoID : 0);
- data << uint32(qRew->RewItemCount[i]);
+ data << uint32(qRew->RewardItemIdCount[i]);
}
}
SendPacket(&data);
diff --git a/src/server/game/Server/Protocol/Handlers/MailHandler.cpp b/src/server/game/Server/Protocol/Handlers/MailHandler.cpp
index 432a8bf3f6a..2dee8e3ae15 100755
--- a/src/server/game/Server/Protocol/Handlers/MailHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/MailHandler.cpp
@@ -75,9 +75,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (receiver.empty())
return;
- Player* pl = _player;
+ Player* player = _player;
- if (pl->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
+ if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_MAIL_SENDER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
return;
@@ -90,16 +90,16 @@ 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",
- pl->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
+ 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", pl->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
+ 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);
- if (pl->GetGUID() == rc)
+ if (player->GetGUID() == rc)
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
return;
}
@@ -107,9 +107,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
uint32 reqmoney = cost + money;
- if (!pl->HasEnoughMoney(reqmoney))
+ if (!player->HasEnoughMoney(reqmoney))
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
return;
}
@@ -142,14 +142,14 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
if (mails_count > 100)
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
return;
}
// test the receiver's Faction... or all items are account bound
bool accountBound = items_count ? true : false;
for (uint8 i = 0; i < items_count; ++i)
{
- Item* item = pl->GetItemByGuid(itemGUIDs[i]);
+ Item* item = player->GetItemByGuid(itemGUIDs[i]);
if (item)
{
ItemTemplate const* itemProto = item->GetTemplate();
@@ -161,9 +161,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
}
}
- if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
+ if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
return;
}
@@ -183,56 +183,56 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
{
if (!itemGUIDs[i])
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
return;
}
- Item* item = pl->GetItemByGuid(itemGUIDs[i]);
+ Item* item = player->GetItemByGuid(itemGUIDs[i]);
// prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to mail)
if (!item)
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
return;
}
if (!item->CanBeTraded(true))
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
return;
}
- if (item->IsBoundAccountWide() && item->IsSoulBound() && pl->GetSession()->GetAccountId() != rc_account)
+ if (item->IsBoundAccountWide() && item->IsSoulBound() && player->GetSession()->GetAccountId() != rc_account)
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
return;
}
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
return;
}
if (COD && item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
return;
}
if (item->IsNotEmptyBag())
{
- pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
+ player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
return;
}
items[i] = item;
}
- pl->SendMailResult(0, MAIL_SEND, MAIL_OK);
+ player->SendMailResult(0, MAIL_SEND, MAIL_OK);
- pl->ModifyMoney(-int32(reqmoney));
- pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
+ player->ModifyMoney(-int32(reqmoney));
+ player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
bool needItemDelay = false;
@@ -254,7 +254,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
- pl->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
+ player->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
item->DeleteFromInventoryDB(trans); // deletes item from character's inventory
item->SetOwnerGUID(rc);
@@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
}
// if item send to character at another account, then apply item delivery delay
- needItemDelay = pl->GetSession()->GetAccountId() != rc_account;
+ needItemDelay = player->GetSession()->GetAccountId() != rc_account;
}
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
@@ -281,9 +281,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
draft
.AddMoney(money)
.AddCOD(COD)
- .SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(pl), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
+ .SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
- pl->SaveInventoryAndGoldToDB(trans);
+ player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
@@ -298,14 +298,14 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- Player* pl = _player;
- Mail* m = pl->GetMail(mailId);
+ Player* player = _player;
+ Mail* m = player->GetMail(mailId);
if (m)
{
- if (pl->unReadMails)
- --pl->unReadMails;
+ if (player->unReadMails)
+ --player->unReadMails;
m->checked = m->checked | MAIL_CHECK_MASK_READ;
- pl->m_mailsUpdated = true;
+ player->m_mailsUpdated = true;
m->state = MAIL_STATE_CHANGED;
}
}
@@ -323,20 +323,20 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data)
return;
Mail* m = _player->GetMail(mailId);
- Player* pl = _player;
- pl->m_mailsUpdated = true;
+ Player* player = _player;
+ player->m_mailsUpdated = true;
if (m)
{
// delete shouldn't show up for COD mails
if (m->COD)
{
- pl->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
+ player->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
return;
}
m->state = MAIL_STATE_DELETED;
}
- pl->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
+ player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
}
void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
@@ -350,11 +350,11 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- Player* pl = _player;
- Mail* m = pl->GetMail(mailId);
+ Player* player = _player;
+ Mail* m = player->GetMail(mailId);
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
{
- pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
+ player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
return;
}
//we can return mail now
@@ -362,7 +362,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
trans->PAppend("DELETE FROM mail WHERE id = '%u'", mailId); // needed?
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
- pl->RemoveMail(mailId);
+ player->RemoveMail(mailId);
// only return mail if the player exists (and delete if not existing)
if (m->messageType == MAIL_NORMAL && m->sender)
@@ -375,7 +375,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
{
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
- Item* item = pl->GetMItem(itr2->item_guid);
+ Item* item = player->GetMItem(itr2->item_guid);
if (item)
draft.AddItem(item);
else
@@ -383,7 +383,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
//WTF?
}
- pl->RemoveMItem(itr2->item_guid);
+ player->RemoveMItem(itr2->item_guid);
}
}
draft.AddMoney(m->money).SendReturnToSender(GetAccountId(), m->receiver, m->sender, trans);
@@ -392,7 +392,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
CharacterDatabase.CommitTransaction(trans);
delete m; //we can deallocate old mail
- pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
+ player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
}
//called when player takes item attached in mail
@@ -408,23 +408,23 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- Player* pl = _player;
+ Player* player = _player;
- Mail* m = pl->GetMail(mailId);
+ Mail* m = player->GetMail(mailId);
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
{
- pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
+ player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
return;
}
// prevent cheating with skip client money check
- if (!pl->HasEnoughMoney(m->COD))
+ if (!player->HasEnoughMoney(m->COD))
{
- pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
+ player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
return;
}
- Item* it = pl->GetMItem(itemId);
+ Item* it = player->GetMItem(itemId);
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
@@ -471,24 +471,24 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
.SendMailTo(trans, MailReceiver(receive, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
}
- pl->ModifyMoney(-int32(m->COD));
+ player->ModifyMoney(-int32(m->COD));
}
m->COD = 0;
m->state = MAIL_STATE_CHANGED;
- pl->m_mailsUpdated = true;
- pl->RemoveMItem(it->GetGUIDLow());
+ player->m_mailsUpdated = true;
+ player->RemoveMItem(it->GetGUIDLow());
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
- pl->MoveItemToInventory(dest, it, true);
+ player->MoveItemToInventory(dest, it, true);
- pl->SaveInventoryAndGoldToDB(trans);
- pl->_SaveMail(trans);
+ player->SaveInventoryAndGoldToDB(trans);
+ player->_SaveMail(trans);
CharacterDatabase.CommitTransaction(trans);
- pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
+ player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
}
else
- pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
+ player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
}
void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
@@ -501,26 +501,26 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- Player* pl = _player;
+ Player* player = _player;
- Mail* m = pl->GetMail(mailId);
+ Mail* m = player->GetMail(mailId);
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
{
- pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
+ player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
return;
}
- pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
+ player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
- pl->ModifyMoney(m->money);
+ player->ModifyMoney(m->money);
m->money = 0;
m->state = MAIL_STATE_CHANGED;
- pl->m_mailsUpdated = true;
+ player->m_mailsUpdated = true;
// save money and mail to prevent cheating
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- pl->SaveGoldToDB(trans);
- pl->_SaveMail(trans);
+ player->SaveGoldToDB(trans);
+ player->_SaveMail(trans);
CharacterDatabase.CommitTransaction(trans);
}
@@ -533,11 +533,11 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- Player* pl = _player;
+ Player* player = _player;
//load players mails, and mailed items
- if (!pl->m_mailsLoaded)
- pl ->_LoadMail();
+ if (!player->m_mailsLoaded)
+ player ->_LoadMail();
// client can't work with packets > max int16 value
const uint32 maxPacketSize = 32767;
@@ -550,7 +550,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
data << uint8(0); // mail's count
time_t cur_time = time(NULL);
- for (PlayerMails::iterator itr = pl->GetMailBegin(); itr != pl->GetMailEnd(); ++itr)
+ for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
{
// packet send mail count as uint8, prevent overflow
if (mailsCount >= 254)
@@ -596,16 +596,16 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
data << uint32(0); // probably changed in 3.3.3
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
data << uint32((*itr)->money); // Gold
- data << uint32((*itr)->checked); // flags
+ data << uint32((*itr)->checked); // flags
data << float(((*itr)->expire_time-time(NULL))/DAY); // Time
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
- data << (*itr)->subject; // Subject string - once 00, when mail type = 3, max 256
- data << (*itr)->body; // message? max 8000
+ data << (*itr)->subject; // Subject string - once 00, when mail type = 3, max 256
+ data << (*itr)->body; // message? max 8000
data << uint8(item_count); // client limit is 0x10
for (uint8 i = 0; i < item_count; ++i)
{
- Item* item = pl->GetMItem((*itr)->items[i].item_guid);
+ Item* item = player->GetMItem((*itr)->items[i].item_guid);
// item index (0-6?)
data << uint8(i);
// item guid low?
@@ -658,17 +658,17 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- Player* pl = _player;
+ Player* player = _player;
- Mail* m = pl->GetMail(mailId);
+ Mail* m = player->GetMail(mailId);
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
{
- pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
+ player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
return;
}
Item* bodyItem = new Item; // This is not bag and then can be used new Item.
- if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl))
+ if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, player))
{
delete bodyItem;
return;
@@ -680,7 +680,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId);
if (!mailTemplateEntry)
{
- pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
+ player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
return;
}
@@ -700,14 +700,14 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
{
m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
m->state = MAIL_STATE_CHANGED;
- pl->m_mailsUpdated = true;
+ player->m_mailsUpdated = true;
- pl->StoreItem(dest, bodyItem, true);
- pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
+ player->StoreItem(dest, bodyItem, true);
+ player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
}
else
{
- pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
+ player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
delete bodyItem;
}
}
diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
index 971e0b89c0f..7327cdbba65 100755
--- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
@@ -239,7 +239,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
data << uint32(matchcount); // placeholder, count of players matching criteria
data << uint32(displaycount); // placeholder, count of players displayed
- ACE_READ_GUARD(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock());
+ TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
@@ -339,12 +339,6 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
if ((matchcount++) >= sWorld->getIntConfig(CONFIG_MAX_WHO))
continue;
- if (itr->second->isGameMaster())
- {
- pname = "<GM>";
- pname.append(itr->second->GetName());
- }
-
data << pname; // player name
data << gname; // guild name
data << uint32(lvl); // player level
@@ -1196,18 +1190,18 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
_player->SetSelection(guid);
- Player* plr = ObjectAccessor::FindPlayer(guid);
- if (!plr) // wrong player
+ Player* player = ObjectAccessor::FindPlayer(guid);
+ if (!player) // wrong player
return;
uint32 talent_points = 0x47;
- uint32 guid_size = plr->GetPackGUID().wpos();
+ uint32 guid_size = player->GetPackGUID().wpos();
WorldPacket data(SMSG_INSPECT_TALENT, guid_size+4+talent_points);
- data.append(plr->GetPackGUID());
+ data.append(player->GetPackGUID());
if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
{
- plr->BuildPlayerTalentsInfoData(&data);
+ player->BuildPlayerTalentsInfoData(&data);
}
else
{
@@ -1216,7 +1210,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
data << uint8(0); // talentGroupIndex
}
- plr->BuildEnchantmentsInfoData(&data);
+ player->BuildEnchantmentsInfoData(&data);
SendPacket(&data);
}
@@ -1297,15 +1291,15 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return;
}
- Player* plr = sObjectAccessor->FindPlayerByName(charname.c_str());
+ Player* player = sObjectAccessor->FindPlayerByName(charname.c_str());
- if (!plr)
+ if (!player)
{
SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str());
return;
}
- uint32 accid = plr->GetSession()->GetAccountId();
+ uint32 accid = player->GetSession()->GetAccountId();
QueryResult result = LoginDatabase.PQuery("SELECT username, email, last_ip FROM account WHERE id=%u", accid);
if (!result)
diff --git a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
index d343e1b2dae..4e45eb2d6c6 100755
--- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp
@@ -68,11 +68,11 @@ void WorldSession::HandleMoveWorldportAckOpcode()
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());
- oldMap->RemoveFromMap(GetPlayer(), false);
+ oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
// relocate the player to the teleport destination
- Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer(), 0);
+ Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer());
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if (!newMap || !newMap->CanEnter(GetPlayer()))
@@ -88,7 +88,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
- if (!GetPlayer()->GetMap()->AddToMap(GetPlayer()))
+ 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());
GetPlayer()->ResetMap();
@@ -373,7 +373,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
if (plMover->isAlive())
{
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
- // pl can be alive if GM/etc
+ // 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())
diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
index 9277464ca21..bf951619e63 100755
--- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp
@@ -379,8 +379,8 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
- if (PageTextLocale const* pl = sObjectMgr->GetPageTextLocale(pageID))
- ObjectMgr::GetLocaleString(pl->Text, loc_idx, Text);
+ if (PageTextLocale const* player = sObjectMgr->GetPageTextLocale(pageID))
+ ObjectMgr::GetLocaleString(player->Text, loc_idx, Text);
data << Text;
data << uint32(pageText->NextPage);
diff --git a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp
index fbd6c23d20f..e0bcadc89e9 100755
--- a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp
@@ -200,7 +200,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
bool destroyItem = true;
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- if ((qInfo->ReqItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetTemplate()->MaxCount > 0))
+ if ((qInfo->RequiredItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetTemplate()->MaxCount > 0))
{
destroyItem = false;
break;
diff --git a/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp b/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp
index 7187241cc3a..256f8b327ff 100644
--- a/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp
@@ -129,16 +129,16 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
uint64 guid;
data >> guid;
- if (Player* pl = ObjectAccessor::FindPlayer(guid))
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
{
- if (!pl->GetVehicleKit())
+ if (!player->GetVehicleKit())
return;
- if (!pl->IsInRaidWith(_player))
+ if (!player->IsInRaidWith(_player))
return;
- if (!pl->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
+ if (!player->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
- _player->EnterVehicle(pl);
+ _player->EnterVehicle(player);
}
}
@@ -157,23 +157,23 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
if (IS_PLAYER_GUID(guid))
{
- Player* plr = ObjectAccessor::FindPlayer(guid);
- if (!plr)
+ 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));
return;
}
- if (!plr->IsOnVehicle(vehicle->GetBase()))
+ 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));
return;
}
- VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(plr);
+ VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(player);
ASSERT(seat);
if (seat->IsEjectable())
- plr->ExitVehicle();
+ player->ExitVehicle();
else
sLog->outError("Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
}
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index df7816f7cb9..311a94d4217 100755
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -1329,7 +1329,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x514*/ { "SMSG_SEND_ALL_COMBAT_LOG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x515*/ { "SMSG_OPEN_LFG_DUNGEON_FINDER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x516*/ { "SMSG_MOVE_SET_COLLISION_HGT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x517*/ { "CMSG_MOVE_SET_COLLISION_HGT_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x517*/ { "CMSG_MOVE_SET_COLLISION_HGT_ACK", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x518*/ { "MSG_MOVE_SET_COLLISION_HGT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x519*/ { "CMSG_CLEAR_RANDOM_BG_WIN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x51A*/ { "CMSG_CLEAR_HOLIDAY_BG_WIN_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
diff --git a/src/server/game/Server/Protocol/WorldLog.cpp b/src/server/game/Server/Protocol/WorldLog.cpp
index 579e4363253..334c189af81 100755
--- a/src/server/game/Server/Protocol/WorldLog.cpp
+++ b/src/server/game/Server/Protocol/WorldLog.cpp
@@ -61,7 +61,7 @@ void WorldLog::outTimestampLog(char const* fmt, ...)
{
if (LogWorld())
{
- ACE_GUARD(ACE_Thread_Mutex, Guard, Lock);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
ASSERT(i_file);
Log::outTimestamp(i_file);
@@ -89,7 +89,7 @@ void WorldLog::outLog(char const* fmt, ...)
{
if (LogWorld())
{
- ACE_GUARD(ACE_Thread_Mutex, Guard, Lock);
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
ASSERT(i_file);
va_list args;
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 32e65ca7e3f..14c86286718 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -55,12 +55,12 @@ bool MapSessionFilter::Process(WorldPacket* packet)
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
return false;
- Player* plr = m_pSession->GetPlayer();
- if (!plr)
+ Player* player = m_pSession->GetPlayer();
+ if (!player)
return false;
//in Map::Update() we do not process packets where player is not in world!
- return plr->IsInWorld();
+ return player->IsInWorld();
}
//we should process ALL packets when player is not in world/logged in
@@ -77,12 +77,12 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
return true;
//no player attached? -> our client! ^^
- Player* plr = m_pSession->GetPlayer();
- if (!plr)
+ Player* player = m_pSession->GetPlayer();
+ if (!player)
return true;
//lets process all packets for non-in-the-world player
- return (plr->IsInWorld() == false);
+ return (player->IsInWorld() == false);
}
/// WorldSession constructor
@@ -494,7 +494,7 @@ void WorldSession::LogoutPlayer(bool Save)
_player->CleanupsBeforeDelete();
sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow());
Map* _map = _player->GetMap();
- _map->RemoveFromMap(_player, true);
+ _map->RemovePlayerFromMap(_player, true);
SetPlayer(NULL); // deleted in Remove call
///- Send the 'logout complete' packet to the client
@@ -964,9 +964,9 @@ void WorldSession::SendAddonsInfo()
SendPacket(&data);
}
-void WorldSession::SetPlayer(Player* plr)
+void WorldSession::SetPlayer(Player* player)
{
- _player = plr;
+ _player = player;
// set m_GUID that can be used while player loggined and later until m_playerRecentlyLogout not reset
if (_player)
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index a28e3fca2ab..4a83c2d4092 100755
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -247,7 +247,7 @@ class WorldSession
char const* GetPlayerName() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
- void SetPlayer(Player* plr);
+ void SetPlayer(Player* player);
uint8 Expansion() const { return m_expansion; }
/// Session in auth.queue currently
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index b7d48f3ece5..5fb66524976 100755
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -109,7 +109,7 @@ class ReactorRunnable : protected ACE_Task_Base
int AddSocket (WorldSocket* sock)
{
- ACE_GUARD_RETURN (ACE_Thread_Mutex, Guard, m_NewSockets_Lock, -1);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_NewSockets_Lock);
++m_Connections;
sock->AddReference();
@@ -130,7 +130,7 @@ class ReactorRunnable : protected ACE_Task_Base
void AddNewSockets()
{
- ACE_GUARD (ACE_Thread_Mutex, Guard, m_NewSockets_Lock);
+ TRINITY_GUARD(ACE_Thread_Mutex, m_NewSockets_Lock);
if (m_NewSockets.empty())
return;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index ed585739399..c4487fbd950 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -563,10 +563,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
amount += (int32)DoneActualBenefit;
// Arena - Dampening
- if (AuraEffect const* pAurEff = caster->GetAuraEffect(74410, 0))
- AddPctN(amount, pAurEff->GetAmount());
- // Battleground - Dampening
- else if (AuraEffect const* pAurEff = caster->GetAuraEffect(74411, 0))
+ AuraEffect const* pAurEff = caster->GetAuraEffect(74410, 0);
+ if (!pAurEff)
+ pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening
+ if (pAurEff)
AddPctN(amount, pAurEff->GetAmount());
return amount;
@@ -1508,15 +1508,15 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
// Nurturing Instinct
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELLFAMILY_DRUID, 2254, 0))
{
- uint32 spellId = 0;
+ uint32 spellId3 = 0;
switch (aurEff->GetId())
{
- case 33872:
- spellId = 47179;
- break;
- case 33873:
- spellId = 47180;
- break;
+ case 33872:
+ spellId3 = 47179;
+ break;
+ case 33873:
+ spellId3 = 47180;
+ break;
}
target->CastSpell(target, spellId, true, NULL, this);
}
@@ -1569,9 +1569,9 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
target->RemoveAurasDueToSpell(spellId2);
// Improved Barkskin - apply/remove armor bonus due to shapeshift
- if (Player* pl=target->ToPlayer())
+ if (Player* player=target->ToPlayer())
{
- if (pl->HasSpell(63410) || pl->HasSpell(63411))
+ if (player->HasSpell(63410) || player->HasSpell(63411))
{
target->RemoveAurasDueToSpell(66530);
target->CastSpell(target, 66530, true);
@@ -2847,7 +2847,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
if (target->GetTypeId() == TYPEID_UNIT)
target->SetFlying(apply);
- if (Player* plr = target->m_movedPlayer)
+ if (Player* player = target->m_movedPlayer)
{
// allow flying
WorldPacket data;
@@ -2857,7 +2857,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
data.append(target->GetPackGUID());
data << uint32(0); // unk
- plr->SendDirectMessage(&data);
+ player->SendDirectMessage(&data);
}
}
@@ -3246,16 +3246,16 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
{
- if (Player* plr = target->m_movedPlayer)
+ if (Player* player = target->m_movedPlayer)
{
WorldPacket data;
if (apply)
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
else
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
- data.append(plr->GetPackGUID());
+ data.append(player->GetPackGUID());
data << uint32(0); // unknown
- plr->SendDirectMessage(&data);
+ player->SendDirectMessage(&data);
}
}
@@ -4892,8 +4892,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
// Living Bomb
if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
{
- AuraRemoveMode mode = aurApp->GetRemoveMode();
- if (caster && (mode == AURA_REMOVE_BY_ENEMY_SPELL || mode == AURA_REMOVE_BY_EXPIRE))
+ AuraRemoveMode removeMode = aurApp->GetRemoveMode();
+ if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE))
caster->CastSpell(target, GetAmount(), true);
}
break;
@@ -5394,9 +5394,9 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode
if (target->GetTypeId() != TYPEID_PLAYER)
return;
- Player* plr = (Player*)target;
+ Player* player = (Player*)target;
- if (plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (player->getClass() != CLASS_DEATH_KNIGHT)
return;
uint32 runes = m_amount;
@@ -5405,17 +5405,17 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode
{
for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
{
- if (GetMiscValue() != plr->GetCurrentRune(i))
+ if (GetMiscValue() != player->GetCurrentRune(i))
continue;
- if (!plr->GetRuneCooldown(i))
+ if (!player->GetRuneCooldown(i))
{
- plr->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
+ player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
--runes;
}
}
}
else
- plr->RemoveRunesByAuraEffect(this);
+ player->RemoveRunesByAuraEffect(this);
}
void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -5599,6 +5599,9 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
case 66149: // Bullet Controller Periodic - 10 Man
case 68396: // Bullet Controller Periodic - 25 Man
{
+ if (!caster)
+ break;
+
caster->CastCustomSpell(66152, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true);
caster->CastCustomSpell(66153, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true);
break;
@@ -6016,13 +6019,15 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
case 65923:
{
Unit* permafrostCaster = NULL;
- if (Aura* permafrostAura = target->GetAura(66193))
- permafrostCaster = permafrostAura->GetCaster();
- else if (Aura* permafrostAura = target->GetAura(67855))
- permafrostCaster = permafrostAura->GetCaster();
- else if (Aura* permafrostAura = target->GetAura(67856))
- permafrostCaster = permafrostAura->GetCaster();
- else if (Aura* permafrostAura = target->GetAura(67857))
+ Aura* permafrostAura = target->GetAura(66193);
+ if (!permafrostAura)
+ permafrostAura = target->GetAura(67855);
+ if (!permafrostAura)
+ permafrostAura = target->GetAura(67856);
+ if (!permafrostAura)
+ permafrostAura = target->GetAura(67857);
+
+ if (permafrostAura)
permafrostCaster = permafrostAura->GetCaster();
if (permafrostCaster)
@@ -6458,15 +6463,15 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
// damage caster for heal amount
if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL)
{
- uint32 damage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power
- if ((int32)damage > gain)
- damage = gain;
- uint32 absorb = 0;
- caster->DealDamageMods(caster, damage, &absorb);
- caster->SendSpellNonMeleeDamageLog(caster, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, 0, false, 0, false);
+ uint32 funnelDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power
+ if ((int32)funnelDamage > gain)
+ funnelDamage = gain;
+ uint32 funnelAbsorb = 0;
+ caster->DealDamageMods(caster, funnelDamage, &funnelAbsorb);
+ caster->SendSpellNonMeleeDamageLog(caster, GetId(), funnelDamage, GetSpellInfo()->GetSchoolMask(), funnelAbsorb, 0, false, 0, false);
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- caster->DealDamage(caster, damage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
+ caster->DealDamage(caster, funnelDamage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index df6ac44f2cc..525084a70ed 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -557,7 +557,14 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
else
{
// owner has to be in world, or effect has to be applied to self
- ASSERT((!GetOwner()->IsInWorld() && GetOwner() == itr->first) || GetOwner()->IsInMap(itr->first));
+ 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,
+ GetOwner()->GetName(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
+ itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
+ ASSERT(false);
+ }
itr->first->_CreateAuraApplication(this, itr->second);
++itr;
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4d7534509e4..8a4c0a768d8 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -641,23 +641,24 @@ void Spell::InitExplicitTargets(SpellCastTargets const& targets)
// try to select correct unit target if not provided by client or by serverside cast
if (neededTargets & (TARGET_FLAG_UNIT_MASK))
{
- Unit* target = NULL;
+ Unit* unit = NULL;
// try to use player selection as a target
if (Player* playerCaster = m_caster->ToPlayer())
{
// selection has to be found and to be valid target for the spell
if (Unit* selectedUnit = ObjectAccessor::GetUnit(*m_caster, playerCaster->GetSelection()))
if (m_spellInfo->CheckExplicitTarget(m_caster, selectedUnit) == SPELL_CAST_OK)
- target = selectedUnit;
+ unit = selectedUnit;
}
// try to use attacked unit as a target
else if ((m_caster->GetTypeId() == TYPEID_UNIT) && neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT))
- target = m_caster->getVictim();
+ unit = m_caster->getVictim();
+
// didn't find anything - let's use self as target
- if (!target && neededTargets & (TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_ALLY))
- target = m_caster;
+ if (!unit && neededTargets & (TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_ALLY))
+ unit = m_caster;
- m_targets.SetUnitTarget(target);
+ m_targets.SetUnitTarget(unit);
}
}
@@ -1218,11 +1219,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
if (spellHitTarget)
{
- SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura);
- if (missInfo != SPELL_MISS_NONE)
+ SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura);
+ if (missInfo2 != SPELL_MISS_NONE)
{
- if (missInfo != SPELL_MISS_MISS)
- m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo);
+ if (missInfo2 != SPELL_MISS_MISS)
+ m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo2);
m_damage = 0;
spellHitTarget = NULL;
}
@@ -1537,7 +1538,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, const uint32 effectMask, bool
if (AuraApplication* aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID()))
positive = aurApp->IsPositive();
- duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
+ duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask);
// Haste modifies duration of channeled spells
if (m_spellInfo->IsChanneled())
@@ -3834,19 +3835,23 @@ void Spell::SendSpellGo()
if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list
{
- Player* player = m_caster->ToPlayer();
- uint8 runeMaskInitial = m_runesState;
- uint8 runeMaskAfterCast = player->GetRunesState();
- data << uint8(runeMaskInitial); // runes state before
- data << uint8(runeMaskAfterCast); // runes state after
- for (uint8 i = 0; i < MAX_RUNES; ++i)
+ //TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
+ //The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
+ if (Player* player = m_caster->ToPlayer())
{
- uint8 mask = (1 << i);
- if (mask & runeMaskInitial && !(mask & runeMaskAfterCast)) // usable before andon cooldown now...
+ uint8 runeMaskInitial = m_runesState;
+ uint8 runeMaskAfterCast = player->GetRunesState();
+ data << uint8(runeMaskInitial); // runes state before
+ data << uint8(runeMaskAfterCast); // runes state after
+ for (uint8 i = 0; i < MAX_RUNES; ++i)
{
- // float casts ensure the division is performed on floats as we need float result
- float baseCd = float(player->GetRuneBaseCooldown(i));
- data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
+ uint8 mask = (1 << i);
+ if (mask & runeMaskInitial && !(mask & runeMaskAfterCast)) // usable before andon cooldown now...
+ {
+ // float casts ensure the division is performed on floats as we need float result
+ float baseCd = float(player->GetRuneBaseCooldown(i));
+ data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
+ }
}
}
}
@@ -4326,9 +4331,9 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_CAST_OK;
- Player* plr = (Player*)m_caster;
+ Player* player = (Player*)m_caster;
- if (plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (player->getClass() != CLASS_DEATH_KNIGHT)
return SPELL_CAST_OK;
SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(runeCostID);
@@ -4352,8 +4357,8 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
- RuneType rune = plr->GetCurrentRune(i);
- if ((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
+ RuneType rune = player->GetCurrentRune(i);
+ if ((player->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
runeCost[rune]--;
}
@@ -6415,7 +6420,8 @@ bool Spell::IsNextMeleeSwingSpell() const
bool Spell::IsAutoActionResetSpell() const
{
- return !IsTriggered() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK);
+ // TODO: changed SPELL_INTERRUPT_FLAG_AUTOATTACK -> SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all?
+ return !IsTriggered() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT);
}
bool Spell::IsNeedSendToClient() const
@@ -6793,7 +6799,7 @@ void Spell::SelectTrajTargets()
if (!dist2d)
return;
- float dz = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ;
+ float srcToDestDelta = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ;
UnitList unitList;
SearchAreaTarget(unitList, dist2d, PUSH_IN_THIN_LINE, SPELL_TARGETS_ANY);
@@ -6803,8 +6809,9 @@ void Spell::SelectTrajTargets()
unitList.sort(Trinity::ObjectDistanceOrderPred(m_caster));
float b = tangent(m_targets.GetElevation());
- float a = (dz - dist2d * b) / (dist2d * dist2d);
- if (a > -0.0001f) a = 0;
+ 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);)
float bestDist = m_spellInfo->GetMaxRange(false);
@@ -6832,9 +6839,14 @@ void Spell::SelectTrajTargets()
}
#define CHECK_DIST {\
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
- if (dist > bestDist) continue;\
- if (dist < objDist2d + size && dist > objDist2d - size) { bestDist = dist; break; }\
+ DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
+ if (dist > bestDist)\
+ continue;\
+ if (dist < objDist2d + size && dist > objDist2d - size)\
+ {\
+ bestDist = dist;\
+ break;\
+ }\
}
if (!a)
@@ -7022,7 +7034,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
break;
default:
ASSERT(false);
- break;
+ return false;
}
(*scritr)->_PrepareScriptCall(hookType);
for (; effItr != effEndItr ; ++effItr)
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 65ed47af322..624c3b9b9b3 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -453,7 +453,7 @@ class Spell
UsedSpellMods m_appliedMods;
- int32 CalcCastTime() const { return m_casttime; }
+ int32 GetCastTime() const { return m_casttime; }
bool IsAutoRepeat() const { return m_autoRepeat; }
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 83cecf7d884..a4cf8e6a469 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -923,7 +923,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- uint32 spell_id = roll_chance_i(50)
+ spell_id = roll_chance_i(50)
? 29277 // Summon Purified Helboar Meat
: 29278; // Summon Toxic Helboar Meat
@@ -951,12 +951,16 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
return;
case 35745: // Socrethar's Stone
{
- uint32 spell_id;
switch (m_caster->GetAreaId())
{
- case 3900: spell_id = 35743; break; // Socrethar Portal
- case 3742: spell_id = 35744; break; // Socrethar Portal
- default: return;
+ case 3900:
+ spell_id = 35743;
+ break; // Socrethar Portal
+ case 3742:
+ spell_id = 35744;
+ break; // Socrethar Portal
+ default:
+ return;
}
m_caster->CastSpell(m_caster, spell_id, true);
@@ -1453,7 +1457,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE)
{
uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
- int32 bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier)));
+ bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0))
AddPctN(bp, m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellInfo(), 2));
@@ -1465,12 +1469,12 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
{
if (m_caster->IsFriendlyTo(unitTarget))
{
- int32 bp = int32(damage * 1.5f);
+ bp = int32(damage * 1.5f);
m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true);
}
else
{
- int32 bp = damage;
+ bp = damage;
m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true);
}
return;
@@ -2141,6 +2145,16 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
&& effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
+ //! it's possible for spells with this spell effect to either have a target or no target
+ //! in case of a target, we will execute this handler on SPELL_EFFECT_HANDLE_HIT_TARGET
+ //! with all relevant variables, and we will skip SPELL_EFFECT_HANDLE_HIT
+ if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT)
+ {
+ if (GetSpellInfo()->Effects[effIndex].TargetA.GetTarget() != 0 ||
+ GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() != 0)
+ return;
+ }
+
WorldObject* target = NULL;
// call events for target if present
@@ -2237,6 +2251,13 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
addhealth += damageAmount;
}
+ // Runic Healing Injector (heal increased by 25% for engineers - 3.2.0 patch change)
+ else if (m_spellInfo->Id == 67489)
+ {
+ if (Player* player = m_caster->ToPlayer())
+ if (player->HasSkill(SKILL_ENGINEERING))
+ AddPctN(addhealth, 25);
+ }
// Swiftmend - consumes Regrowth or Rejuvenation
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
{
@@ -2629,6 +2650,13 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
case 48542: // Revitalize
damage = int32(CalculatePctN(unitTarget->GetMaxPower(power), damage));
break;
+ case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
+ {
+ if (Player* player = m_caster->ToPlayer())
+ if (player->HasSkill(SKILL_ENGINEERING))
+ AddPctN(damage, 25);
+ break;
+ }
case 71132: // Glyph of Shadow Word: Pain
damage = int32(CalculatePctN(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
break;
@@ -4319,19 +4347,22 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
// TODO: not all spells that used this effect apply cooldown at school spells
// also exist case: apply cooldown to interrupted cast only and to all spells
- for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
+ // there is no CURRENT_AUTOREPEAT_SPELL spells that can be interrupted
+ for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_AUTOREPEAT_SPELL; ++i)
{
if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i)))
{
SpellInfo const* curSpellInfo = spell->m_spellInfo;
// check if we can interrupt spell
if ((spell->getState() == SPELL_STATE_CASTING
- || (spell->getState() == SPELL_STATE_PREPARING && spell->CalcCastTime() > 0.0f))
- && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
+ || (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f))
+ && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE
+ && ((i == CURRENT_GENERIC_SPELL && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT)
+ || (i == CURRENT_CHANNELED_SPELL && curSpellInfo->ChannelInterruptFlags & CHANNEL_INTERRUPT_FLAG_INTERRUPT)))
{
if (m_originalCaster)
{
- int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false);
+ int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false, 1 << effIndex);
unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), duration/*GetSpellDuration(m_spellInfo)*/);
}
ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id);
@@ -4381,8 +4412,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
{
- Player* pl = m_caster->ToPlayer();
- Battleground* bg = pl->GetBattleground();
+ Player* player = m_caster->ToPlayer();
+ Battleground* bg = player->GetBattleground();
switch (pGameObj->GetMapId())
{
@@ -4392,7 +4423,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
{
uint32 team = ALLIANCE;
- if (pl->GetTeam() == team)
+ if (player->GetTeam() == team)
team = HORDE;
((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
@@ -4936,6 +4967,25 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
return;
}
+ case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
+ {
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ unitTarget->ToCreature()->DespawnOrUnsummon();
+
+ return;
+ }
+ case 57349: // Drop RP-GG (Wintergrasp RP-GG at death drop spell)
+ {
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ // Delete item from inventory at death
+ m_caster->ToPlayer()->DestroyItemCount(damage, 5, true);
+
+ return;
+ }
case 58418: // Portal to Orgrimmar
case 58420: // Portal to Stormwind
{
@@ -5327,11 +5377,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 64142: // Upper Deck - Create Foam Sword
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- Player* plr = unitTarget->ToPlayer();
+ Player* player = unitTarget->ToPlayer();
static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0};
// player can only have one of these items
for (uint32 const* itr = &itemId[0]; *itr; ++itr)
- if (plr->HasItemCount(*itr, 1, true))
+ if (player->HasItemCount(*itr, 1, true))
return;
DoCreateItem(effIndex, itemId[urand(0, 4)]);
return;
@@ -6138,15 +6188,15 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage);
}
- Player* plr = m_caster->ToPlayer();
- plr->ResurrectPlayer(0.0f);
+ Player* player = m_caster->ToPlayer();
+ player->ResurrectPlayer(0.0f);
- plr->SetHealth(health);
- plr->SetPower(POWER_MANA, mana);
- plr->SetPower(POWER_RAGE, 0);
- plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY));
+ player->SetHealth(health);
+ player->SetPower(POWER_MANA, mana);
+ player->SetPower(POWER_RAGE, 0);
+ player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY));
- plr->SpawnCorpseBones();
+ player->SpawnCorpseBones();
}
void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
@@ -6302,13 +6352,13 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex)
// remove all quest entries for 'entry' from quest log
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
{
- uint32 quest = player->GetQuestSlotQuestId(slot);
- if (quest == quest_id)
+ uint32 logQuest = player->GetQuestSlotQuestId(slot);
+ if (logQuest == quest_id)
{
player->SetQuestSlot(slot, 0);
- // we ignore unequippable quest items in this case, its' still be equipped
- player->TakeQuestSourceItem(quest, false);
+ // we ignore unequippable quest items in this case, it's still be equipped
+ player->TakeQuestSourceItem(logQuest, false);
}
}
@@ -6920,9 +6970,9 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- Player* plr = m_caster->ToPlayer();
+ Player* player = m_caster->ToPlayer();
- if (plr->getClass() != CLASS_DEATH_KNIGHT)
+ if (player->getClass() != CLASS_DEATH_KNIGHT)
return;
// needed later
@@ -6932,9 +6982,9 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
if (count == 0) count = 1;
for (uint32 j = 0; j < MAX_RUNES && count > 0; ++j)
{
- if (plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->Effects[effIndex].MiscValue))
+ if (player->GetRuneCooldown(j) && player->GetCurrentRune(j) == RuneType(m_spellInfo->Effects[effIndex].MiscValue))
{
- plr->SetRuneCooldown(j, 0);
+ player->SetRuneCooldown(j, 0);
--count;
}
}
@@ -6947,8 +6997,8 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
- if (plr->GetRuneCooldown(i) && (plr->GetCurrentRune(i) == RUNE_FROST || plr->GetCurrentRune(i) == RUNE_DEATH))
- plr->SetRuneCooldown(i, 0);
+ if (player->GetRuneCooldown(i) && (player->GetCurrentRune(i) == RUNE_FROST || player->GetCurrentRune(i) == RUNE_DEATH))
+ player->SetRuneCooldown(i, 0);
}
}
}
@@ -7068,9 +7118,9 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
// level of pet summoned using engineering item based at engineering skill level
if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER)
if (ItemTemplate const* proto = m_CastItem->GetTemplate())
- if (proto->RequiredSkill == SKILL_ENGINERING)
- if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINERING))
- level = skill202/5;
+ if (proto->RequiredSkill == SKILL_ENGINEERING)
+ if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING))
+ level = skill202 / 5;
//float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
float radius = 5.0f;
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 543baa82789..972276c7d26 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1735,6 +1735,17 @@ uint32 SpellInfo::GetEffectMechanicMask(uint8 effIndex) const
return mask;
}
+uint32 SpellInfo::GetSpellMechanicMaskByEffectMask(uint32 effectMask) const
+{
+ uint32 mask = 0;
+ if (Mechanic)
+ mask |= 1<< Mechanic;
+ for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ if ((effectMask & (1 << i)) && Effects[i].Mechanic)
+ mask |= 1<< Effects[i].Mechanic;
+ return mask;
+}
+
Mechanics SpellInfo::GetEffectMechanic(uint8 effIndex) const
{
if (Effects[effIndex].IsEffect() && Effects[effIndex].Mechanic)
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index b4f4ca8c11e..7faf0de890d 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -444,6 +444,7 @@ public:
SpellSchoolMask GetSchoolMask() const;
uint32 GetAllEffectsMechanicMask() const;
uint32 GetEffectMechanicMask(uint8 effIndex) const;
+ uint32 GetSpellMechanicMaskByEffectMask(uint32 effectMask) const;
Mechanics GetEffectMechanic(uint8 effIndex) const;
uint32 GetDispelMask() const;
static uint32 GetDispelMask(DispelType type);
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 35e380736c5..c382cb56a62 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -96,7 +96,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto,
return DIMINISHING_CONTROLLED_ROOT;
// Dragon's Breath
else if (spellproto->SpellFamilyFlags[0] & 0x800000)
- return DIMINISHING_DISORIENT;
+ return DIMINISHING_DRAGONS_BREATH;
break;
}
case SPELLFAMILY_WARRIOR:
@@ -167,7 +167,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto,
}
case SPELLFAMILY_HUNTER:
{
- // Hunter's mark
+ // Hunter's Mark
if ((spellproto->SpellFamilyFlags[0] & 0x400) && spellproto->SpellIconID == 538)
return DIMINISHING_LIMITONLY;
// Scatter Shot (own diminishing)
@@ -321,20 +321,20 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group)
{
switch (group)
{
+ case DIMINISHING_BANISH:
case DIMINISHING_CONTROLLED_STUN:
- case DIMINISHING_STUN:
- case DIMINISHING_ENTRAPMENT:
case DIMINISHING_CONTROLLED_ROOT:
- case DIMINISHING_ROOT:
+ case DIMINISHING_CYCLONE:
+ case DIMINISHING_DISORIENT:
+ case DIMINISHING_ENTRAPMENT:
case DIMINISHING_FEAR:
+ case DIMINISHING_HORROR:
case DIMINISHING_MIND_CONTROL:
- case DIMINISHING_DISORIENT:
- case DIMINISHING_CYCLONE:
- case DIMINISHING_BANISH:
- case DIMINISHING_LIMITONLY:
case DIMINISHING_OPENING_STUN:
- case DIMINISHING_HORROR:
+ case DIMINISHING_ROOT:
+ case DIMINISHING_STUN:
case DIMINISHING_SLEEP:
+ case DIMINISHING_LIMITONLY:
return true;
default:
return false;
@@ -351,7 +351,7 @@ SpellMgr::~SpellMgr()
}
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
-bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
+bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg)
{
// not exist
if (!spellInfo)
@@ -378,8 +378,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
{
if (msg)
{
- if (pl)
- ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
+ 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);
}
@@ -392,8 +392,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
{
if (msg)
{
- if (pl)
- ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ 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);
}
@@ -406,12 +406,12 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
case SPELL_EFFECT_LEARN_SPELL:
{
SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell);
- if (!IsSpellValid(spellInfo2, pl, msg))
+ if (!IsSpellValid(spellInfo2, player, msg))
{
if (msg)
{
- if (pl)
- ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ 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);
}
@@ -430,8 +430,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
{
if (msg)
{
- if (pl)
- ChatHandler(pl).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
+ 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]);
}
@@ -1005,7 +1005,7 @@ SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const
else
{
uint32 firstSpell = GetFirstSpellInChain(spellID);
- SpellThreatMap::const_iterator itr = mSpellThreatMap.find(firstSpell);
+ itr = mSpellThreatMap.find(firstSpell);
if (itr != mSpellThreatMap.end())
return &itr->second;
}
@@ -2969,7 +2969,7 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectImplicitTargetB[0] = 0;
break;
case 31344: // Howl of Azgalor
- spellInfo->EffectRadiusIndex[0] = 12; // 100yards instead of 50000?!
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yards instead of 50000?!
break;
case 42818: // Headless Horseman - Wisp Flight Port
case 42821: // Headless Horseman - Wisp Flight Missile
@@ -3005,7 +3005,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 59725: // Improved Spell Reflection - aoe aura
// Target entry seems to be wrong for this spell :/
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER_AREA_PARTY;
- spellInfo->EffectRadiusIndex[0] = 45;
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_10_YARDS_2;
break;
case 44978: case 45001: case 45002: // Wild Magic
case 45004: case 45006: case 45010: // Wild Magic
@@ -3109,7 +3109,7 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
break;
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
- spellInfo->EffectRadiusIndex[0] = 37;
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_7_YARDS;
break;
// Master Shapeshifter: missing stance data for forms other than bear - bear version has correct data
// To prevent aura staying on target after talent unlearned
@@ -3235,7 +3235,7 @@ void SpellMgr::LoadDbcDataCorrections()
// ULDUAR SPELLS
//
case 62374: // Pursued (Flame Leviathan)
- spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 63342: // Focused Eyebeam Summon Trigger (Kologarn)
spellInfo->MaxAffectedTargets = 1;
@@ -3303,7 +3303,7 @@ void SpellMgr::LoadDbcDataCorrections()
break;
case 69055: // Saber Lash (Lord Marrowgar)
case 70814: // Saber Lash (Lord Marrowgar)
- spellInfo->EffectRadiusIndex[0] = 8; // 5yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_5_YARDS; // 5yd
break;
case 69075: // Bone Storm (Lord Marrowgar)
case 70834: // Bone Storm (Lord Marrowgar)
@@ -3315,7 +3315,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 71160: // Plague Stench (Stinky)
case 71161: // Plague Stench (Stinky)
case 71123: // Decimate (Stinky & Precious)
- spellInfo->EffectRadiusIndex[0] = 12; // 100yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd
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
@@ -3342,7 +3342,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 72464: // Mutated Plague (Professor Putricide)
case 72506: // Mutated Plague (Professor Putricide)
case 72507: // Mutated Plague (Professor Putricide)
- spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 70911: // Unbound Plague (Professor Putricide) (needs target selection script)
case 72854: // Unbound Plague (Professor Putricide) (needs target selection script)
@@ -3353,7 +3353,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 71518: // Unholy Infusion Quest Credit (Professor Putricide)
case 72934: // Blood Infusion Quest Credit (Blood-Queen Lana'thel)
case 72289: // Frost Infusion Quest Credit (Sindragosa)
- spellInfo->EffectRadiusIndex[0] = 28; // another missing radius
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // another missing radius
break;
case 71708: // Empowered Flare (Blood Prince Council)
case 72785: // Empowered Flare (Blood Prince Council)
@@ -3380,7 +3380,7 @@ void SpellMgr::LoadDbcDataCorrections()
break;
case 72706: // Achievement Check (Valithria Dreamwalker)
case 71357: // Order Whelp
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 70598: // Sindragosa's Fury
spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER;
@@ -3404,12 +3404,12 @@ void SpellMgr::LoadDbcDataCorrections()
case 73708: // Defile
case 73709: // Defile
case 73710: // Defile
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
- spellInfo->EffectRadiusIndex[1] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 69030: // Val'kyr Target Search
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
- spellInfo->EffectRadiusIndex[1] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 69198: // Raging Spirit Visual
spellInfo->rangeIndex = 13; // 50000yd
@@ -3418,9 +3418,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 74295: // Harvest Souls
case 74296: // Harvest Souls
case 74297: // Harvest Souls
- spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
- spellInfo->EffectRadiusIndex[1] = 28; // 50000yd
- spellInfo->EffectRadiusIndex[2] = 28; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[2] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 73655: // Harvest Soul
spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS;
@@ -3432,34 +3432,34 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->DurationIndex = 28; // 5 seconds
break;
case 73529: // Shadow Trap
- spellInfo->EffectRadiusIndex[1] = 13; // 10yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_10_YARDS; // 10yd
break;
case 74282: // Shadow Trap (searcher)
- spellInfo->EffectRadiusIndex[0] = 15; // 3yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_3_YARDS; // 3yd
break;
case 72595: // Restore Soul
case 73650: // Restore Soul
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 74086: // Destroy Soul
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 74302: // Summon Spirit Bomb
case 74342: // Summon Spirit Bomb
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
spellInfo->MaxAffectedTargets = 1;
break;
case 74341: // Summon Spirit Bomb
case 74343: // Summon Spirit Bomb
- spellInfo->EffectRadiusIndex[0] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
spellInfo->MaxAffectedTargets = 3;
break;
case 73579: // Summon Spirit Bomb
- spellInfo->EffectRadiusIndex[0] = 20; // 25yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_25_YARDS; // 25yd
break;
case 72350: // Fury of Frostmourne
- spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
- spellInfo->EffectRadiusIndex[1] = 28; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 75127: // Kill Frostmourne Players
case 72351: // Fury of Frostmourne
@@ -3467,18 +3467,18 @@ void SpellMgr::LoadDbcDataCorrections()
case 72429: // Mass Resurrection
case 73159: // Play Movie
case 73582: // Trigger Vile Spirit (Inside, Heroic)
- spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 72376: // Raise Dead
spellInfo->MaxAffectedTargets = 3;
- spellInfo->EffectRadiusIndex[0] = 28; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 71809: // Jump
spellInfo->rangeIndex = 3; // 20yd
- spellInfo->EffectRadiusIndex[0] = 20; // 25yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_25_YARDS; // 25yd
break;
case 72405: // Broken Frostmourne
- spellInfo->EffectRadiusIndex[1] = 22; // 200yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
default:
break;
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index a3c4779e9f3..552519d9940 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -381,6 +381,68 @@ struct SpellTargetPosition
float target_Orientation;
};
+// Enum with EffectRadiusIndex and their actual radius
+enum EffectRadiusIndex
+{
+ EFFECT_RADIUS_2_YARDS = 7,
+ EFFECT_RADIUS_5_YARDS = 8,
+ EFFECT_RADIUS_20_YARDS = 9,
+ EFFECT_RADIUS_30_YARDS = 10,
+ EFFECT_RADIUS_45_YARDS = 11,
+ EFFECT_RADIUS_100_YARDS = 12,
+ EFFECT_RADIUS_10_YARDS = 13,
+ EFFECT_RADIUS_8_YARDS = 14,
+ EFFECT_RADIUS_3_YARDS = 15,
+ EFFECT_RADIUS_1_YARD = 16,
+ EFFECT_RADIUS_13_YARDS = 17,
+ EFFECT_RADIUS_15_YARDS = 18,
+ EFFECT_RADIUS_18_YARDS = 19,
+ EFFECT_RADIUS_25_YARDS = 20,
+ EFFECT_RADIUS_35_YARDS = 21,
+ EFFECT_RADIUS_200_YARDS = 22,
+ EFFECT_RADIUS_40_YARDS = 23,
+ EFFECT_RADIUS_65_YARDS = 24,
+ EFFECT_RADIUS_70_YARDS = 25,
+ EFFECT_RADIUS_4_YARDS = 26,
+ EFFECT_RADIUS_50_YARDS = 27,
+ EFFECT_RADIUS_50000_YARDS = 28,
+ EFFECT_RADIUS_6_YARDS = 29,
+ EFFECT_RADIUS_500_YARDS = 30,
+ EFFECT_RADIUS_80_YARDS = 31,
+ EFFECT_RADIUS_12_YARDS = 32,
+ EFFECT_RADIUS_99_YARDS = 33,
+ EFFECT_RADIUS_55_YARDS = 35,
+ EFFECT_RADIUS_0_YARDS = 36,
+ EFFECT_RADIUS_7_YARDS = 37,
+ EFFECT_RADIUS_21_YARDS = 38,
+ EFFECT_RADIUS_34_YARDS = 39,
+ EFFECT_RADIUS_9_YARDS = 40,
+ EFFECT_RADIUS_150_YARDS = 41,
+ EFFECT_RADIUS_11_YARDS = 42,
+ EFFECT_RADIUS_16_YARDS = 43,
+ EFFECT_RADIUS_0_5_YARDS = 44, // 0.5 yards
+ EFFECT_RADIUS_10_YARDS_2 = 45,
+ EFFECT_RADIUS_5_YARDS_2 = 46,
+ EFFECT_RADIUS_15_YARDS_2 = 47,
+ EFFECT_RADIUS_60_YARDS = 48,
+ EFFECT_RADIUS_90_YARDS = 49,
+ EFFECT_RADIUS_15_YARDS_3 = 50,
+ EFFECT_RADIUS_60_YARDS_2 = 51,
+ EFFECT_RADIUS_5_YARDS_3 = 52,
+ EFFECT_RADIUS_60_YARDS_3 = 53,
+ EFFECT_RADIUS_50000_YARDS_2 = 54,
+ EFFECT_RADIUS_130_YARDS = 55,
+ EFFECT_RADIUS_38_YARDS = 56,
+ EFFECT_RADIUS_45_YARDS_2 = 57,
+ EFFECT_RADIUS_32_YARDS = 59,
+ EFFECT_RADIUS_44_YARDS = 60,
+ EFFECT_RADIUS_14_YARDS = 61,
+ EFFECT_RADIUS_47_YARDS = 62,
+ EFFECT_RADIUS_23_YARDS = 63,
+ EFFECT_RADIUS_3_5_YARDS = 64, // 3.5 yards
+ EFFECT_RADIUS_80_YARDS_2 = 65
+};
+
typedef UNORDERED_MAP<uint32, SpellTargetPosition> SpellTargetPositionMap;
// Spell pet auras
@@ -555,7 +617,7 @@ class SpellMgr
// Accessors (const or static functions)
public:
// Spell correctess for client using
- static bool IsSpellValid(SpellInfo const* spellInfo, Player* pl = NULL, bool msg = true);
+ static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true);
// Spell difficulty
uint32 GetSpellDifficultyId(uint32 spellId) const;
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index f901c0acac8..2915bab4b77 100755
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -381,12 +381,12 @@ void CreatureTextMgr::SendChatPacket(WorldPacket* data, WorldObject* source, Cha
const SessionMap smap = sWorld->GetAllSessions();
for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
{
- if (Player* plr = (*iter).second->GetPlayer())
+ if (Player* player = (*iter).second->GetPlayer())
{
if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid
- data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(plr->GetGUID()));
- if (plr->GetSession() && (!team || Team(plr->GetTeam()) == team) && (!gmOnly || plr->isGameMaster()))
- plr->GetSession()->SendPacket(data);
+ data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(player->GetGUID()));
+ if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->isGameMaster()))
+ player->GetSession()->SendPacket(data);
}
}
return;
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index 92fa001fe46..0c3fd957165 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -443,6 +443,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
typedef PetIds::value_type PetIdsPair;
PetIds petids;
+ uint8 gender = GENDER_NONE;
+ uint8 race = RACE_NONE;
+ uint8 playerClass = 0;
+
SQLTransaction trans = CharacterDatabase.BeginTransaction();
while (!feof(fin))
{
@@ -512,6 +516,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (!changenth(line, 2, chraccount)) // characters.account update
ROLLBACK(DUMP_FILE_BROKEN);
+ race = uint8(atol(getnth(line, 4).c_str()));
+ playerClass = uint8(atol(getnth(line, 5).c_str()));
+ gender = uint8(atol(getnth(line, 6).c_str()));
if (name == "")
{
// check if the original name already exists
@@ -520,10 +527,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE name = '%s'", name.c_str());
if (result)
- {
if (!changenth(line, 37, "1")) // characters.at_login set to "rename on login"
ROLLBACK(DUMP_FILE_BROKEN);
- }
}
else if (!changenth(line, 3, name.c_str())) // characters.name
ROLLBACK(DUMP_FILE_BROKEN);
@@ -654,6 +659,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
CharacterDatabase.CommitTransaction(trans);
+ // in case of name conflict player has to rename at login anyway
+ sWorld->AddCharacterNameData(guid, name, gender, race, playerClass);
+
sObjectMgr->m_hiItemGuid += items.size();
sObjectMgr->m_mailid += mails.size();
@@ -664,4 +672,3 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
return DUMP_SUCCESS;
}
-
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 28657faedb1..8aca4563b91 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -2746,22 +2746,18 @@ void World::UpdateMaxSessionCounters()
void World::LoadDBVersion()
{
- QueryResult result = WorldDatabase.Query("SELECT db_version, script_version, cache_id FROM version LIMIT 1");
+ QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1");
if (result)
{
Field* fields = result->Fetch();
m_DBVersion = fields[0].GetString();
- m_CreatureEventAIVersion = fields[1].GetString();
// will be overwrite by config values if different and non-0
- m_int_configs[CONFIG_CLIENTCACHE_VERSION] = fields[2].GetUInt32();
+ m_int_configs[CONFIG_CLIENTCACHE_VERSION] = fields[1].GetUInt32();
}
if (m_DBVersion.empty())
m_DBVersion = "Unknown world database.";
-
- if (m_CreatureEventAIVersion.empty())
- m_CreatureEventAIVersion = "Unknown creature EventAI.";
}
void World::ProcessStartEvent()
@@ -2873,7 +2869,7 @@ void World::LoadCharacterNameData()
sLog->outString("Loaded name data for %u characters", count);
}
-void World::AddCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race, uint8 playerClass)
+void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass)
{
CharacterNameData& data = _characterNameDataMap[guid];
data.m_name = name;
@@ -2882,18 +2878,22 @@ void World::AddCharacterNameData(uint32 guid, const std::string& name, uint8 gen
data.m_class = playerClass;
}
-void World::UpdateCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race)
+void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/)
{
std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
if (itr == _characterNameDataMap.end())
return;
+
itr->second.m_name = name;
- itr->second.m_gender = gender;
- if(race != RACE_NONE)
+
+ if (gender != GENDER_NONE)
+ itr->second.m_gender = gender;
+
+ if (race != RACE_NONE)
itr->second.m_race = race;
}
-const CharacterNameData* World::GetCharacterNameData(uint32 guid) const
+CharacterNameData const* World::GetCharacterNameData(uint32 guid) const
{
std::map<uint32, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid);
if (itr != _characterNameDataMap.end())
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 06dc0066bb4..f643ae60287 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -722,10 +722,9 @@ class World
LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if (m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
- //used World DB version
+ // used World DB version
void LoadDBVersion();
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
- char const* GetCreatureEventAIVersion() const { return m_CreatureEventAIVersion.c_str(); }
void RecordTimeDiff(const char * text, ...);
@@ -739,9 +738,9 @@ class World
bool isEventKillStart;
- const CharacterNameData* GetCharacterNameData(uint32 guid) const;
- void AddCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race, uint8 playerClass);
- void UpdateCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race = RACE_NONE);
+ CharacterNameData const* GetCharacterNameData(uint32 guid) const;
+ void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass);
+ void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE);
void DeleteCharaceterNameData(uint32 guid) { _characterNameDataMap.erase(guid); }
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
@@ -821,13 +820,12 @@ class World
//Player Queue
Queue m_QueuedPlayer;
- //sessions that are added async
+ // sessions that are added async
void AddSession_(WorldSession* s);
ACE_Based::LockedQueue<WorldSession*, ACE_Thread_Mutex> addSessQueue;
- //used versions
+ // used versions
std::string m_DBVersion;
- std::string m_CreatureEventAIVersion;
std::list<std::string> m_Autobroadcasts;
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 80dd2dc366a..ae3250ad7b7 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -473,7 +473,7 @@ public:
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", targetAccountId, realmID);
if (gm != 0)
- LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', '%d')", targetAccountId, gm, realmID);
+ LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', '%d')", targetAccountId, gm, gmRealmID);
handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
return true;
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 68ccf96bb87..ab077af0863 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -117,7 +117,7 @@ public:
bool first = true;
bool footer = false;
- ACE_READ_GUARD_RETURN(HashMapHolder<Player>::LockType, guard, *HashMapHolder<Player>::GetLock(), true);
+ TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp
index eb791b35e58..bafaae465ef 100644
--- a/src/server/scripts/Commands/cs_gps.cpp
+++ b/src/server/scripts/Commands/cs_gps.cpp
@@ -43,16 +43,16 @@ public:
return commandTable;
}
- static bool HandleGPSCommand(ChatHandler* handler, const char *args)
+ static bool HandleGPSCommand(ChatHandler* handler, char const* args)
{
- WorldObject* obj = NULL;
+ WorldObject* object = NULL;
if (*args)
{
uint64 guid = handler->extractGuidFromLink((char*)args);
if (guid)
- obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
+ object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
- if (!obj)
+ if (!object)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
@@ -61,71 +61,73 @@ public:
}
else
{
- obj = handler->getSelectedUnit();
+ object = handler->getSelectedUnit();
- if (!obj)
+ if (!object)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
}
- CellCoord cell_val = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
- Cell cell(cell_val);
- uint32 zone_id, area_id;
- obj->GetZoneAndAreaId(zone_id, area_id);
+ CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
+ Cell cell(cellCoord);
- MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId());
- AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);
+ uint32 zoneId, areaId;
+ object->GetZoneAndAreaId(zoneId, areaId);
- float zone_x = obj->GetPositionX();
- float zone_y = obj->GetPositionY();
+ MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
- Map2ZoneCoordinates(zone_x, zone_y, zone_id);
+ float zoneX = object->GetPositionX();
+ float zoneY = object->GetPositionY();
- Map const* map = obj->GetMap();
- float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);
- float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());
+ Map2ZoneCoordinates(zoneX, zoneY, zoneId);
- GridCoord p = Trinity::ComputeGridCoord(obj->GetPositionX(), obj->GetPositionY());
+ Map const* map = object->GetMap();
+ float groundZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+
+ GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
// 63? WHY?
- int gx = 63 - p.x_coord;
- int gy = 63 - p.y_coord;
+ int gridX = 63 - gridCoord.x_coord;
+ int gridY = 63 - gridCoord.y_coord;
- uint32 have_map = Map::ExistMap(obj->GetMapId(), gx, gy) ? 1 : 0;
- uint32 have_vmap = Map::ExistVMap(obj->GetMapId(), gx, gy) ? 1 : 0;
+ uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
- if (have_vmap)
+ if (haveVMap)
{
- if (map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))
+ 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");
+ else
+ handler->PSendSysMessage("no VMAP available for area info");
handler->PSendSysMessage(LANG_MAP_POSITION,
- obj->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
- zone_id, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- area_id, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- obj->GetPhaseMask(),
- obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
- cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
- zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
-
- LiquidData liquid_status;
- ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);
- if (res)
- {
- handler->PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res);
- }
+ 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.type, status);
+
return true;
}
- static bool HandleWPGPSCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp
index 6f44000017d..f6c6d89c0b7 100644
--- a/src/server/scripts/Commands/cs_honor.cpp
+++ b/src/server/scripts/Commands/cs_honor.cpp
@@ -39,12 +39,14 @@ public:
{ "", SEC_GAMEMASTER, false, &HandleHonorAddCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
+
static ChatCommand honorCommandTable[] =
{
{ "add", SEC_GAMEMASTER, false, NULL, "", honorAddCommandTable },
{ "update", SEC_GAMEMASTER, false, &HandleHonorUpdateCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
+
static ChatCommand commandTable[] =
{
{ "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable },
@@ -52,7 +54,8 @@ public:
};
return commandTable;
}
- static bool HandleHonorAddCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleHonorAddCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -73,7 +76,8 @@ public:
target->RewardHonor(NULL, 1, amount);
return true;
}
- static bool HandleHonorAddKillCommand(ChatHandler* handler, const char* /*args*/)
+
+ static bool HandleHonorAddKillCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* target = handler->getSelectedUnit();
if (!target)
@@ -90,7 +94,8 @@ public:
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
return true;
}
- static bool HandleHonorUpdateCommand(ChatHandler* handler, const char* /*args*/)
+
+ static bool HandleHonorUpdateCommand(ChatHandler* handler, char const* /*args*/)
{
Player* target = handler->getSelectedPlayer();
if (!target)
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index 9eb315b0b6a..d03291d6d5d 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -37,28 +37,29 @@ 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[] =
@@ -68,7 +69,8 @@ public:
};
return commandTable;
}
- static bool HandleLearnCommand(ChatHandler* handler, const char* args)
+
+ static bool HandleLearnCommand(ChatHandler* handler, char const* args)
{
Player* targetPlayer = handler->getSelectedPlayer();
@@ -84,8 +86,8 @@ public:
if (!spell || !sSpellMgr->GetSpellInfo(spell))
return false;
- char const* allStr = strtok(NULL, " ");
- bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
+ char const* all = strtok(NULL, " ");
+ bool allRanks = all ? (strncmp(all, "all", strlen(all)) == 0) : false;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
@@ -110,14 +112,14 @@ public:
else
targetPlayer->learnSpell(spell, false);
- uint32 first_spell = sSpellMgr->GetFirstSpellInChain(spell);
- if (GetTalentSpellCost(first_spell))
+ uint32 firstSpell = sSpellMgr->GetFirstSpellInChain(spell);
+ if (GetTalentSpellCost(firstSpell))
targetPlayer->SendTalentsInfoData(false);
return true;
}
- static bool HandleLearnAllGMCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllGMCommand(ChatHandler* handler, char const* /*args*/)
{
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
@@ -135,19 +137,19 @@ public:
return true;
}
- static bool HandleLearnAllMyClassCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllMyClassCommand(ChatHandler* handler, char const* /*args*/)
{
HandleLearnAllMySpellsCommand(handler, "");
HandleLearnAllMyTalentsCommand(handler, "");
return true;
}
- static bool HandleLearnAllMySpellsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllMySpellsCommand(ChatHandler* handler, char const* /*args*/)
{
- ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(handler->GetSession()->GetPlayer()->getClass());
- if (!clsEntry)
+ ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(handler->GetSession()->GetPlayer()->getClass());
+ if (!classEntry)
return true;
- uint32 family = clsEntry->spellfamily;
+ uint32 family = classEntry->spellfamily;
for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i)
{
@@ -172,8 +174,8 @@ public:
continue;
// skip spells with first rank learned as talent (and all talents then also)
- uint32 first_rank = sSpellMgr->GetFirstSpellInChain(spellInfo->Id);
- if (GetTalentSpellCost(first_rank) > 0)
+ uint32 firstRank = sSpellMgr->GetFirstSpellInChain(spellInfo->Id);
+ if (GetTalentSpellCost(firstRank) > 0)
continue;
// skip broken spells
@@ -187,7 +189,7 @@ public:
return true;
}
- static bool HandleLearnAllMyTalentsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllMyTalentsCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
uint32 classMask = player->getClassMask();
@@ -207,7 +209,7 @@ public:
// search highest talent rank
uint32 spellId = 0;
- for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
+ for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
{
if (talentInfo->RankID[rank] != 0)
{
@@ -234,7 +236,7 @@ public:
return true;
}
- static bool HandleLearnAllMyPetTalentsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllMyPetTalentsCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
@@ -246,23 +248,23 @@ public:
return false;
}
- CreatureTemplate const* ci = pet->GetCreatureInfo();
- if (!ci)
+ CreatureTemplate const* creatureInfo = pet->GetCreatureInfo();
+ if (!creatureInfo)
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
handler->SetSentErrorMessage(true);
return false;
}
- CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
- if (!pet_family)
+ CreatureFamilyEntry const* petFamily = sCreatureFamilyStore.LookupEntry(creatureInfo->family);
+ if (!petFamily)
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
handler->SetSentErrorMessage(true);
return false;
}
- if (pet_family->petTalentType < 0) // not hunter pet
+ if (petFamily->petTalentType < 0) // not hunter pet
{
handler->SendSysMessage(LANG_WRONG_PET_TYPE);
handler->SetSentErrorMessage(true);
@@ -280,30 +282,30 @@ public:
continue;
// prevent learn talent for different family (cheating)
- if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask) == 0)
+ if (((1 << petFamily->petTalentType) & talentTabInfo->petTalentMask) == 0)
continue;
// search highest talent rank
- uint32 spellid = 0;
+ uint32 spellId = 0;
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
if (talentInfo->RankID[rank] != 0)
{
- spellid = talentInfo->RankID[rank];
+ spellId = talentInfo->RankID[rank];
break;
}
}
- if (!spellid) // ??? none spells in talent
+ if (!spellId) // ??? none spells in talent
continue;
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
- pet->learnSpellHighRank(spellid);
+ pet->learnSpellHighRank(spellId);
}
pet->SetFreeTalentPoints(0);
@@ -312,7 +314,7 @@ public:
return true;
}
- static bool HandleLearnAllLangCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllLangCommand(ChatHandler* handler, char const* /*args*/)
{
// skipping UNIVERSAL language (0)
for (uint8 i = 1; i < LANGUAGES_COUNT; ++i)
@@ -322,7 +324,7 @@ public:
return true;
}
- static bool HandleLearnAllDefaultCommand(ChatHandler* handler, const char* args)
+ static bool HandleLearnAllDefaultCommand(ChatHandler* handler, char const* args)
{
Player* target;
if (!handler->extractPlayerTarget((char*)args, &target))
@@ -335,9 +337,8 @@ public:
return true;
}
- static bool HandleLearnAllCraftsCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleLearnAllCraftsCommand(ChatHandler* handler, char const* /*args*/)
{
-
for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i)
{
SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i);
@@ -355,7 +356,7 @@ public:
return true;
}
- static bool HandleLearnAllRecipesCommand(ChatHandler* handler, const char* args)
+ static bool HandleLearnAllRecipesCommand(ChatHandler* handler, char const* args)
{
// Learns all recipes of specified profession and sets skill to max
// Example: .learn all_recipes enchanting
@@ -370,13 +371,13 @@ public:
if (!*args)
return false;
- std::wstring wnamepart;
+ std::wstring namePart;
- if (!Utf8toWStr(args, wnamepart))
+ if (!Utf8toWStr(args, namePart))
return false;
// converting string that we try to find to lower case
- wstrToLower(wnamepart);
+ wstrToLower(namePart);
std::string name;
@@ -392,29 +393,29 @@ public:
!skillInfo->canLink) // only prof with recipes have set
continue;
- int loc = handler->GetSessionDbcLocale();
- name = skillInfo->name[loc];
+ int locale = handler->GetSessionDbcLocale();
+ name = skillInfo->name[locale];
if (name.empty())
continue;
- if (!Utf8FitTo(name, wnamepart))
+ if (!Utf8FitTo(name, namePart))
{
- loc = 0;
- for (; loc < TOTAL_LOCALES; ++loc)
+ locale = 0;
+ for (; locale < TOTAL_LOCALES; ++locale)
{
- if (loc == handler->GetSessionDbcLocale())
+ if (locale == handler->GetSessionDbcLocale())
continue;
- name = skillInfo->name[loc];
+ name = skillInfo->name[locale];
if (name.empty())
continue;
- if (Utf8FitTo(name, wnamepart))
+ if (Utf8FitTo(name, namePart))
break;
}
}
- if (loc < TOTAL_LOCALES)
+ if (locale < TOTAL_LOCALES)
{
targetSkillInfo = skillInfo;
break;
@@ -431,7 +432,8 @@ public:
handler->PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str());
return true;
}
- static void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id)
+
+ static void HandleLearnSkillRecipesHelper(Player* player, uint32 skillId)
{
uint32 classmask = player->getClassMask();
@@ -442,7 +444,7 @@ public:
continue;
// wrong skill
- if (skillLine->skillId != skill_id)
+ if (skillLine->skillId != skillId)
continue;
// not high rank
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 0fecfa83221..20d0994b911 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -155,7 +155,7 @@ public:
}
//add item in vendorlist
- static bool HandleNpcAddVendorItemCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcAddVendorItemCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -168,7 +168,11 @@ public:
return false;
}
- uint32 itemId = atol(pitem);
+ int32 item_int = atol(pitem);
+ if (item_int <= 0)
+ return false;
+
+ uint32 itemId = item_int;
char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0
uint32 maxcount = 0;
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 31d8cd3c8f2..3d437e473f7 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -128,13 +128,13 @@ public:
// remove all quest entries for 'entry' from quest log
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
{
- uint32 quest = player->GetQuestSlotQuestId(slot);
- if (quest == entry)
+ uint32 logQuest = player->GetQuestSlotQuestId(slot);
+ if (logQuest == entry)
{
player->SetQuestSlot(slot, 0);
// we ignore unequippable quest items in this case, its' still be equipped
- player->TakeQuestSourceItem(quest, false);
+ player->TakeQuestSourceItem(logQuest, false);
}
}
@@ -176,8 +176,8 @@ public:
// Add quest items for quests that require items
for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x)
{
- uint32 id = quest->ReqItemId[x];
- uint32 count = quest->ReqItemCount[x];
+ uint32 id = quest->RequiredItemId[x];
+ uint32 count = quest->RequiredItemCount[x];
if (!id || !count)
continue;
@@ -195,10 +195,10 @@ public:
// All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10")
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
- int32 creature = quest->ReqCreatureOrGOId[i];
- uint32 creaturecount = quest->ReqCreatureOrGOCount[i];
+ int32 creature = quest->RequiredNpcOrGo[i];
+ uint32 creaturecount = quest->RequiredNpcOrGoCount[i];
- if (uint32 spell_id = quest->ReqSpell[i])
+ if (uint32 spell_id = quest->RequiredSpellCast[i])
{
for (uint16 z = 0; z < creaturecount; ++z)
player->CastedCreatureOrGO(creature, 0, spell_id);
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index 17c076f903c..ef4ddf17476 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -125,6 +125,29 @@ public:
if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
return false;
+ if (strcmp(teleStr, "$home") == 0) // References target's homebind
+ {
+ if (target)
+ target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
+ else
+ {
+ QueryResult resultDB = CharacterDatabase.PQuery("SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = %u", target_guid);
+ if (resultDB)
+ {
+ Field* fieldsDB = resultDB->Fetch();
+ uint32 mapId = fieldsDB[0].GetUInt32();
+ uint32 zoneId = fieldsDB[1].GetUInt32();
+ float posX = fieldsDB[2].GetFloat();
+ float posY = fieldsDB[3].GetFloat();
+ float posZ = fieldsDB[4].GetFloat();
+
+ Player::SavePositionInDB(mapId, posX, posY, posZ, 0, zoneId, target_guid);
+ }
+ }
+
+ return true;
+ }
+
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
GameTele const* tele = handler->extractGameTeleFromLink(teleStr);
if (!tele)
@@ -187,8 +210,8 @@ public:
if (!*args)
return false;
- Player* player = handler->getSelectedPlayer();
- if (!player)
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
@@ -196,7 +219,7 @@ public:
}
// check online security
- if (handler->HasLowerSecurity(player, 0))
+ if (handler->HasLowerSecurity(target, 0))
return false;
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
@@ -216,9 +239,9 @@ public:
return false;
}
- std::string nameLink = handler->GetNameLink(player);
+ std::string nameLink = handler->GetNameLink(target);
- Group* grp = player->GetGroup();
+ Group* grp = target->GetGroup();
if (!grp)
{
handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
@@ -228,38 +251,38 @@ public:
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
- Player* pl = itr->getSource();
+ Player* player = itr->getSource();
- if (!pl || !pl->GetSession())
+ if (!player || !player->GetSession())
continue;
// check online security
- if (handler->HasLowerSecurity(pl, 0))
+ if (handler->HasLowerSecurity(player, 0))
return false;
- std::string plNameLink = handler->GetNameLink(pl);
+ std::string plNameLink = handler->GetNameLink(player);
- if (pl->IsBeingTeleported())
+ if (player->IsBeingTeleported())
{
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
continue;
}
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
- if (handler->needReportToTarget(pl))
- (ChatHandler(pl)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
+ if (handler->needReportToTarget(player))
+ (ChatHandler(player)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
// stop flight if need
- if (pl->isInFlight())
+ if (player->isInFlight())
{
- pl->GetMotionMaster()->MovementExpired();
- pl->CleanupAfterTaxiFlight();
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
- pl->SaveRecallPosition();
+ player->SaveRecallPosition();
- pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
+ player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
}
return true;
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index f754a32fbfc..ebeb7b8f4f4 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -480,55 +480,43 @@ public:
}
// The visual waypoint
- Creature* wpCreature = NULL;
wpGuid = target->GetGUIDLow();
- // Did the user select a visual spawnpoint?
- if (wpGuid)
- wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- // attempt check creature existence by DB data
- else
- {
- handler->PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, wpGuid);
- return false;
- }
// User did select a visual waypoint?
+
// Check the creature
- if (wpCreature->GetEntry() == VISUAL_WAYPOINT)
- {
- QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid);
+ QueryResult result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid);
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow());
+ // Select waypoint number from database
+ // Since we compare float values, we have to deal with
+ // some difficulties.
+ // Here we search for all waypoints that only differ in one from 1 thousand
+ // (0.001) - There is no other way to compare C++ floats with mySQL floats
+ // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html
+ const char* maxDIFF = "0.01";
+ result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)",
+ target->GetPositionX(), maxDIFF, target->GetPositionY(), maxDIFF, target->GetPositionZ(), maxDIFF);
if (!result)
{
- handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow());
- // Select waypoint number from database
- // Since we compare float values, we have to deal with
- // some difficulties.
- // Here we search for all waypoints that only differ in one from 1 thousand
- // (0.001) - There is no other way to compare C++ floats with mySQL floats
- // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html
- const char* maxDIFF = "0.01";
- result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)",
- wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF);
- if (!result)
- {
- handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid);
- return true;
- }
- }
-
- do
- {
- Field* fields = result->Fetch();
- pathid = fields[0].GetUInt32();
- point = fields[1].GetUInt32();
+ handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid);
+ return true;
}
- while (result->NextRow());
+ }
- // We have the waypoint number and the GUID of the "master npc"
- // Text is enclosed in "<>", all other arguments not
- arg_str = strtok((char*)NULL, " ");
+ do
+ {
+ Field* fields = result->Fetch();
+ pathid = fields[0].GetUInt32();
+ point = fields[1].GetUInt32();
}
+ while (result->NextRow());
+
+ // We have the waypoint number and the GUID of the "master npc"
+ // Text is enclosed in "<>", all other arguments not
+ arg_str = strtok((char*)NULL, " ");
// Check for argument
if (show != "del" && show != "move" && arg_str == NULL)
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index 2bcfab80056..aa0fee873e1 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -136,9 +136,9 @@ public:
{
uint8 r = rand()%4;
uint8 pos[3];
- pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0);
- pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1));
- pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0)
+ pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0);
+ pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1));
+ pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0)
for (int i=0; i<3; ++i)
if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 719c42c0a57..55254a3b8ee 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -201,7 +201,8 @@ public:
//object already removed, not exist
if (!pAdd)
{
- if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
+ pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0);
+ if (pAdd)
m_auiLackeyGUID[j] = pAdd->GetGUID();
}
++j;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
index 592e0054fa4..4bc3da16651 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
@@ -110,7 +110,7 @@ class boss_ragnaros : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- if (urand(0, 99 < 25))
+ if (urand(0, 99) < 25)
DoScriptText(SAY_KILL, me);
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index aea25af87bf..18316d67cd4 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -497,9 +497,9 @@ public:
SetEscortPaused(bOnHold);
}
- void WaypointReached(uint32 i)
+ void WaypointReached(uint32 wpId)
{
- switch (i)
+ switch (wpId)
{
case 0:
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
@@ -1173,8 +1173,8 @@ public:
temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running
temp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z);
- if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- temp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him
+ if (Creature* lktemp = Unit::GetCreature(*me, uiLichKingGUID))
+ lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him
}
JumpToNextStep(1500);
break;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 9afbeaa0172..c9ab9084d22 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -504,15 +504,14 @@ public:
Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true)
{
Map* map = me->GetMap();
- if (!map->IsDungeon()) return NULL;
+ if (!map->IsDungeon())
+ return NULL;
Map::PlayerList const &PlayerList = map->GetPlayers();
- Map::PlayerList::const_iterator i;
- if (PlayerList.isEmpty()) return NULL;
+ if (PlayerList.isEmpty())
+ return NULL;
std::list<Player*> temp;
- std::list<Player*>::const_iterator j;
-
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() &&
me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive())
@@ -520,7 +519,7 @@ public:
if (!temp.empty())
{
- j = temp.begin();
+ std::list<Player*>::const_iterator j = temp.begin();
advance(j, rand()%temp.size());
return (*j);
}
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 3b788c72cd8..d0ea617b734 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -102,7 +102,7 @@ public:
{
if (m_instance)
{
- if (m_instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED))
+ if (m_instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) != NOT_STARTED)
m_instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL);
}
}
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index b29a0c491cc..ca853d5684e 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -662,11 +662,13 @@ public:
{
float x, y, z;
Unit* target = NULL;
- for (uint8 z = 0; z < 6; ++z)
+ for (uint8 i = 0; i < 6; ++i)
{
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
- if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0))break;
+ if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0))
+ break;
}
+
if (target)
{
target->GetPosition(x, y, z);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index fd11b4a4985..7c14845f060 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -330,14 +330,14 @@ public:
else
{
DarkFiend = false;
- for (uint8 i = 0; i < 8; ++i)
- me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[i][0], DarkFiends[i][1], DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
+ for (uint8 j = 0; j < 8; ++j)
+ me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
Timer[TIMER_DARKNESS] = 42000;
}
break;
case TIMER_HUMANOIDES:
- for (uint8 i = 0; i < 6; ++i)
- me->SummonCreature(uint32(Humanoides[i][0]), Humanoides[i][1], Humanoides[i][2], Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0);
+ for (uint8 j = 0; j < 6; ++j)
+ me->SummonCreature(uint32(Humanoides[j][0]), Humanoides[j][1], Humanoides[j][2], Humanoides[j][3], Humanoides[j][4], TEMPSUMMON_CORPSE_DESPAWN, 0);
Timer[TIMER_HUMANOIDES] = 60000;
break;
case TIMER_PHASE:
diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp
index 10b7066068b..d02cce3f17c 100644
--- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp
+++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp
@@ -35,91 +35,6 @@ EndContentData */
#include "ScriptedEscortAI.h"
/*######
-## npc_prospector_anvilward
-######*/
-
-#define GOSSIP_HELLO "I need a moment of your time, sir."
-#define GOSSIP_SELECT "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward."
-
-enum eProspectorAnvilward
-{
- SAY_ANVIL1 = -1000209,
- SAY_ANVIL2 = -1000210,
- QUEST_THE_DWARVEN_SPY = 8483,
-};
-
-class npc_prospector_anvilward : public CreatureScript
-{
-public:
- npc_prospector_anvilward() : CreatureScript("npc_prospector_anvilward") { }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (uiAction)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->SEND_GOSSIP_MENU(8240, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->CLOSE_GOSSIP_MENU();
- if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilward::npc_prospector_anvilwardAI, creature->AI()))
- pEscortAI->Start(true, false, player->GetGUID());
- break;
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (player->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
-
- player->SEND_GOSSIP_MENU(8239, creature->GetGUID());
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_prospector_anvilwardAI(creature);
- }
-
- struct npc_prospector_anvilwardAI : public npc_escortAI
- {
- // CreatureAI functions
- npc_prospector_anvilwardAI(Creature* c) : npc_escortAI(c) {}
-
- // Pure Virtual Functions
- void WaypointReached(uint32 i)
- {
- Player* player = GetPlayerForEscort();
-
- if (!player)
- return;
-
- switch (i)
- {
- case 0: DoScriptText(SAY_ANVIL1, me, player); break;
- case 5: DoScriptText(SAY_ANVIL2, me, player); break;
- case 6: me->setFaction(24); break;
- }
- }
-
- void Reset()
- {
- me->RestoreFaction();
- }
-
- void JustDied(Unit* /*killer*/)
- {
- me->RestoreFaction();
- }
- };
-
-};
-
-/*######
## Quest 9686 Second Trial
######*/
@@ -711,7 +626,6 @@ public:
void AddSC_eversong_woods()
{
- new npc_prospector_anvilward();
new npc_second_trial_controller();
new npc_second_trial_paladin();
new go_second_trial();
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
index 0e5233d6620..338f320dcc2 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -205,9 +205,9 @@ public:
{
if (i->getSource())
{
- WorldPacket data(SMSG_MESSAGECHAT, 200);
- unit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
- i->getSource()->GetSession()->SendPacket(&data);
+ WorldPacket packet(SMSG_MESSAGECHAT, 200);
+ unit->BuildMonsterChat(&packet, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
+ i->getSource()->GetSession()->SendPacket(&packet);
WorldPacket data2(SMSG_PLAY_SOUND, 4);
data2 << 10986;
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 02f9435db49..82f16dd7784 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -579,13 +579,16 @@ public:
{
//After reset
case 0:
- if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f))
- uiJainaGUID = pJaina->GetGUID();
- else if (Unit* pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000))
+ {
+ Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f);
+ if (!pJaina)
+ pJaina = pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000);
+ if (pJaina)
uiJainaGUID = pJaina->GetGUID();
bStepping = false;
JumpToNextStep(0);
break;
+ }
//After waypoint 0
case 1:
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
@@ -829,9 +832,10 @@ public:
case 37:
if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID))
{
- if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f))
- pZombie->UpdateEntry(NPC_ZOMBIE, 0);
- else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f))
+ Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f);
+ if (!pZombie)
+ pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f);
+ if (pZombie)
pZombie->UpdateEntry(NPC_ZOMBIE, 0);
else //There's no one else to transform
uiStep++;
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 4cc1069b838..43265cb4430 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -680,12 +680,8 @@ public:
//Place all units in threat list on outside of stomach
Stomach_Map.clear();
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (; i != me->getThreatManager().getThreatList().end(); ++i)
- {
- //Outside stomach
- Stomach_Map[(*i)->getUnitGuid()] = false;
- }
+ for (std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
+ Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach
//Spawn 2 flesh tentacles
FleshTentaclesKilled = 0;
diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
index e19054d2f46..e19054d2f46 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index cde97f8d37b..cde97f8d37b 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
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 a2371fa0121..a2371fa0121 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
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 bc4d4ba5eea..bc4d4ba5eea 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
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 b2975797a02..b2975797a02 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
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 9a7dc2f2cc9..9a7dc2f2cc9 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index 5ba11dd5353..5ba11dd5353 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
index 63e714d17aa..53b47884e57 100644
--- a/src/server/scripts/Northrend/CMakeLists.txt
+++ b/src/server/scripts/Northrend/CMakeLists.txt
@@ -18,23 +18,23 @@ set(scripts_STAT_SRCS
Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
- Northrend/Ulduar/ulduar/boss_general_vezax.cpp
- Northrend/Ulduar/ulduar/ulduar_teleporter.cpp
- Northrend/Ulduar/ulduar/boss_thorim.cpp
- Northrend/Ulduar/ulduar/boss_ignis.cpp
- Northrend/Ulduar/ulduar/boss_algalon.cpp
- Northrend/Ulduar/ulduar/instance_ulduar.cpp
- Northrend/Ulduar/ulduar/boss_auriaya.cpp
- Northrend/Ulduar/ulduar/boss_yoggsaron.cpp
- Northrend/Ulduar/ulduar/boss_hodir.cpp
- Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp
- Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
- Northrend/Ulduar/ulduar/boss_xt002.cpp
- Northrend/Ulduar/ulduar/boss_mimiron.cpp
- Northrend/Ulduar/ulduar/ulduar.h
- Northrend/Ulduar/ulduar/boss_freya.cpp
- Northrend/Ulduar/ulduar/boss_razorscale.cpp
- Northrend/Ulduar/ulduar/boss_kologarn.cpp
+ Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+ Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
+ Northrend/Ulduar/Ulduar/boss_thorim.cpp
+ Northrend/Ulduar/Ulduar/boss_ignis.cpp
+ Northrend/Ulduar/Ulduar/boss_algalon.cpp
+ Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+ Northrend/Ulduar/Ulduar/boss_auriaya.cpp
+ Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
+ Northrend/Ulduar/Ulduar/boss_hodir.cpp
+ Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
+ Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+ Northrend/Ulduar/Ulduar/boss_xt002.cpp
+ Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ Northrend/Ulduar/Ulduar/ulduar.h
+ Northrend/Ulduar/Ulduar/boss_freya.cpp
+ Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+ Northrend/Ulduar/Ulduar/boss_kologarn.cpp
Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
Northrend/Ulduar/HallsOfStone/halls_of_stone.h
Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
@@ -142,13 +142,13 @@ set(scripts_STAT_SRCS
Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp
Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
- Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp
- Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp
- Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp
- Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp
- Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp
- Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp
- Northrend/AzjolNerub/ahnkahet/ahnkahet.h
+ Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+ Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+ Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+ Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+ Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+ Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+ Northrend/AzjolNerub/Ahnkahet/ahnkahet.h
Northrend/VioletHold/boss_zuramat.cpp
Northrend/VioletHold/instance_violet_hold.cpp
Northrend/VioletHold/boss_lavanthor.cpp
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 2688005ee22..a1e906e214a 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
@@ -221,10 +221,9 @@ public:
{
uiVehicle1GUID = pBoss->GetGUID();
uint64 uiGrandChampionBoss1 = 0;
- if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID))
- if (Vehicle* pVehicle = pBoss->GetVehicleKit())
- if (Unit* unit = pVehicle->GetPassenger(0))
- uiGrandChampionBoss1 = unit->GetGUID();
+ if (Vehicle* pVehicle = pBoss->GetVehicleKit())
+ if (Unit* unit = pVehicle->GetPassenger(0))
+ uiGrandChampionBoss1 = unit->GetGUID();
if (instance)
{
instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID);
@@ -237,10 +236,9 @@ public:
{
uiVehicle2GUID = pBoss->GetGUID();
uint64 uiGrandChampionBoss2 = 0;
- if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID))
- if (Vehicle* pVehicle = pBoss->GetVehicleKit())
- if (Unit* unit = pVehicle->GetPassenger(0))
- uiGrandChampionBoss2 = unit->GetGUID();
+ if (Vehicle* pVehicle = pBoss->GetVehicleKit())
+ if (Unit* unit = pVehicle->GetPassenger(0))
+ uiGrandChampionBoss2 = unit->GetGUID();
if (instance)
{
instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID);
@@ -253,10 +251,9 @@ public:
{
uiVehicle3GUID = pBoss->GetGUID();
uint64 uiGrandChampionBoss3 = 0;
- if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID))
- if (Vehicle* pVehicle = pBoss->GetVehicleKit())
- if (Unit* unit = pVehicle->GetPassenger(0))
- uiGrandChampionBoss3 = unit->GetGUID();
+ if (Vehicle* pVehicle = pBoss->GetVehicleKit())
+ if (Unit* unit = pVehicle->GetPassenger(0))
+ uiGrandChampionBoss3 = unit->GetGUID();
if (instance)
{
instance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID);
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 d4514dd547e..1ee7bcb4120 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -348,10 +348,10 @@ public:
m_bTargetDied = true;
me->GetMotionMaster()->MoveJump(gormok->GetPositionX(), gormok->GetPositionY(), gormok->GetPositionZ(), 15.0f, 15.0f);
}
- else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
- m_uiTargetGUID = target->GetGUID();
- me->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 15.0f, 15.0f);
+ m_uiTargetGUID = target2->GetGUID();
+ me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f);
}
}
}
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 adbe59555b6..68223f170c5 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
@@ -114,6 +114,8 @@ struct outroPosition
{ { 0, 0 }, { 0.0f, 0.0f, 0.0f, 0.0f } }
};
+Position const CrucibleSummonPos = {5672.294f,2520.686f, 713.4386f, 0.9599311f};
+
#define DATA_THREE_FACED 1
class boss_devourer_of_souls : public CreatureScript
@@ -154,6 +156,8 @@ class boss_devourer_of_souls : public CreatureScript
{
DoScriptText(RAND(SAY_FACE_ANGER_AGGRO, SAY_FACE_DESIRE_AGGRO), me);
+ if (!me->FindNearestCreature(NPC_CRUCIBLE_OF_SOULS, 60)) // Prevent double spawn
+ instance->instance->SummonCreature(NPC_CRUCIBLE_OF_SOULS, CrucibleSummonPos);
events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000);
events.ScheduleEvent(EVENT_MIRRORED_SOUL, 8000);
events.ScheduleEvent(EVENT_WELL_OF_SOULS, 30000);
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h
index 85062cc2901..9f34e412847 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h
@@ -46,5 +46,6 @@ enum Creatures
NPC_CHAMPION_3_HORDE = 37588,
NPC_CHAMPION_1_ALLIANCE = 37496,
NPC_CHAMPION_2_ALLIANCE = 37497,
+ NPC_CRUCIBLE_OF_SOULS = 37094,
};
#endif
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index dca53f1a5e7..29c3276467b 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -242,6 +242,9 @@ class boss_sindragosa : public CreatureScript
{
if (action == ACTION_START_FROSTWYRM)
{
+ if (TempSummon* summon = me->ToTempSummon())
+ summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN);
+
instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 255);
if (me->isDead())
return;
@@ -968,10 +971,10 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
- if (!GetHitUnit()->isAlive())
+ if (!GetHitUnit()->isAlive() || !_targetCount)
return;
- float resistance = float(GetHitUnit()->GetResistance(GetFirstSchoolInMask(SpellSchoolMask(GetSpellInfo()->SchoolMask))));
+ 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;
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 38f334058b8..2f4f225561c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -1335,7 +1335,7 @@ class npc_shambling_horror_icc : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& damage)
{
- if (IsHeroic() && me->HealthBelowPctDamaged(20, damage))
+ if (!_frenzied && IsHeroic() && me->HealthBelowPctDamaged(20, damage))
{
_frenzied = true;
DoCast(me, SPELL_FRENZY, true);
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 9c3c9156d63..96c061f4c98 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -683,7 +683,7 @@ public:
// Note: summon must be done by trigger and not by KT.
// Otherwise, they attack immediately as KT is in combat.
- for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i)
+ for (uint8 i = 0; i < MAX_ABOMINATIONS; ++i)
{
if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i]))
{
@@ -692,7 +692,7 @@ public:
sum->SetReactState(REACT_DEFENSIVE);
}
}
- for (uint8 i = 0; i <= MAX_WASTES; ++i)
+ for (uint8 i = 0; i < MAX_WASTES; ++i)
{
if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i]))
{
@@ -701,7 +701,7 @@ public:
sum->SetReactState(REACT_DEFENSIVE);
}
}
- for (uint8 i = 0; i <= MAX_WEAVERS; ++i)
+ for (uint8 i = 0; i < MAX_WEAVERS; ++i)
{
if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i]))
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index 10f1b809694..3b87dea025c 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -91,7 +91,7 @@ public:
_EnterCombat();
Enraged = false;
DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me);
- events.ScheduleEvent(EVENT_HATEFUL, 1200);
+ events.ScheduleEvent(EVENT_HATEFUL, 1000);
events.ScheduleEvent(EVENT_BERSERK, 360000);
if (instance)
@@ -131,7 +131,7 @@ public:
DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE, H_SPELL_HATEFUL_STRIKE), true);
- events.ScheduleEvent(EVENT_HATEFUL, 1200);
+ events.ScheduleEvent(EVENT_HATEFUL, 1000);
break;
}
case EVENT_BERSERK:
@@ -140,7 +140,7 @@ public:
events.ScheduleEvent(EVENT_SLIME, 2000);
break;
case EVENT_SLIME:
- DoCast(me->getVictim(), SPELL_SLIME_BOLT);
+ DoCast(me->getVictim(), SPELL_SLIME_BOLT, true);
events.ScheduleEvent(EVENT_SLIME, 2000);
break;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index d620289a72f..ed1bbd1971a 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -271,14 +271,18 @@ public:
break;
}
case EVENT_FLIGHT:
- phase = PHASE_FLIGHT;
- events.SetPhase(PHASE_FLIGHT);
- me->SetReactState(REACT_PASSIVE);
- me->AttackStop();
- float x, y, z, o;
- me->GetHomePosition(x, y, z, o);
- me->GetMotionMaster()->MovePoint(1, x, y, z);
- return;
+ if (HealthAbovePct(10))
+ {
+ phase = PHASE_FLIGHT;
+ events.SetPhase(PHASE_FLIGHT);
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
+ float x, y, z, o;
+ me->GetHomePosition(x, y, z, o);
+ me->GetMotionMaster()->MovePoint(1, x, y, z);
+ return;
+ }
+ break;
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp
index 3888cc43bc9..3888cc43bc9 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
index 2e2ca25385c..a8a4fad5e4e 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp
@@ -56,8 +56,9 @@ enum AssemblySpells
SPELL_CHAIN_LIGHTNING = 61879,
SPELL_OVERLOAD = 61869,
SPELL_LIGHTNING_WHIRL = 61915,
- SPELL_LIGHTNING_TENDRILS = 61887,
- SPELL_LIGHTNING_TENDRILS_SELF_VISUAL = 61883,
+ SPELL_LIGHTNING_TENDRILS_10M = 61887,
+ SPELL_LIGHTNING_TENDRILS_25M = 63486,
+ SPELL_LIGHTNING_TENDRILS_VISUAL = 61883,
SPELL_STORMSHIELD = 64187,
};
@@ -215,7 +216,6 @@ class boss_steelbreaker : public CreatureScript
{
_Reset();
phase = 0;
- me->ResetLootMode();
me->RemoveAllAuras();
RespawnEncounter(instance, me);
}
@@ -342,7 +342,6 @@ class boss_runemaster_molgeim : public CreatureScript
{
_Reset();
phase = 0;
- me->ResetLootMode();
me->RemoveAllAuras();
RespawnEncounter(instance, me);
}
@@ -575,9 +574,10 @@ class boss_stormcaller_brundir : public CreatureScript
{
_Reset();
phase = 0;
- me->ResetLootMode();
me->RemoveAllAuras();
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload)
+ me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
RespawnEncounter(instance, me);
}
@@ -609,6 +609,7 @@ class boss_stormcaller_brundir : public CreatureScript
{
DoCast(me, SPELL_STORMSHIELD);
events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(50000, 60000));
+ me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); // Apply immumity to stuns
}
break;
@@ -677,10 +678,10 @@ class boss_stormcaller_brundir : public CreatureScript
break;
case EVENT_LIGHTNING_TENDRILS:
DoScriptText(SAY_BRUNDIR_FLIGHT, me);
- DoCast(SPELL_LIGHTNING_TENDRILS);
+ DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M));
+ DoCast(SPELL_LIGHTNING_TENDRILS_VISUAL);
me->AttackStop();
- me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
- DoCast(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL);
+ //me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->GetMotionMaster()->Initialize();
me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FINAL_FLIGHT_Z);
events.DelayEvents(35000);
@@ -707,11 +708,12 @@ class boss_stormcaller_brundir : public CreatureScript
events.ScheduleEvent(EVENT_GROUND, 2500);
break;
case EVENT_GROUND:
- me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
- me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS);
- me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_SELF_VISUAL);
+ //me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M));
+ me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL);
DoStartMovement(me->getVictim());
events.CancelEvent(EVENT_GROUND);
+ me->getThreatManager().resetAllAggro();
break;
case EVENT_MOVE_POSITION:
if (me->IsWithinMeleeRange(me->getVictim()))
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index bcc417c50cd..bcc417c50cd 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
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 ad79d1b56cc..ad79d1b56cc 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index f5a87431550..e7d8b070e53 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -282,7 +282,6 @@ class boss_freya : public CreatureScript
uint32 deforestation[6][2];
uint32 elementalTimer[2];
uint32 diffTimer;
- uint32 waveTime;
uint8 trioWaveCount;
uint8 trioWaveController;
uint8 waveCount;
@@ -291,14 +290,12 @@ class boss_freya : public CreatureScript
bool checkElementalAlive[2];
bool trioDefeated[2];
- bool waveInProgress;
bool random[3];
void Reset()
{
_Reset();
summons.clear();
- waveTime = 0;
trioWaveCount = 0;
trioWaveController = 0;
waveCount = 0;
@@ -315,7 +312,6 @@ class boss_freya : public CreatureScript
checkElementalAlive[n] = true;
trioDefeated[n] = false;
}
- waveInProgress = false;
for (uint8 n = 0; n < 3; ++n)
random[n] = false;
}
@@ -325,35 +321,12 @@ class boss_freya : public CreatureScript
DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
}
- void DamageTaken(Unit* /*who*/, uint32& damage)
+ void DamageTaken(Unit* who, uint32& damage)
{
if (damage >= me->GetHealth())
{
damage = 0;
- DoScriptText(SAY_DEATH, me);
- me->SetReactState(REACT_PASSIVE);
- _JustDied();
- me->RemoveAllAuras();
- me->AttackStop();
- me->setFaction(35);
- me->DeleteThreatList();
- me->CombatStop(true);
- me->DespawnOrUnsummon(7500);
- me->CastSpell(me, SPELL_KNOCK_ON_WOOD_CREDIT, true);
-
- Creature* Elder[3];
- for (uint8 n = 0; n < 3; ++n)
- {
- Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n));
- if (Elder[n] && Elder[n]->isAlive())
- {
- Elder[n]->RemoveAllAuras();
- Elder[n]->AttackStop();
- Elder[n]->CombatStop(true);
- Elder[n]->DeleteThreatList();
- Elder[n]->GetAI()->DoAction(ACTION_ELDER_FREYA_KILLED);
- }
- }
+ JustDied(who);
}
}
@@ -462,8 +435,6 @@ class boss_freya : public CreatureScript
events.ScheduleEvent(EVENT_UNSTABLE_ENERGY, urand(15000, 20000));
break;
case EVENT_WAVE:
- waveTime = 0;
- waveInProgress = true;
SpawnWave();
if (waveCount < 6)
events.ScheduleEvent(EVENT_WAVE, WAVE_TIME);
@@ -497,9 +468,6 @@ class boss_freya : public CreatureScript
diffTimer += diff; // For getting time difference for Deforestation achievement
- if (waveInProgress)
- waveTime += diff; // Time from the last wave
-
// Elementals must be killed within 12 seconds of each other, or they will all revive and heal
Creature* Elemental[3][2];
for (uint8 i = 0; i < 2; ++i)
@@ -543,7 +511,6 @@ class boss_freya : public CreatureScript
trioDefeated[i] = true;
Elemental[n][i]->CastSpell(me, SPELL_REMOVE_10STACK, true);
}
- TimeCheck();
}
}
}
@@ -633,9 +600,32 @@ class boss_freya : public CreatureScript
/* 25N */ {62952, 62954, 62956, 62958}
};
- who->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true);
+ me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true);
+ DoScriptText(SAY_DEATH, me);
+ me->SetReactState(REACT_PASSIVE);
_JustDied();
+ me->RemoveAllAuras();
+ me->AttackStop();
+ me->setFaction(35);
+ me->DeleteThreatList();
+ me->CombatStop(true);
+ me->DespawnOrUnsummon(7500);
+ me->CastSpell(me, SPELL_KNOCK_ON_WOOD_CREDIT, true);
+
+ Creature* Elder[3];
+ for (uint8 n = 0; n < 3; ++n)
+ {
+ Elder[n] = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF + n));
+ if (Elder[n] && Elder[n]->isAlive())
+ {
+ Elder[n]->RemoveAllAuras();
+ Elder[n]->AttackStop();
+ Elder[n]->CombatStop(true);
+ Elder[n]->DeleteThreatList();
+ Elder[n]->GetAI()->DoAction(ACTION_ELDER_FREYA_KILLED);
+ }
+ }
}
void JustSummoned(Creature* summoned)
@@ -653,6 +643,7 @@ class boss_freya : public CreatureScript
break;
case NPC_DETONATING_LASHER:
case NPC_ANCIENT_CONSERVATOR:
+ default:
summons.push_back(summoned->GetGUID());
break;
}
@@ -675,29 +666,14 @@ class boss_freya : public CreatureScript
summoned->CastSpell(who, SPELL_DETONATE, true);
summoned->ForcedDespawn(5000);
summons.remove(summoned->GetGUID());
- TimeCheck();
break;
case NPC_ANCIENT_CONSERVATOR:
summoned->CastSpell(me, SPELL_REMOVE_25STACK, true);
summoned->ForcedDespawn(5000);
summons.remove(summoned->GetGUID());
- TimeCheck();
break;
}
}
-
- void TimeCheck()
- {
- if (waveCount >= 6)
- return;
-
- waveInProgress = false;
- uint32 timeDifference = WAVE_TIME - waveTime;
- if (timeDifference <= TIME_DIFFERENCE)
- events.RescheduleEvent(EVENT_WAVE, timeDifference);
- else
- events.RescheduleEvent(EVENT_WAVE, TIME_DIFFERENCE);
- }
};
CreatureAI* GetAI(Creature* creature) const
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 7d00c0e59fc..7d00c0e59fc 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index bb21da94bc5..bb21da94bc5 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index b8876ae577a..b8876ae577a 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index 5da1c485986..5da1c485986 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index 11b7c54975e..11b7c54975e 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index 0e3a8926203..0e3a8926203 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
index f993c419b8c..f993c419b8c 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index ae803b24642..ae803b24642 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
index e4b21e1f66e..e4b21e1f66e 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_yoggsaron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 3c5697a7995..3c5697a7995 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index f11212d535e..f11212d535e 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
index 05b1e395d1e..05b1e395d1e 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
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 55211f3f047..dc2d34326a7 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
@@ -130,7 +130,7 @@ public:
me->SetHealth(0);
me->InterruptNonMeleeSpells(true);
me->RemoveAllAuras();
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->GetMotionMaster()->MovementExpired(false);
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
@@ -152,7 +152,7 @@ public:
{
bIsUndead = true;
bEventInProgress = false;
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->UpdateEntry(MOB_INGVAR_UNDEAD);
me->SetInCombatWith(me->getVictim());
me->GetMotionMaster()->MoveChase(me->getVictim());
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index 1b70de6244e..45534824860 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -48,7 +48,7 @@ enum Yells
};
enum Creatures
{
- CREATURE_ARTHAS = 24266, // Image of Arthas
+ CREATURE_ARTHAS = 29280, // Image of Arthas
CREATURE_SVALA_SORROWGRAVE = 26668, // Svala after transformation
CREATURE_SVALA = 29281, // Svala before transformation
CREATURE_RITUAL_CHANNELER = 27281
@@ -136,7 +136,6 @@ public:
if (Creature* pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN))
{
pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5);
uiArthasGUID = pArthas->GetGUID();
}
}
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp
index 9c40fbb3f82..96f1cb49b84 100644
--- a/src/server/scripts/Northrend/borean_tundra.cpp
+++ b/src/server/scripts/Northrend/borean_tundra.cpp
@@ -2125,7 +2125,7 @@ public:
{
Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW);
if (qInfo)
- CAST_PLR(killer)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0], 0);
+ CAST_PLR(killer)->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0);
}
}
};
diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp
index b3f1fb1b8b0..6f9481ec226 100644
--- a/src/server/scripts/Northrend/sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/sholazar_basin.cpp
@@ -98,8 +98,7 @@ public:
me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING);
break;
case 28:
- if (Player* player = GetPlayerForEscort())
- player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me);
+ player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me);
// me->RestoreFaction();
DoScriptText(SAY_END_IRO, me);
SetRun(false);
diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp
index 5dab265617e..aa3b696f5fd 100644
--- a/src/server/scripts/Northrend/zuldrak.cpp
+++ b/src/server/scripts/Northrend/zuldrak.cpp
@@ -1219,9 +1219,9 @@ public:
{
if (uiMissleTimer <= uiDiff)
{
- DoCast(me, uiSpell); // this spell is not supported ... YET!
+ if (uiSpell) // Sometimes it is 0, why?
+ DoCast(me, uiSpell); // this spell (what spell) is not supported ... YET!
uiMissleTimer = urand(2000, 7000);
-
} else uiMissleTimer -= uiDiff;
}
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 ce1f8739493..58585d0028e 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -641,7 +641,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void BeginEvent(Player* pl)
+ void BeginEvent(Player* player)
{
if (!instance)
return;
@@ -662,7 +662,7 @@ public:
me->CombatStart(Shade);
Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
Shade->SetTarget(me->GetGUID());
- if (pl) Shade->AddThreat(pl, 1.0f);
+ if (player) Shade->AddThreat(player, 1.0f);
DoZoneInCombat(Shade);
EventBegun = true;
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 1f603699060..6bf26e795ca 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -94,7 +94,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, me);
+ DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, me);
events.DelayEvents(5000, GCD_YELL);
}
@@ -175,7 +175,7 @@ public:
SpineTargetGUID = target->GetGUID();
//must let target summon, otherwise you cannot click the spine
target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
- DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me);
+ DoScriptText(urand(0, 1) ? SAY_NEEDLE1 : SAY_NEEDLE2, me);
events.DelayEvents(1500, GCD_CAST);
events.DelayEvents(15000, GCD_YELL);
}
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 f69aa1f0757..f8ed96632df 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -234,7 +234,7 @@ public:
{
me->MonsterTextEmote(EMOTE_SPOUT, 0, true);
me->SetReactState(REACT_PASSIVE);
- me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
+ me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
SpoutTimer = 45000;
WhirlTimer = 20000;//whirl directly after spout
RotTimer = 20000;
diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp
index 73ffb063b4d..c556253ecf1 100644
--- a/src/server/scripts/Outland/nagrand.cpp
+++ b/src/server/scripts/Outland/nagrand.cpp
@@ -19,330 +19,20 @@
/* ScriptData
SDName: Nagrand
SD%Complete: 90
-SDComment: Quest support: 9849, 9868, 9918, 9874, 9991, 10107, 10108, 10044, 10172, 10646, 10085, 10987. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text)
+SDComment: Quest support: 9868, 9874, 10044, 10172, 10085. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text)
SDCategory: Nagrand
EndScriptData */
/* ContentData
-mob_shattered_rumbler
-mob_lump
-npc_altruis_the_sufferer
npc_greatmother_geyah
-npc_lantresor_of_the_blade
npc_maghar_captive
npc_creditmarker_visit_with_ancestors
-mob_sparrowhawk
EndContentData */
#include "ScriptPCH.h"
#include "ScriptedEscortAI.h"
/*######
-## mob_shattered_rumbler - this should be done with ACID
-######*/
-
-class mob_shattered_rumbler : public CreatureScript
-{
-public:
- mob_shattered_rumbler() : CreatureScript("mob_shattered_rumbler") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_shattered_rumblerAI (creature);
- }
-
- struct mob_shattered_rumblerAI : public ScriptedAI
- {
- bool Spawn;
-
- mob_shattered_rumblerAI(Creature* c) : ScriptedAI(c) {}
-
- void Reset()
- {
- Spawn = false;
- }
-
- void EnterCombat(Unit* /*who*/) {}
-
- void SpellHit(Unit* Hitter, const SpellInfo* Spellkind)
- {
- if (Spellkind->Id == 32001 && !Spawn)
- {
- float x = me->GetPositionX();
- float y = me->GetPositionY();
- float z = me->GetPositionZ();
-
- Hitter->SummonCreature(18181, x+(0.7f * (rand()%30)), y+(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
- Hitter->SummonCreature(18181, x+(rand()%5), y-(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
- Hitter->SummonCreature(18181, x-(rand()%5), y+(0.5f *(rand()%60)), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
- me->setDeathState(CORPSE);
- Spawn = true;
- }
- return;
- }
- };
-
-};
-
-/*######
-## mob_lump
-######*/
-
-#define SPELL_VISUAL_SLEEP 16093
-#define SPELL_SPEAR_THROW 32248
-
-#define LUMP_SAY0 -1000190
-#define LUMP_SAY1 -1000191
-
-#define LUMP_DEFEAT -1000192
-
-#define GOSSIP_HL "I need answers, ogre!"
-#define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory."
-#define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar."
-#define GOSSIP_SL3 "This means war, Lump! War I say!"
-
-class mob_lump : public CreatureScript
-{
-public:
- mob_lump() : CreatureScript("mob_lump") { }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (uiAction)
- {
- 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(9353, 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(9354, 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(9355, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->SEND_GOSSIP_MENU(9356, creature->GetGUID());
- player->TalkedToCreature(18354, creature->GetGUID());
- break;
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (player->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
-
- player->SEND_GOSSIP_MENU(9352, creature->GetGUID());
-
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_lumpAI(creature);
- }
-
- struct mob_lumpAI : public ScriptedAI
- {
- mob_lumpAI(Creature* c) : ScriptedAI(c)
- {
- bReset = false;
- }
-
- uint32 Reset_Timer;
- uint32 Spear_Throw_Timer;
- bool bReset;
-
- void Reset()
- {
- Reset_Timer = 60000;
- Spear_Throw_Timer = 2000;
-
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- }
-
- void AttackedBy(Unit* pAttacker)
- {
- if (me->getVictim())
- return;
-
- if (me->IsFriendlyTo(pAttacker))
- return;
-
- AttackStart(pAttacker);
- }
-
- void DamageTaken(Unit* done_by, uint32 & damage)
- {
- if (done_by->GetTypeId() == TYPEID_PLAYER && me->HealthBelowPctDamaged(30, damage))
- {
- if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE)
- {
- //Take 0 damage
- damage = 0;
-
- CAST_PLR(done_by)->AttackStop();
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->RemoveAllAuras();
- me->DeleteThreatList();
- me->CombatStop(true);
- me->setFaction(1080); //friendly
- me->SetStandState(UNIT_STAND_STATE_SIT);
- DoScriptText(LUMP_DEFEAT, me);
-
- bReset = true;
- }
- }
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- if (me->HasAura(SPELL_VISUAL_SLEEP))
- me->RemoveAura(SPELL_VISUAL_SLEEP);
-
- if (!me->IsStandState())
- me->SetStandState(UNIT_STAND_STATE_STAND);
-
- DoScriptText(RAND(LUMP_SAY0, LUMP_SAY1), me);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //check if we waiting for a reset
- if (bReset)
- {
- if (Reset_Timer <= diff)
- {
- EnterEvadeMode();
- bReset = false;
- me->setFaction(1711); //hostile
- return;
- }
- else Reset_Timer -= diff;
- }
-
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- //Spear_Throw_Timer
- if (Spear_Throw_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_SPEAR_THROW);
- Spear_Throw_Timer = 20000;
- } else Spear_Throw_Timer -= diff;
-
- DoMeleeAttackIfReady();
- }
- };
-
-};
-
-/*######
-## npc_altruis_the_sufferer
-######*/
-
-#define GOSSIP_HATS1 "I see twisted steel and smell sundered earth."
-#define GOSSIP_HATS2 "Well...?"
-#define GOSSIP_HATS3 "[PH] Story about Illidan's Pupil"
-
-#define GOSSIP_SATS1 "Legion?"
-#define GOSSIP_SATS2 "And now?"
-#define GOSSIP_SATS3 "How do you see them now?"
-#define GOSSIP_SATS4 "Forge camps?"
-#define GOSSIP_SATS5 "Ok."
-#define GOSSIP_SATS6 "[PH] Story done"
-
-class npc_altruis_the_sufferer : public CreatureScript
-{
-public:
- npc_altruis_the_sufferer() : CreatureScript("npc_altruis_the_sufferer") { }
-
- bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* /*quest*/)
- {
- if (!player->GetQuestRewardStatus(9991)) //Survey the Land, q-id 9991
- {
- player->CLOSE_GOSSIP_MENU();
- player->ActivateTaxiPathTo(532); //TaxiPath 532
- }
- return true;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (uiAction)
- {
- case GOSSIP_ACTION_INFO_DEF+10:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11);
- player->SEND_GOSSIP_MENU(9420, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+11:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12);
- player->SEND_GOSSIP_MENU(9421, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+12:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13);
- player->SEND_GOSSIP_MENU(9422, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+13:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14);
- player->SEND_GOSSIP_MENU(9423, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+14:
- player->SEND_GOSSIP_MENU(9424, creature->GetGUID());
- break;
-
- case GOSSIP_ACTION_INFO_DEF+20:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21);
- player->SEND_GOSSIP_MENU(9427, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+21:
- player->CLOSE_GOSSIP_MENU();
- player->AreaExploredOrEventHappens(9991);
- break;
-
- case GOSSIP_ACTION_INFO_DEF+30:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31);
- player->SEND_GOSSIP_MENU(384, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+31:
- player->CLOSE_GOSSIP_MENU();
- player->AreaExploredOrEventHappens(10646);
- break;
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- //gossip before obtaining Survey the Land
- if (player->GetQuestStatus(9991) == QUEST_STATUS_NONE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10);
-
- //gossip when Survey the Land is incomplete (technically, after the flight)
- if (player->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20);
-
- //wowwiki.com/Varedis
- if (player->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30);
-
- player->SEND_GOSSIP_MENU(9419, creature->GetGUID());
-
- return true;
- }
-
-};
-
-/*######
## npc_greatmother_geyah
######*/
@@ -453,83 +143,6 @@ public:
};
-/*######
-## npc_lantresor_of_the_blade
-######*/
-
-#define GOSSIP_HLB "I have killed many of your ogres, Lantresor. I have no fear."
-#define GOSSIP_SLB1 "Should I know? You look like an orc to me."
-#define GOSSIP_SLB2 "And the other half?"
-#define GOSSIP_SLB3 "I have heard of your kind, but I never thought to see the day when I would meet a half-breed."
-#define GOSSIP_SLB4 "My apologies. I did not mean to offend. I am here on behalf of my people."
-#define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces."
-#define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people."
-#define GOSSIP_SLB7 "What do I need to do?"
-
-class npc_lantresor_of_the_blade : public CreatureScript
-{
-public:
- npc_lantresor_of_the_blade() : CreatureScript("npc_lantresor_of_the_blade") { }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (uiAction)
- {
- case GOSSIP_ACTION_INFO_DEF:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->SEND_GOSSIP_MENU(9362, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->SEND_GOSSIP_MENU(9363, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
- player->SEND_GOSSIP_MENU(9364, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
- player->SEND_GOSSIP_MENU(9365, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
- player->SEND_GOSSIP_MENU(9366, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+5:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
- player->SEND_GOSSIP_MENU(9367, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+6:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
- player->SEND_GOSSIP_MENU(9368, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+7:
- player->SEND_GOSSIP_MENU(9369, creature->GetGUID());
- if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE)
- player->AreaExploredOrEventHappens(10107);
- if (player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE)
- player->AreaExploredOrEventHappens(10108);
- break;
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
-
- player->SEND_GOSSIP_MENU(9361, creature->GetGUID());
-
- return true;
- }
-
-};
-
/*#####
## npc_maghar_captive
#####*/
@@ -747,113 +360,9 @@ public:
};
/*######
-## mob_sparrowhawk
+## go_corkis_prison and npc_corki
######*/
-#define SPELL_SPARROWHAWK_NET 39810
-#define SPELL_ITEM_CAPTIVE_SPARROWHAWK 39812
-
-class mob_sparrowhawk : public CreatureScript
-{
-public:
- mob_sparrowhawk() : CreatureScript("mob_sparrowhawk") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_sparrowhawkAI (creature);
- }
-
- struct mob_sparrowhawkAI : public ScriptedAI
- {
-
- mob_sparrowhawkAI(Creature* c) : ScriptedAI(c) {}
-
- uint32 Check_Timer;
- uint64 PlayerGUID;
- bool fleeing;
-
- void Reset()
- {
- me->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET);
- Check_Timer = 1000;
- PlayerGUID = 0;
- fleeing = false;
- }
- void AttackStart(Unit* who)
- {
- if (PlayerGUID)
- return;
-
- ScriptedAI::AttackStart(who);
- }
-
- void EnterCombat(Unit* /*who*/) {}
-
- void MoveInLineOfSight(Unit* who)
- {
- if (!who || PlayerGUID)
- return;
-
- if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE)
- {
- PlayerGUID = who->GetGUID();
- return;
- }
-
- ScriptedAI::MoveInLineOfSight(who);
- }
-
- void UpdateAI(const uint32 diff)
- {
- if (Check_Timer <= diff)
- {
- if (PlayerGUID)
- {
- if (fleeing && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE)
- fleeing = false;
-
- Player* player = Unit::GetPlayer(*me, PlayerGUID);
- if (player && me->IsWithinDistInMap(player, 30))
- {
- if (!fleeing)
- {
- me->DeleteThreatList();
- me->GetMotionMaster()->MoveFleeing(player);
- fleeing = true;
- }
- }
- else if (fleeing)
- {
- me->GetMotionMaster()->MovementExpired(false);
- PlayerGUID = 0;
- fleeing = false;
- }
- }
- Check_Timer = 1000;
- } else Check_Timer -= diff;
-
- if (PlayerGUID)
- return;
-
- ScriptedAI::UpdateAI(diff);
- }
-
- void SpellHit(Unit* caster, const SpellInfo* spell)
- {
- if (caster->GetTypeId() == TYPEID_PLAYER)
- {
- if (spell->Id == SPELL_SPARROWHAWK_NET && CAST_PLR(caster)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE)
- {
- DoCast(caster, SPELL_ITEM_CAPTIVE_SPARROWHAWK, true);
- me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
- }
- }
- return;
- }
- };
-};
-
enum CorkiData
{
// first quest
@@ -916,10 +425,6 @@ public:
}
};
-/*######
-## npc_corki
-######*/
-
class npc_corki : public CreatureScript
{
public:
@@ -1165,49 +670,40 @@ enum FindingTheSurvivorsData
QUEST_FINDING_THE_SURVIVORS = 9948,
NPC_MAGHAR_PRISONER = 18428,
- SAY_FREE_0 = 0,
- SAY_FREE_1 = 1,
- SAY_FREE_2 = 2,
- SAY_FREE_3 = 3,
- SAY_FREE_4 = 4,
+ SAY_FREE = 0,
};
class go_warmaul_prison : public GameObjectScript
{
-public:
- go_warmaul_prison() : GameObjectScript("go_warmaul_prison") { }
+ public:
+ go_warmaul_prison() : GameObjectScript("go_warmaul_prison") { }
- bool OnGossipHello(Player* player, GameObject* go)
- {
- if (player->GetQuestStatus(QUEST_FINDING_THE_SURVIVORS) != QUEST_STATUS_INCOMPLETE)
- return false;
-
- if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 1.0f))
+ bool OnGossipHello(Player* player, GameObject* go)
{
- if (prisoner)
+ if (player->GetQuestStatus(QUEST_FINDING_THE_SURVIVORS) != QUEST_STATUS_INCOMPLETE)
+ return false;
+
+ if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f))
{
- go->UseDoorOrButton();
- if (player)
- player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
+ if (prisoner)
+ {
+ go->UseDoorOrButton();
+ if (player)
+ player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
- prisoner->AI()->Talk(RAND(SAY_FREE_0, SAY_FREE_1, SAY_FREE_2, SAY_FREE_3, SAY_FREE_4), player->GetGUID());
- prisoner->ForcedDespawn(6000);
+ prisoner->AI()->Talk(SAY_FREE, player->GetGUID());
+ prisoner->ForcedDespawn(6000);
+ }
}
+ return true;
}
- return true;
- }
};
void AddSC_nagrand()
{
- new mob_shattered_rumbler();
- new mob_lump();
- new npc_altruis_the_sufferer();
new npc_greatmother_geyah();
- new npc_lantresor_of_the_blade();
new npc_maghar_captive();
new npc_creditmarker_visit_with_ancestors();
- new mob_sparrowhawk();
new npc_corki();
new go_corkis_prison();
new npc_kurenai_captive();
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 31aea5ea576..610cf684a77 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -998,8 +998,7 @@ public:
case 50:
DoScriptText(SAY_WIL_END, me, player);
- if (Player* player = GetPlayerForEscort())
- player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me);
+ player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me);
break;
}
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index 8fa0a60a239..07b8a79691a 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -33,8 +33,6 @@ enum PriestSpells
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619,
PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201,
- PRIEST_SPELL_SHADOWFIEND = 34433,
- PRIEST_SPELL_SHADOWFIEND_TRIGGERED = 28305,
};
// Guardian Spirit
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index a9ed794ab45..517746dac55 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -24,14 +24,8 @@ SDCategory: Areatrigger
EndScriptData */
/* ContentData
-at_aldurthar_gate q13315/q13351
at_coilfang_waterfall 4591
at_legion_teleporter 4560 Teleporter TO Invasion Point: Cataclysm
-at_ravenholdt
-at_warsong_slaughterhouse
-at_warsong_grainery
-at_torp_farm
-at_warsong_farms q11686
at_stormwright_shelf q12741
at_last_rites q12019
at_sholazar_waygate q12548
@@ -40,46 +34,6 @@ EndContentData */
#include "ScriptPCH.h"
/*######
-## AreaTrigger_at_aldurthar_gate
-######*/
-
-enum eAldurtharGate
-{
- TRIGGER_SOUTH = 5284,
-
- TRIGGER_CENTRAL = 5285,
- TRIGGER_NORTH = 5286,
- TRIGGER_NORTHWEST = 5287,
-
- NPC_SOUTH_GATE = 32195,
- NPC_CENTRAL_GATE = 32196,
- NPC_NORTH_GATE = 32197,
- NPC_NORTHWEST_GATE = 32199
-};
-
-class AreaTrigger_at_aldurthar_gate : public AreaTriggerScript
-{
- public:
-
- AreaTrigger_at_aldurthar_gate()
- : AreaTriggerScript("at_aldurthar_gate")
- {
- }
-
- bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
- {
- switch (trigger->id)
- {
- case TRIGGER_SOUTH: player->KilledMonsterCredit(NPC_SOUTH_GATE, 0); break;
- case TRIGGER_CENTRAL: player->KilledMonsterCredit(NPC_CENTRAL_GATE, 0); break;
- case TRIGGER_NORTH: player->KilledMonsterCredit(NPC_NORTH_GATE, 0); break;
- case TRIGGER_NORTHWEST: player->KilledMonsterCredit(NPC_NORTHWEST_GATE, 0); break;
- }
- return true;
- }
-};
-
-/*######
## at_coilfang_waterfall
######*/
@@ -151,71 +105,6 @@ class AreaTrigger_at_legion_teleporter : public AreaTriggerScript
}
};
-enum eRavenholdt
-{
- QUEST_MANOR_RAVENHOLDT = 6681,
- NPC_RAVENHOLDT = 13936
-};
-
-class AreaTrigger_at_ravenholdt : public AreaTriggerScript
-{
- public:
-
- AreaTrigger_at_ravenholdt()
- : AreaTriggerScript("at_ravenholdt")
- {
- }
-
- bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
- {
- if (player->GetQuestStatus(QUEST_MANOR_RAVENHOLDT) == QUEST_STATUS_INCOMPLETE)
- player->KilledMonsterCredit(NPC_RAVENHOLDT, 0);
-
- return false;
- }
-};
-
-/*######
-## at_warsong_farms
-######*/
-
-enum eWarsongFarms
-{
- QUEST_THE_WARSONG_FARMS = 11686,
-
- NPC_CREDIT_SLAUGHTERHOUSE = 25672,
- NPC_CREDIT_GRAINERY = 25669,
- NPC_CREDIT_TORP_FARM = 25671,
-
- AT_SLAUGHTERHOUSE = 4873,
- AT_GRAINERY = 4871,
- AT_TORP_FARM = 4872
-};
-
-class AreaTrigger_at_warsong_farms : public AreaTriggerScript
-{
- public:
-
- AreaTrigger_at_warsong_farms()
- : AreaTriggerScript("at_warsong_farms")
- {
- }
-
- bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
- {
- if (!player->isDead() && player->GetQuestStatus(QUEST_THE_WARSONG_FARMS) == QUEST_STATUS_INCOMPLETE)
- {
- switch (trigger->id)
- {
- case AT_SLAUGHTERHOUSE: player->KilledMonsterCredit(NPC_CREDIT_SLAUGHTERHOUSE, 0); break;
- case AT_GRAINERY: player->KilledMonsterCredit(NPC_CREDIT_GRAINERY, 0); break;
- case AT_TORP_FARM: player->KilledMonsterCredit(NPC_CREDIT_TORP_FARM, 0); break;
- }
- }
- return true;
- }
-};
-
/*######
## at_stormwright_shelf
######*/
@@ -370,11 +259,8 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
void AddSC_areatrigger_scripts()
{
- new AreaTrigger_at_aldurthar_gate();
new AreaTrigger_at_coilfang_waterfall();
new AreaTrigger_at_legion_teleporter();
- new AreaTrigger_at_ravenholdt();
- new AreaTrigger_at_warsong_farms();
new AreaTrigger_at_stormwright_shelf();
new AreaTrigger_at_scent_larkorwi();
new AreaTrigger_at_last_rites();
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index cdeac03d76e..3bb969977b6 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -165,7 +165,7 @@ public:
bool OnGossipHello(Player* player, GameObject* /*pGO*/)
{
- if (player->HasSkill(SKILL_ENGINERING) && player->GetBaseSkillValue(SKILL_ENGINERING) >= 300 && !player->HasSpell(22704))
+ if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 300 && !player->HasSpell(22704))
{
player->CastSpell(player, 22864, false);
}
@@ -1009,7 +1009,7 @@ public:
if (qInfo)
{
//TODO: prisoner should help player for a short period of time
- player->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0], 0);
+ player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0);
pPrisoner->DisappearAndDie();
}
return true;
@@ -1176,14 +1176,79 @@ public:
class go_massive_seaforium_charge : public GameObjectScript
{
-public:
- go_massive_seaforium_charge() : GameObjectScript("go_massive_seaforium_charge") { }
+ public:
+ go_massive_seaforium_charge() : GameObjectScript("go_massive_seaforium_charge") { }
- bool OnGossipHello(Player* /*player*/, GameObject* go)
- {
- go->SetLootState(GO_JUST_DEACTIVATED);
- return true;
- }
+ bool OnGossipHello(Player* /*player*/, GameObject* go)
+ {
+ go->SetLootState(GO_JUST_DEACTIVATED);
+ return true;
+ }
+};
+
+/*######
+## go_gjalerbron_cage
+######*/
+
+enum OfKeysAndCages
+{
+ QUEST_ALLIANCE_OF_KEYS_AND_CAGES = 11231,
+ QUEST_HORDE_OF_KEYS_AND_CAGES = 11265,
+ NPC_GJALERBRON_PRISONER = 24035,
+ SAY_FREE = 0,
+};
+
+class go_gjalerbron_cage : public GameObjectScript
+{
+ public:
+ go_gjalerbron_cage() : GameObjectScript("go_gjalerbron_cage") { }
+
+ bool OnGossipHello(Player* player, GameObject* go)
+ {
+ if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_ALLIANCE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE) ||
+ (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_HORDE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE))
+ {
+ if (Creature* prisoner = go->FindNearestCreature(NPC_GJALERBRON_PRISONER, 5.0f))
+ {
+ go->UseDoorOrButton();
+
+ if (player)
+ player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, 0);
+
+ prisoner->AI()->Talk(SAY_FREE);
+ prisoner->ForcedDespawn(6000);
+ }
+ }
+ return true;
+ }
+};
+
+/*########
+## go_large_gjalerbron_cage
+#####*/
+
+class go_large_gjalerbron_cage : public GameObjectScript
+{
+ public:
+ go_large_gjalerbron_cage() : GameObjectScript("go_large_gjalerbron_cage") { }
+
+ bool OnGossipHello(Player* player, GameObject* go)
+ {
+ if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_ALLIANCE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE) ||
+ (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_HORDE_OF_KEYS_AND_CAGES) == QUEST_STATUS_INCOMPLETE))
+ {
+ std::list<Creature*> prisonerList;
+ GetCreatureListWithEntryInGrid(prisonerList, go, NPC_GJALERBRON_PRISONER, INTERACTION_DISTANCE);
+ for (std::list<Creature*>::const_iterator itr = prisonerList.begin(); itr != prisonerList.end(); ++itr)
+ {
+ go->UseDoorOrButton();
+ player->KilledMonsterCredit(NPC_GJALERBRON_PRISONER, (*itr)->GetGUID());
+ (*itr)->ForcedDespawn(6000);
+ (*itr)->AI()->Talk(SAY_FREE);
+ }
+ }
+ return false;
+ }
};
void AddSC_go_scripts()
@@ -1224,4 +1289,6 @@ void AddSC_go_scripts()
new go_amberpine_outhouse;
new go_hive_pod;
new go_massive_seaforium_charge;
+ new go_gjalerbron_cage;
+ new go_large_gjalerbron_cage;
}
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index 149e1e455aa..01f12086477 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -774,7 +774,7 @@ public:
{
bool res = false;
npcTextId = textId;
- if (player->GetBaseSkillValue(SKILL_ENGINERING) >= skillValue && player->HasSpell(reqSpellId))
+ if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId))
{
if (!player->HasSpell(spellId))
res = true;
@@ -790,7 +790,7 @@ public:
std::string gossipItem;
bool canLearn = false;
- if (player->HasSkill(SKILL_ENGINERING))
+ if (player->HasSkill(SKILL_ENGINEERING))
{
switch (creature->GetEntry())
{
diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h
index 01aff4bb10f..bc9c0c62ccc 100755
--- a/src/server/shared/Common.h
+++ b/src/server/shared/Common.h
@@ -203,4 +203,17 @@ typedef std::vector<std::string> StringVector;
#endif
#define MAX_QUERY_LEN 32*1024
+
+#define TRINITY_GUARD(MUTEX, LOCK) \
+ ACE_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \
+ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false);
+
+# define TRINITY_WRITE_GUARD(MUTEX, LOCK) \
+ ACE_Write_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \
+ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false);
+
+# define TRINITY_READ_GUARD(MUTEX, LOCK) \
+ ACE_Read_Guard< MUTEX > TRINITY_GUARD_OBJECT (LOCK); \
+ if (TRINITY_GUARD_OBJECT.locked() == 0) ASSERT(false);
+
#endif
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 816dc25f1b3..f93c4a70d7c 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -300,4 +300,20 @@ void CharacterDatabaseConnection::DoPrepareStatements()
// For loading and deleting expired auctions at startup
PREPARE_STATEMENT(CHAR_LOAD_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)
+ // Player saving
+ PREPARE_STATEMENT(CHAR_ADD_CHARACTER, "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
+ "map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, "
+ "taximask, cinematic, "
+ "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
+ "extra_flags, stable_slots, at_login, zone, "
+ "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
+ "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
+ "power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?,"
+ "map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
+ "logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,"
+ "arenaPoints=?,totalHonorPoints=?,todayHonorPoints=?,yesterdayHonorPoints=?,totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,knownCurrencies=?,"
+ "watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,power7=?,latency=?,speccount=?,activespec=?,exploredZones=?,"
+ "equipmentCache=?,ammoId=?,knownTitles=?,actionBars=?,grantableLevels=?,online=? WHERE guid=?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index dd752914138..f06a17aa924 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -275,6 +275,9 @@ enum CharacterDatabaseStatements
CHAR_LOAD_EXPIRED_AUCTIONS,
+ CHAR_ADD_CHARACTER,
+ CHAR_UPD_CHARACTER,
+
MAX_CHARACTERDATABASE_STATEMENTS,
};
diff --git a/src/server/shared/Dynamic/TypeContainer.h b/src/server/shared/Dynamic/TypeContainer.h
index 0fb3eb25347..7f6f5fa661c 100755
--- a/src/server/shared/Dynamic/TypeContainer.h
+++ b/src/server/shared/Dynamic/TypeContainer.h
@@ -108,11 +108,11 @@ class TypeMapContainer
}
/// Removes the object from the container, and returns the removed object
- template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
- {
- SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj);
- return (t != NULL);
- }
+ //template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
+ //{
+ // SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj);
+ // return (t != NULL);
+ //}
ContainerMapList<OBJECT_TYPES> & GetElements(void) { return i_elements; }
const ContainerMapList<OBJECT_TYPES> & GetElements(void) const { return i_elements;}
diff --git a/src/server/shared/Dynamic/TypeContainerFunctions.h b/src/server/shared/Dynamic/TypeContainerFunctions.h
index 981cd82197f..9bfbf47da93 100755
--- a/src/server/shared/Dynamic/TypeContainerFunctions.h
+++ b/src/server/shared/Dynamic/TypeContainerFunctions.h
@@ -62,7 +62,7 @@ namespace Trinity
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE *obj)
{
//elements._element[hdl] = obj;
- obj->GetGridRef().link(&elements._element, obj);
+ obj->AddToGrid(elements._element);
return obj;
};
@@ -84,31 +84,30 @@ namespace Trinity
return (t != NULL ? t : Insert(elements._TailElements, obj));
}
- // non-const remove method
- template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<SPECIFIC_TYPE> & /*elements*/, SPECIFIC_TYPE *obj)
- {
- obj->GetGridRef().unlink();
- return obj;
- }
-
- template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
- {
- return NULL;
- }
-
- // this is a missed
- template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
- {
- return NULL; // a missed
- }
-
- template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj)
- {
- // The head element is bad
- SPECIFIC_TYPE* t = Remove(elements._elements, obj);
- return ( t != NULL ? t : Remove(elements._TailElements, obj) );
- }
-
+ //// non-const remove method
+ //template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<SPECIFIC_TYPE> & /*elements*/, SPECIFIC_TYPE *obj)
+ //{
+ // obj->GetGridRef().unlink();
+ // return obj;
+ //}
+
+ //template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
+ //{
+ // return NULL;
+ //}
+
+ //// this is a missed
+ //template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
+ //{
+ // return NULL; // a missed
+ //}
+
+ //template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj)
+ //{
+ // // The head element is bad
+ // SPECIFIC_TYPE* t = Remove(elements._elements, obj);
+ // return ( t != NULL ? t : Remove(elements._TailElements, obj) );
+ //}
}
#endif
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 15008f13c10..697e7616c40 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -556,10 +556,10 @@ void Log::outSQLDriver(const char* str, ...)
{
outTimestamp(sqlLogFile);
- va_list ap;
- va_start(ap, str);
- vfprintf(sqlLogFile, str, ap);
- va_end(ap);
+ va_list apSQL;
+ va_start(apSQL, str);
+ vfprintf(sqlLogFile, str, apSQL);
+ va_end(apSQL);
fprintf(sqlLogFile, "\n");
fflush(sqlLogFile);
@@ -646,11 +646,11 @@ void Log::outBasic(const char * str, ...)
if (logfile)
{
outTimestamp(logfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(logfile, str, ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(logfile, str, ap2);
fprintf(logfile, "\n" );
- va_end(ap);
+ va_end(ap2);
fflush(logfile);
}
}
@@ -690,10 +690,10 @@ void Log::outDetail(const char * str, ...)
if (logfile)
{
outTimestamp(logfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- va_end(ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(logfile, str, ap2);
+ va_end(ap2);
fprintf(logfile, "\n");
fflush(logfile);
@@ -720,10 +720,10 @@ void Log::outDebugInLine(const char * str, ...)
if (logfile)
{
- va_list ap;
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- va_end(ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(logfile, str, ap2);
+ va_end(ap2);
}
}
}
@@ -742,10 +742,10 @@ void Log::outSQLDev(const char* str, ...)
if (sqlDevLogFile)
{
- va_list ap;
- va_start(ap, str);
- vfprintf(sqlDevLogFile, str, ap);
- va_end(ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(sqlDevLogFile, str, ap2);
+ va_end(ap2);
fprintf(sqlDevLogFile, "\n");
fflush(sqlDevLogFile);
@@ -790,10 +790,10 @@ void Log::outDebug(DebugLogFilters f, const char * str, ...)
if (logfile)
{
outTimestamp(logfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- va_end(ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(logfile, str, ap2);
+ va_end(ap2);
fprintf(logfile, "\n" );
fflush(logfile);
@@ -835,10 +835,10 @@ void Log::outStaticDebug(const char * str, ...)
if (logfile)
{
outTimestamp(logfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- va_end(ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(logfile, str, ap2);
+ va_end(ap2);
fprintf(logfile, "\n" );
fflush(logfile);
@@ -900,11 +900,11 @@ void Log::outCommand(uint32 account, const char * str, ...)
if (logfile)
{
outTimestamp(logfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(logfile, str, ap);
+ va_list ap2;
+ va_start(ap2, str);
+ vfprintf(logfile, str, ap2);
fprintf(logfile, "\n" );
- va_end(ap);
+ va_end(ap2);
fflush(logfile);
}
}
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 5260140fef0..42d72aa2c6f 100755
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -462,7 +462,6 @@ bool Master::_StartDB()
sWorld->LoadDBVersion();
sLog->outString("Using World DB: %s", sWorld->GetDBVersion());
- sLog->outString("Using creature EventAI: %s", sWorld->GetCreatureEventAIVersion());
return true;
}