From 64848ac380657676e208e02f4f5687da0b7330b2 Mon Sep 17 00:00:00 2001 From: balrok Date: Fri, 6 Nov 2009 13:30:37 +0100 Subject: [PATCH 01/23] [8780] fixed typos with arenarating original patch was ok - i just did copy/paste errors :s --- src/game/ArenaTeam.cpp | 12 ++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 4fe4fcb2c..df1fc7d9f 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -561,7 +561,7 @@ int32 ArenaTeam::LostAgainst(uint32 againstRating) float chance = GetChanceAgainst(m_stats.rating, againstRating); float K = (m_stats.rating < 1000) ? 48.0f : 32.0f; // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) - int32 mod = (int32)floor(K* (1.0f - chance)); + int32 mod = (int32)ceil(K * (0.0f - chance)); // modify the team stats accordingly FinishGame(mod); @@ -578,9 +578,9 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) { // update personal rating float chance = GetChanceAgainst(itr->personal_rating, againstRating); - float K = (m_stats.rating < 1000) ? 48.0f : 32.0f; + float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f; // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) - int32 mod = (int32)floor(K* (1.0f - chance)); + int32 mod = (int32)ceil(K * (0.0f - chance)); itr->ModifyPersonalRating(plr, mod, GetSlot()); // update personal played stats itr->games_week += 1; @@ -602,9 +602,9 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating) { // update personal rating float chance = GetChanceAgainst(itr->personal_rating, againstRating); - float K = (m_stats.rating < 1000) ? 48.0f : 32.0f; + float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f; // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) - int32 mod = (int32)floor(K* (1.0f - chance)); + int32 mod = (int32)ceil(K * (0.0f - chance)); if (int32(itr->personal_rating) + mod < 0) itr->personal_rating = 0; else @@ -626,7 +626,7 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) { // update personal rating float chance = GetChanceAgainst(itr->personal_rating, againstRating); - float K = (m_stats.rating < 1000) ? 48.0f : 32.0f; + float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f; // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) int32 mod = (int32)floor(K* (1.0f - chance)); itr->ModifyPersonalRating(plr, mod, GetSlot()); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index da5c412c2..e054693fc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8779" + #define REVISION_NR "8780" #endif // __REVISION_NR_H__ From 16dcc0673abd8abe6016e0c41df94d1a65805f48 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Fri, 6 Nov 2009 15:37:00 +0100 Subject: [PATCH 02/23] [8781] Remove old 100ms Linux hack in WorldRunnable. * This allows Linux OS to update world every 50ms like Windows (possible speed-up, but more CPU usage). * This hack was probably used because of old sockets lib, but we don't use this for worldd anymore. --- src/mangosd/WorldRunnable.cpp | 4 ---- src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mangosd/WorldRunnable.cpp b/src/mangosd/WorldRunnable.cpp index b90cd4a72..28c4bf85b 100644 --- a/src/mangosd/WorldRunnable.cpp +++ b/src/mangosd/WorldRunnable.cpp @@ -30,11 +30,7 @@ #include "Database/DatabaseEnv.h" -#ifdef WIN32 #define WORLD_SLEEP_CONST 50 -#else -#define WORLD_SLEEP_CONST 100 //Is this still needed?? [On linux some time ago not working 50ms] -#endif #ifdef WIN32 #include "ServiceWin32.h" diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e054693fc..f765e1f7a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8780" + #define REVISION_NR "8781" #endif // __REVISION_NR_H__ From 4d2f4726fd503306640225268641b9b8df6322a1 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Fri, 6 Nov 2009 18:17:53 +0100 Subject: [PATCH 03/23] Remove useless throw() and fix TBB warnings. --- src/framework/Policies/MemoryManagement.cpp | 4 +- win/VC100/tbb.vcxproj | 12 +- win/VC90/tbb.vcproj | 116 ++++++++++---------- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/framework/Policies/MemoryManagement.cpp b/src/framework/Policies/MemoryManagement.cpp index e9555e6ef..372ef0a7a 100644 --- a/src/framework/Policies/MemoryManagement.cpp +++ b/src/framework/Policies/MemoryManagement.cpp @@ -22,14 +22,14 @@ #include "../../dep/tbb/include/tbb/scalable_allocator.h" -void * operator new(size_t sz) throw (std::bad_alloc) +void * operator new(size_t sz) { void *res = scalable_malloc(sz); if (NULL == res) throw std::bad_alloc(); return res; } -void* operator new[](size_t sz) throw (std::bad_alloc) +void* operator new[](size_t sz) { void *res = scalable_malloc(sz); if (NULL == res) throw std::bad_alloc(); diff --git a/win/VC100/tbb.vcxproj b/win/VC100/tbb.vcxproj index 44a51aa7a..bba9e8fa1 100644 --- a/win/VC100/tbb.vcxproj +++ b/win/VC100/tbb.vcxproj @@ -124,7 +124,7 @@ - /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../include %(AdditionalOptions) + /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /I../../src /I../../include %(AdditionalOptions) Disabled ..\..\dep\tbb\include;..\..\dep\tbb\src;..\..\dep\tbb\build;..\..\dep\tbb\build\vsproject;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -151,7 +151,7 @@ X64 - /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../include %(AdditionalOptions) + /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /I../../src /I../../include %(AdditionalOptions) Disabled ..\..\dep\tbb\include;..\..\dep\tbb\src;..\..\dep\tbb\build;..\..\dep\tbb\build\vsproject;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -176,7 +176,7 @@ - /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../include %(AdditionalOptions) + /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /Oy /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /I../../src /I../../include %(AdditionalOptions) ..\..\dep\tbb\include;..\..\dep\tbb\src;..\..\dep\tbb\build;..\..\dep\tbb\build\vsproject;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MultiThreadedDLL @@ -202,7 +202,7 @@ X64 - /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../include %(AdditionalOptions) + /c /MD /O2 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /I../../src /I../../include %(AdditionalOptions) ..\..\dep\tbb\include;..\..\dep\tbb\src;..\..\dep\tbb\build;..\..\dep\tbb\build\vsproject;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) MultiThreadedDLL @@ -225,7 +225,7 @@ - /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../include %(AdditionalOptions) + /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /I../../src /I../../include %(AdditionalOptions) Disabled ..\..\dep\tbb\include;..\..\dep\tbb\src;..\..\dep\tbb\build;..\..\dep\tbb\build\vsproject;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -252,7 +252,7 @@ X64 - /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /Wp64 /I../../src /I../../include %(AdditionalOptions) + /c /MDd /Od /Ob0 /Zi /EHsc /GR /Zc:forScope /Zc:wchar_t /DTBB_USE_DEBUG /DDO_ITT_ANNOTATE /D_USE_RTM_VERSION /GS- /DDO_ITT_NOTIFY /DUSE_WINTHREAD /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0400 /D__TBB_BUILD=1 /W4 /I../../src /I../../include %(AdditionalOptions) Disabled ..\..\dep\tbb\include;..\..\dep\tbb\src;..\..\dep\tbb\build;..\..\dep\tbb\build\vsproject;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) diff --git a/win/VC90/tbb.vcproj b/win/VC90/tbb.vcproj index c63e3ab05..2fd53e2c4 100644 --- a/win/VC90/tbb.vcproj +++ b/win/VC90/tbb.vcproj @@ -49,7 +49,7 @@ /> @@ -131,7 +131,7 @@ /> @@ -296,12 +296,12 @@ /> @@ -376,7 +376,7 @@ /> @@ -458,7 +458,7 @@ /> + + + + + + + + + + + + + + + + + @@ -580,52 +626,6 @@ /> - - - - - - - - - - - - - - - - - From 150ac4c76efefc92c4a634ebdc3b1e1d64906d85 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 7 Nov 2009 18:43:25 +0300 Subject: [PATCH 04/23] [8782] Prevent packet problem spam in log at rejected CMSG_WORLD_TELEPORT. --- src/game/MiscHandler.cpp | 17 +++++++++-------- src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 4ecd7ee59..75b669654 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1181,14 +1181,6 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) // Received opcode CMSG_WORLD_TELEPORT // Time is ***, map=469, x=452.000000, y=6454.000000, z=2536.000000, orient=3.141593 - //sLog.outDebug("Received opcode CMSG_WORLD_TELEPORT"); - - if(GetPlayer()->isInFlight()) - { - sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore worldport command.",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow()); - return; - } - uint32 time; uint32 mapid; float PositionX; @@ -1202,6 +1194,15 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) recv_data >> PositionY; recv_data >> PositionZ; recv_data >> Orientation; // o (3.141593 = 180 degrees) + + //sLog.outDebug("Received opcode CMSG_WORLD_TELEPORT"); + + if(GetPlayer()->isInFlight()) + { + sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore worldport command.",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow()); + return; + } + DEBUG_LOG("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, mapid, PositionX, PositionY, PositionZ, Orientation); if (GetSecurity() >= SEC_ADMINISTRATOR) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f765e1f7a..b1b23a291 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8781" + #define REVISION_NR "8782" #endif // __REVISION_NR_H__ From a34d1509ad4da93decfb073a76df5003760186ba Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sat, 7 Nov 2009 22:04:24 +0100 Subject: [PATCH 05/23] [8783] * Fix mangos.sql after [8775]. --- sql/mangos.sql | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/mangos.sql b/sql/mangos.sql index 519f93e6f..f2e6a5a5b 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -1150,7 +1150,7 @@ CREATE TABLE `creature_template` ( LOCK TABLES `creature_template` WRITE; /*!40000 ALTER TABLE `creature_template` DISABLE KEYS */; INSERT INTO `creature_template` VALUES -(1,0,0,0,10045,0,10045,0,'Waypoint(Only GM can see it)','Visual',NULL,1,1,64,64,0,0,0,35,35,0,0.91,1,0,14,15,0,100,1,2000,2200,8,4096,0,0,0,0,0,0,1.76,2.42,100,8,5242886,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'',0,3,1.0,1.0,0,0,0,0,0,0,0,0,1,0,0,0x82,''); +(1,0,0,0,0,0,10045,0,10045,0,'Waypoint(Only GM can see it)','Visual',NULL,1,1,64,64,0,0,0,35,35,0,0.91,1,0,14,15,0,100,1,2000,2200,8,4096,0,0,0,0,0,0,1.76,2.42,100,8,5242886,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'',0,3,1.0,1.0,0,0,0,0,0,0,0,0,1,0,0,0x82,''); /*!40000 ALTER TABLE `creature_template` ENABLE KEYS */; UNLOCK TABLES; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b1b23a291..6670c8db3 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8782" + #define REVISION_NR "8783" #endif // __REVISION_NR_H__ From 34dab079c45ba13a90b48daef1d58378b7f51a44 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 8 Nov 2009 03:40:45 +0300 Subject: [PATCH 06/23] [8784] Use more appropriate error for cast fail on taxi flight. --- src/game/Spell.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 4be194511..279816940 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4103,7 +4103,7 @@ SpellCastResult Spell::CheckCast(bool strict) !IsPassiveSpell(m_spellInfo->Id) && !(m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_MOUNTED)) { if (m_caster->isInFlight()) - return SPELL_FAILED_NOT_FLYING; + return SPELL_FAILED_NOT_ON_TAXI; else return SPELL_FAILED_NOT_MOUNTED; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6670c8db3..1f179117b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8783" + #define REVISION_NR "8784" #endif // __REVISION_NR_H__ From 1f238847572fbba5c773d74ef9e9fa1a83531abc Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 03:33:06 +0100 Subject: [PATCH 07/23] Don't use singleton to access static functions. * This affects especially ObjectMgr functions: - GetCreatureInfo - GetGameObjectInfo - GetInstanceTemplate These are in fact static functions. --- src/game/AchievementMgr.cpp | 8 ++++---- src/game/ArenaTeamHandler.cpp | 2 +- src/game/AuctionHouseHandler.cpp | 2 +- src/game/AuctionHouseMgr.cpp | 4 ++-- src/game/Bag.cpp | 2 +- src/game/BattleGround.cpp | 2 +- src/game/Chat.cpp | 2 +- src/game/Creature.cpp | 10 +++++----- src/game/GameEventMgr.cpp | 4 ++-- src/game/GameObject.cpp | 2 +- src/game/GossipDef.cpp | 10 +++++----- src/game/Group.cpp | 4 ++-- src/game/Guild.cpp | 2 +- src/game/GuildHandler.cpp | 2 +- src/game/InstanceSaveMgr.cpp | 8 ++++---- src/game/Item.cpp | 6 +++--- src/game/ItemEnchantmentMgr.cpp | 2 +- src/game/ItemHandler.cpp | 6 +++--- src/game/Level2.cpp | 10 +++++----- src/game/Level3.cpp | 14 +++++++------- src/game/LootMgr.cpp | 12 ++++++------ src/game/Map.cpp | 10 +++++----- src/game/MapInstanced.cpp | 2 +- src/game/MapManager.cpp | 4 ++-- src/game/MiscHandler.cpp | 2 +- src/game/MovementHandler.cpp | 2 +- src/game/NPCHandler.cpp | 4 ++-- src/game/ObjectMgr.cpp | 4 ++-- src/game/ObjectMgr.h | 2 +- src/game/Pet.cpp | 2 +- src/game/PetitionsHandler.cpp | 2 +- src/game/Player.cpp | 30 +++++++++++++++--------------- src/game/PoolHandler.cpp | 2 +- src/game/QueryHandler.cpp | 4 ++-- src/game/Spell.cpp | 4 ++-- src/game/SpellAuras.cpp | 8 ++++---- src/game/SpellEffects.cpp | 4 ++-- src/game/Transports.cpp | 4 ++-- src/game/Unit.cpp | 2 +- src/game/debugcmds.cpp | 2 +- 40 files changed, 104 insertions(+), 104 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 220b55ae7..1cc08ada4 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -104,7 +104,7 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri case ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED: return true; case ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE: - if (!creature.id || !objmgr.GetCreatureTemplate(creature.id)) + if (!creature.id || !ObjectMgr::GetCreatureTemplate(creature.id)) { sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.", criteria->ID, criteria->requiredType,requirementType,creature.id); @@ -1170,7 +1170,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; if(miscvalue2 != achievementCriteria->roll_greed_on_loot.rollValue) continue; - ItemPrototype const *pProto = objmgr.GetItemPrototype( miscvalue1 ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( miscvalue1 ); uint32 requiredItemLevel = 0; if (achievementCriteria->ID == 2412 || achievementCriteria->ID == 2358) @@ -2087,7 +2087,7 @@ void AchievementGlobalMgr::LoadRewards() //check mail data before item for report including wrong item case if (reward.sender) { - if (!objmgr.GetCreatureTemplate(reward.sender)) + if (!ObjectMgr::GetCreatureTemplate(reward.sender)) { sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); reward.sender = 0; @@ -2107,7 +2107,7 @@ void AchievementGlobalMgr::LoadRewards() if (reward.itemId) { - if (!objmgr.GetItemPrototype(reward.itemId)) + if (!ObjectMgr::GetItemPrototype(reward.itemId)) { sLog.outErrorDb( "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will be without item.", entry, reward.itemId); reward.itemId = 0; diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index 0fdfdadfc..b30d5c937 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -88,7 +88,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data) if(!normalizePlayerName(Invitedname)) return; - player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str()); + player = ObjectAccessor::FindPlayerByName(Invitedname.c_str()); } if(!player) diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 260b2931c..a0089c394 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -230,7 +230,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); //we have to take deposit : - uint32 deposit = auctionmgr.GetAuctionDeposit( auctionHouseEntry, etime, it ); + uint32 deposit = AuctionHouseMgr::GetAuctionDeposit( auctionHouseEntry, etime, it ); if ( pl->GetMoney() < deposit ) { SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY); diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index bcf9a8f5e..1d84ad4cc 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -304,7 +304,7 @@ void AuctionHouseMgr::LoadAuctionItems() uint32 item_guid = fields[1].GetUInt32(); uint32 item_template = fields[2].GetUInt32(); - ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); + ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template); if(!proto) { @@ -397,7 +397,7 @@ void AuctionHouseMgr::LoadAuctions() continue; } - CreatureInfo const* auctioneerInfo = objmgr.GetCreatureTemplate(auctioneerData->id); + CreatureInfo const* auctioneerInfo = ObjectMgr::GetCreatureTemplate(auctioneerData->id); if(!auctioneerInfo) { aItem->DeleteFromDB(); diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index 0feca6d14..7bbfd5d1f 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -60,7 +60,7 @@ void Bag::RemoveFromWorld() bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) { - ItemPrototype const * itemProto = objmgr.GetItemPrototype(itemid); + ItemPrototype const * itemProto = ObjectMgr::GetItemPrototype(itemid); if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE) return false; diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index f6709b3d9..1480bc769 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -924,7 +924,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) if (!bmEntry) return; - ItemPrototype const* markProto = objmgr.GetItemPrototype(mark); + ItemPrototype const* markProto = ObjectMgr::GetItemPrototype(mark); if (!markProto) return; diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 2e738bd7f..781ef878e 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1164,7 +1164,7 @@ valid examples: // read item entry reader.getline(buffer, 256, ':'); - linkedItem= objmgr.GetItemPrototype(atoi(buffer)); + linkedItem = ObjectMgr::GetItemPrototype(atoi(buffer)); if(!linkedItem) { #ifdef MANGOS_DEBUG diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 7ef4f89ae..09fbf236e 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -181,7 +181,7 @@ void Creature::RemoveCorpse() */ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) { - CreatureInfo const *normalInfo = objmgr.GetCreatureTemplate(Entry); + CreatureInfo const *normalInfo = ObjectMgr::GetCreatureTemplate(Entry); if(!normalInfo) { sLog.outErrorDb("Creature::UpdateEntry creature entry %u does not exist.", Entry); @@ -199,7 +199,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) // we already have valid Map pointer for current creature! if (GetMap()->GetSpawnMode() > diff) { - cinfo = objmgr.GetCreatureTemplate(normalInfo->DifficultyEntry[diff]); + cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff]); if (!cinfo) { // maybe check such things already at startup @@ -1327,7 +1327,7 @@ float Creature::GetSpellDamageMod(int32 Rank) bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const CreatureData *data) { - CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry); + CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(Entry); if(!cinfo) { sLog.outErrorDb("Creature entry %u does not exist.", Entry); @@ -2235,7 +2235,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) { - ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); + ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(vItem->item); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) @@ -2274,7 +2274,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us if( vCount->lastIncrementTime + vItem->incrtime <= ptime ) { - ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); + ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(vItem->item); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); if((vCount->count + diff * pProto->BuyCount) < vItem->maxcount ) diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 140aa7880..4f6627629 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -621,7 +621,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { objmgr.RemoveGameobjectFromGrid(*itr, data); - if( GameObject* pGameobject = ObjectAccessor::Instance().GetGameObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT)) ) + if( GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT)) ) pGameobject->AddObjectToRemoveList(); } } @@ -688,7 +688,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) CreatureData const* data2 = objmgr.GetCreatureData(itr->first); if (data2 && activate) { - CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(data2->id); + CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(data2->id); uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index b5fe2cf0a..92bd2af22 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -113,7 +113,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa return false; } - GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(name_id); + GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(name_id); if (!goinfo) { sLog.outErrorDb("Gameobject (GUID: %u Entry: %u) not created: it have not exist entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f) ang: %f rotation0: %f rotation1: %f rotation2: %f rotation3: %f",guidlow, name_id, map->GetId(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3); diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 77e6ad05d..a046f0c12 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -470,7 +470,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID if ( !pQuest->RewChoiceItemId[i] ) continue; data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemCount[i]); - IProto = objmgr.GetItemPrototype(pQuest->RewChoiceItemId[i]); + IProto = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]); if ( IProto ) data << uint32(IProto->DisplayInfoID); else @@ -483,7 +483,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID if ( !pQuest->RewItemId[i] ) continue; data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemCount[i]); - IProto = objmgr.GetItemPrototype(pQuest->RewItemId[i]); + IProto = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]); if ( IProto ) data << uint32(IProto->DisplayInfoID); else @@ -687,7 +687,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(pQuest->GetRewChoiceItemsCount()); for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i) { - pItem = objmgr.GetItemPrototype( pQuest->RewChoiceItemId[i] ); + pItem = ObjectMgr::GetItemPrototype( pQuest->RewChoiceItemId[i] ); data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemCount[i]); @@ -701,7 +701,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(pQuest->GetRewItemsCount()); for (uint16 i=0; i < pQuest->GetRewItemsCount(); ++i) { - pItem = objmgr.GetItemPrototype(pQuest->RewItemId[i]); + pItem = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemCount[i]); @@ -781,7 +781,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID { if ( !pQuest->ReqItemId[i] ) continue; - pItem = objmgr.GetItemPrototype(pQuest->ReqItemId[i]); + pItem = ObjectMgr::GetItemPrototype(pQuest->ReqItemId[i]); data << uint32(pQuest->ReqItemId[i]); data << uint32(pQuest->ReqItemCount[i]); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index bf4d5d360..5750ac1c8 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -576,7 +576,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature) for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) { - item = objmgr.GetItemPrototype(i->itemid); + item = ObjectMgr::GetItemPrototype(i->itemid); if (!item) { //sLog.outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); @@ -630,7 +630,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea uint8 itemSlot = 0; for(std::vector::iterator i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) { - item = objmgr.GetItemPrototype(i->itemid); + item = ObjectMgr::GetItemPrototype(i->itemid); //only roll for one-player items, not for ones everyone can get if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index a2e527360..b7216fc29 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -1211,7 +1211,7 @@ void Guild::LoadGuildBankFromDB() continue; } - ItemPrototype const *proto = objmgr.GetItemPrototype(ItemEntry); + ItemPrototype const *proto = ObjectMgr::GetItemPrototype(ItemEntry); if (!proto) { diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 723400ab9..4765a1e47 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -73,7 +73,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) recvPacket >> Invitedname; if(normalizePlayerName(Invitedname)) - player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str()); + player = ObjectAccessor::FindPlayerByName(Invitedname.c_str()); if(!player) { diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 2db0c49d4..bf2f9c233 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -196,7 +196,7 @@ time_t InstanceSave::GetResetTimeForDB() // to cache or not to cache, that is the question InstanceTemplate const* InstanceSave::GetTemplate() { - return objmgr.GetInstanceTemplate(m_mapid); + return ObjectMgr::GetInstanceTemplate(m_mapid); } MapEntry const* InstanceSave::GetMapEntry() @@ -431,7 +431,7 @@ void InstanceSaveManager::LoadResetTimes() { Field *fields = result->Fetch(); uint32 mapid = fields[0].GetUInt32(); - if(!objmgr.GetInstanceTemplate(mapid)) + if(!ObjectMgr::GetInstanceTemplate(mapid)) { sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid %u in instance_reset!", mapid); CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u'", mapid); @@ -457,7 +457,7 @@ void InstanceSaveManager::LoadResetTimes() // add the global reset times to the priority queue for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++) { - InstanceTemplate const* temp = objmgr.GetInstanceTemplate(i); + InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(i); if(!temp || temp->reset_delay == 0) continue; @@ -592,7 +592,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe if(!warn) { // this is called one minute before the reset time - InstanceTemplate const* temp = objmgr.GetInstanceTemplate(mapid); + InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(mapid); if(!temp || !temp->reset_delay) { sLog.outError("InstanceSaveManager::ResetOrWarnAll: no instance template or reset delay for map %d", mapid); diff --git a/src/game/Item.cpp b/src/game/Item.cpp index ba6381cb7..e5eaabea1 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -255,7 +255,7 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner) SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); - ItemPrototype const *itemProto = objmgr.GetItemPrototype(itemid); + ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(itemid); if(!itemProto) return false; @@ -441,7 +441,7 @@ void Item::DeleteFromInventoryDB() ItemPrototype const *Item::GetProto() const { - return objmgr.GetItemPrototype(GetEntry()); + return ObjectMgr::GetItemPrototype(GetEntry()); } Player* Item::GetOwner()const @@ -936,7 +936,7 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) if ( count < 1 ) return NULL; //don't create item at zero count - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item ); if( pProto ) { if ( count > pProto->GetMaxStackSize()) diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp index aa81d9189..66b98c0bf 100644 --- a/src/game/ItemEnchantmentMgr.cpp +++ b/src/game/ItemEnchantmentMgr.cpp @@ -124,7 +124,7 @@ uint32 GetItemEnchantMod(uint32 entry) uint32 GenerateEnchSuffixFactor(uint32 item_id) { - ItemPrototype const *itemProto = objmgr.GetItemPrototype(item_id); + ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(item_id); if(!itemProto) return 0; diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 3c1845fd4..ba80d0880 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -285,7 +285,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) sLog.outDetail("STORAGE: Item Query = %u", item); - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item ); if( pProto ) { std::string Name = pProto->Name1; @@ -739,7 +739,7 @@ void WorldSession::SendListInventory( uint64 vendorguid ) { if(VendorItem const* crItem = vItems->GetItem(i)) { - if(ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item)) + if(ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(crItem->item)) { if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster()) continue; @@ -971,7 +971,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) recv_data.read_skip(); // guid sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); - ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( itemid ); if( pProto ) { std::string Name; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index cdd9508f7..9749bfc8d 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -483,7 +483,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) return false; } - GameObjectInfo const* goI = objmgr.GetGameObjectInfo(id); + GameObjectInfo const* goI = ObjectMgr::GetGameObjectInfo(id); if (!goI) { @@ -700,7 +700,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args) char* spawntimeSecs = strtok(NULL, " "); - const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(id); + const GameObjectInfo *gInfo = ObjectMgr::GetGameObjectInfo(id); if (!gInfo) { @@ -825,7 +825,7 @@ bool ChatHandler::HandleGameObjectNearCommand(const char* args) float z = fields[4].GetFloat(); int mapid = fields[5].GetUInt16(); - GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry); + GameObjectInfo const * gInfo = ObjectMgr::GetGameObjectInfo(entry); if(!gInfo) continue; @@ -1142,7 +1142,7 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(const char* args) objmgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost); - ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); + ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId); PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost); return true; @@ -1178,7 +1178,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(const char* args) return false; } - ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); + ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId); PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,pProto->Name1); return true; diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index c4d65f6bb..9c3761ae9 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -2098,7 +2098,7 @@ bool ChatHandler::HandleAddItemCommand(const char* args) sLog.outDetail(GetMangosString(LANG_ADDITEM), itemId, count); - ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemId); if(!pProto) { PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); @@ -2237,7 +2237,7 @@ bool ChatHandler::HandleListItemCommand(const char* args) return false; } - ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id); + ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id); if(!itemProto) { PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); @@ -2462,7 +2462,7 @@ bool ChatHandler::HandleListObjectCommand(const char* args) return false; } - GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(go_id); + GameObjectInfo const * gInfo = ObjectMgr::GetGameObjectInfo(go_id); if(!gInfo) { PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); @@ -2538,7 +2538,7 @@ bool ChatHandler::HandleListCreatureCommand(const char* args) return false; } - CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(cr_id); + CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(cr_id); if(!cInfo) { PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); @@ -3836,7 +3836,7 @@ bool ChatHandler::HandleNpcAddWeaponCommand(const char* /*args*/) uint32 ItemID = atoi(pItemID); uint32 SlotID = atoi(pSlotID); - ItemPrototype* tmpItem = objmgr.GetItemPrototype(ItemID); + ItemPrototype* tmpItem = ObjectMgr::GetItemPrototype(ItemID); bool added = false; if(tmpItem) @@ -4834,7 +4834,7 @@ bool ChatHandler::HandleQuestComplete(const char* args) } else if(creature > 0) { - if(CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creature)) + if(CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(creature)) for(uint16 z = 0; z < creaturecount; ++z) player->KilledMonster(cInfo,0); } @@ -6192,7 +6192,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args) if(!item_id) return false; - ItemPrototype const* item_proto = objmgr.GetItemPrototype(item_id); + ItemPrototype const* item_proto = ObjectMgr::GetItemPrototype(item_id); if(!item_proto) { PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 504b55112..2efe2d619 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -245,7 +245,7 @@ bool LootStoreItem::Roll(bool rate) const if(mincountOrRef < 0) // reference case return roll_chance_f(chance* (rate ? sWorld.getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f)); - ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid); float qualityModifier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f; @@ -269,7 +269,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const if( mincountOrRef > 0 ) // item (quest or non-quest) entry, maybe grouped { - ItemPrototype const *proto = objmgr.GetItemPrototype(itemid); + ItemPrototype const *proto = ObjectMgr::GetItemPrototype(itemid); if(!proto) { sLog.outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); @@ -319,7 +319,7 @@ LootItem::LootItem(LootStoreItem const& li) itemid = li.itemid; conditionId = li.conditionId; - ItemPrototype const* proto = objmgr.GetItemPrototype(itemid); + ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemid); freeforall = proto && (proto->Flags & ITEM_FLAGS_PARTY_LOOT); needs_quest = li.needs_quest; @@ -349,7 +349,7 @@ bool LootItem::AllowedForPlayer(Player const * player) const else { // Not quest only drop (check quest starting items for already accepted non-repeatable quests) - ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid); if (pProto && pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid)) return false; } @@ -378,7 +378,7 @@ void Loot::AddItem(LootStoreItem const & item) // non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot() if( !item.conditionId ) { - ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid); + ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item.itemid); if( !proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT)==0 ) ++unlootedCount; } @@ -676,7 +676,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li) { b << uint32(li.itemid); b << uint32(li.count); // nr of items of this type - b << uint32(objmgr.GetItemPrototype(li.itemid)->DisplayInfoID); + b << uint32(ObjectMgr::GetItemPrototype(li.itemid)->DisplayInfoID); b << uint32(li.randomSuffix); b << uint32(li.randomPropertyId); //b << uint8(0); // slot type - will send after this function call diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d6b21f7c0..0114f1ae2 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -223,7 +223,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par void Map::InitVisibilityDistance() { //init visibility for continents - m_VisibleDistance = sWorld.GetMaxVisibleDistanceOnContinents(); + m_VisibleDistance = World::GetMaxVisibleDistanceOnContinents(); } // Template specialization of utility methods @@ -2306,7 +2306,7 @@ InstanceMap::~InstanceMap() void InstanceMap::InitVisibilityDistance() { //init visibility distance for instances - m_VisibleDistance = sWorld.GetMaxVisibleDistanceInInstances(); + m_VisibleDistance = World::GetMaxVisibleDistanceInInstances(); } /* @@ -2473,7 +2473,7 @@ void InstanceMap::CreateInstanceData(bool load) if(i_data != NULL) return; - InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(GetId()); + InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(GetId()); if (mInstance) { i_script_id = mInstance->script_id; @@ -2620,7 +2620,7 @@ void InstanceMap::SetResetSchedule(bool on) uint32 InstanceMap::GetMaxPlayers() const { - InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId()); + InstanceTemplate const* iTemplate = ObjectMgr::GetInstanceTemplate(GetId()); if(!iTemplate) return 0; return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers; @@ -2642,7 +2642,7 @@ BattleGroundMap::~BattleGroundMap() void BattleGroundMap::InitVisibilityDistance() { //init visibility distance for BG/Arenas - m_VisibleDistance = sWorld.GetMaxVisibleDistanceInBGArenas(); + m_VisibleDistance = World::GetMaxVisibleDistanceInBGArenas(); } bool BattleGroundMap::CanEnter(Player * player) diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index d59a0b3cc..2db10d3be 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -187,7 +187,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, sLog.outError("CreateInstance: no entry for map %d", GetId()); assert(false); } - if (!objmgr.GetInstanceTemplate(GetId())) + if (!ObjectMgr::GetInstanceTemplate(GetId())) { sLog.outError("CreateInstance: no instance template for map %d", GetId()); assert(false); diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 00924cad9..8059c59d4 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -205,7 +205,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) if(instance_map==mapid) break; - InstanceTemplate const* instance = objmgr.GetInstanceTemplate(instance_map); + InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(instance_map); instance_map = instance ? instance->parent : 0; } while (instance_map); @@ -292,7 +292,7 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x,float y) bool MapManager::IsValidMAP(uint32 mapid) { MapEntry const* mEntry = sMapStore.LookupEntry(mapid); - return mEntry && (!mEntry->IsDungeon() || objmgr.GetInstanceTemplate(mapid)); + return mEntry && (!mEntry->IsDungeon() || ObjectMgr::GetInstanceTemplate(mapid)); // TODO: add check for battleground template } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 75b669654..6a63c6f4d 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -845,7 +845,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) { // TODO: all this is probably wrong if(missingItem) - SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); + SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, ObjectMgr::GetItemPrototype(missingItem)->Name1); else if(missingKey) GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC); else if(missingQuest) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 664c11d66..cca3c718c 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -56,7 +56,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() // get the destination map entry, not the current one, this will fix homebind and reset greeting MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid); - InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.mapid); + InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(loc.mapid); // reset instance validity, except if going to an instance inside an instance if(GetPlayer()->m_InstanceValid == false && !mInstance) diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 33ba8538d..0d5aadf7f 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -633,7 +633,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) return; } - CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id); + CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id); if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { WorldPacket data(SMSG_STABLE_RESULT, 1); @@ -760,7 +760,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) return; } - CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id); + CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id); if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { WorldPacket data(SMSG_STABLE_RESULT, 1); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index cc1e07962..551e4b325 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7279,7 +7279,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val } case CONDITION_ITEM: { - ItemPrototype const *proto = objmgr.GetItemPrototype(value1); + ItemPrototype const *proto = ObjectMgr::GetItemPrototype(value1); if(!proto) { sLog.outErrorDb("Item condition requires to have non existing item (%u), skipped", value1); @@ -7289,7 +7289,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val } case CONDITION_ITEM_EQUIPPED: { - ItemPrototype const *proto = objmgr.GetItemPrototype(value1); + ItemPrototype const *proto = ObjectMgr::GetItemPrototype(value1); if(!proto) { sLog.outErrorDb("ItemEquipped condition requires to have non existing item (%u) equipped, skipped", value1); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index b888e39b8..1b34021c6 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -339,7 +339,7 @@ class ObjectMgr typedef std::vector ScriptNameMap; - Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} + Player* GetPlayer(const char* name) const { return ObjectAccessor::FindPlayerByName(name);} Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); } static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry(id); } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index c8fa9cb0b..7c7a461da 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -138,7 +138,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool PetType pet_type = PetType(fields[18].GetUInt8()); if(pet_type==HUNTER_PET) { - CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(petentry); + CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(petentry); if(!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets())) { delete result; diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 4deaf34d6..2859af20a 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -170,7 +170,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } } - ItemPrototype const *pProto = objmgr.GetItemPrototype(charterid); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(charterid); if(!pProto) { _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index bdf6b53ce..6590cd1c2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -678,7 +678,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 if(item_id==40582) continue; - ItemPrototype const* iProto = objmgr.GetItemPrototype(item_id); + ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(item_id); if(!iProto) { sLog.outErrorDb("Initial item id %u (race %u class %u) from CharStartOutfit.dbc not listed in `item_template`, ignoring.",item_id,getRace(),getClass()); @@ -1498,7 +1498,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) { uint32 visualbase = PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2); uint32 item_id = GetUInt32ValueFromArray(data, visualbase); - const ItemPrototype * proto = objmgr.GetItemPrototype(item_id); + const ItemPrototype * proto = ObjectMgr::GetItemPrototype(item_id); if(!proto) { *p_data << uint32(0); @@ -3963,7 +3963,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC uint32 item_guidlow = fields2[1].GetUInt32(); uint32 item_template = fields2[2].GetUInt32(); - ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_template); + ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template); if(!itemProto) { CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guidlow); @@ -5575,7 +5575,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) } break; case ACTION_BUTTON_ITEM: - if(!objmgr.GetItemPrototype(action)) + if(!ObjectMgr::GetItemPrototype(action)) { sLog.outError( "Action %u not added into button %u for player %s: item not exist", action, button, GetName() ); return NULL; @@ -7278,7 +7278,7 @@ void Player::_ApplyAmmoBonuses() float currentAmmoDPS; - ItemPrototype const *ammo_proto = objmgr.GetItemPrototype( ammo_id ); + ItemPrototype const *ammo_proto = ObjectMgr::GetItemPrototype( ammo_id ); if( !ammo_proto || ammo_proto->Class!=ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto)) currentAmmoDPS = 0.0f; else @@ -8751,7 +8751,7 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except } } - ItemPrototype const *pProto = objmgr.GetItemPrototype(item); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item); if (pProto && pProto->GemProperties) { for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) @@ -8808,7 +8808,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count ) const { - ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(entry); if( !pProto ) { if(no_space_count) @@ -9072,7 +9072,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 { sLog.outDebug( "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); - ItemPrototype const *pProto = objmgr.GetItemPrototype(entry); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(entry); if (!pProto) { if (no_space_count) @@ -10218,7 +10218,7 @@ uint8 Player::CanUseAmmo( uint32 item ) const return EQUIP_ERR_YOU_ARE_DEAD; //if( isStunned() ) // return EQUIP_ERR_YOU_ARE_STUNNED; - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item ); if( pProto ) { if( pProto->InventoryType!= INVTYPE_AMMO ) @@ -13728,7 +13728,7 @@ bool Player::HasQuestForItem( uint32 itemid ) const // examined item is a source item if (qinfo->ReqSourceId[j] == itemid) { - ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid); // 'unique' item if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount) @@ -14227,7 +14227,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID())) { - BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); AddBattleGroundQueueId(bgQueueTypeId); m_bgData.bgTypeID = currentBg->GetTypeID(); @@ -14849,7 +14849,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff) uint32 item_guid = fields[3].GetUInt32(); uint32 item_id = fields[4].GetUInt32(); - ItemPrototype const * proto = objmgr.GetItemPrototype(item_id); + ItemPrototype const * proto = ObjectMgr::GetItemPrototype(item_id); if(!proto) { @@ -14992,7 +14992,7 @@ void Player::_LoadMailedItems(Mail *mail) mail->AddItem(item_guid_low, item_template); - ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); + ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template); if(!proto) { @@ -17283,7 +17283,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint if (!isAlive()) return false; - ItemPrototype const *pProto = objmgr.GetItemPrototype( item ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( item ); if (!pProto) { SendBuyError( BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); @@ -19916,7 +19916,7 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c if(!enchantEntry) continue; - ItemPrototype const* pGem = objmgr.GetItemPrototype(enchantEntry->GemID); + ItemPrototype const* pGem = ObjectMgr::GetItemPrototype(enchantEntry->GemID); if(!pGem) continue; diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index 44c6cabeb..64b42fa0d 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -495,7 +495,7 @@ void PoolHandler::LoadFromDB() sLog.outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id ); continue; } - GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(data->id); + GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(data->id); if (goinfo->type != GAMEOBJECT_TYPE_CHEST && goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index e7ae81462..bd48b94b2 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -153,7 +153,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); + CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry); if (ci) { @@ -219,7 +219,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - const GameObjectInfo *info = objmgr.GetGameObjectInfo(entryID); + const GameObjectInfo *info = ObjectMgr::GetGameObjectInfo(entryID); if(info) { std::string Name; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 279816940..91243bc18 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3192,7 +3192,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data ) uint32 ammoID = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID); if(ammoID) { - ItemPrototype const *pProto = objmgr.GetItemPrototype( ammoID ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( ammoID ); if(pProto) { ammoDisplayID = pProto->DisplayInfoID; @@ -5539,7 +5539,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - ItemPrototype const *ammoProto = objmgr.GetItemPrototype( ammo ); + ItemPrototype const *ammoProto = ObjectMgr::GetItemPrototype( ammo ); if(!ammoProto) return SPELL_FAILED_NO_AMMO; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 8af72353e..2fb4800a8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2723,7 +2723,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real) if(apply) { - CreatureInfo const* ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); + CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); if(!ci) { sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier.m_miscvalue); @@ -3131,7 +3131,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) { uint32 model_id; - CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); + CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); if (!ci) { model_id = 16358; // pig pink ^_^ @@ -3200,7 +3200,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) { uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue; - if (CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id)) + if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id)) { uint32 team = 0; if (m_target->GetTypeId() == TYPEID_PLAYER) @@ -5905,7 +5905,7 @@ void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/) if(m_target->GetTypeId() != TYPEID_UNIT) return; - CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_target->GetEntry()); + CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(m_target->GetEntry()); if(ci && ci->type == CREATURE_TYPE_BEAST) m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c25d3946e..24ec8903a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2713,7 +2713,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) Player* player = (Player*)unitTarget; uint32 newitemid = itemtype; - ItemPrototype const *pProto = objmgr.GetItemPrototype( newitemid ); + ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( newitemid ); if(!pProto) { player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); @@ -6516,7 +6516,7 @@ void Spell::EffectTransmitted(uint32 effIndex) { uint32 name_id = m_spellInfo->EffectMiscValue[effIndex]; - GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(name_id); + GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(name_id); if (!goinfo) { diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 43e854fd0..20170172e 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -57,7 +57,7 @@ void MapManager::LoadTransports() std::string name = fields[1].GetCppString(); t->m_period = fields[2].GetUInt32(); - const GameObjectInfo *goinfo = objmgr.GetGameObjectInfo(entry); + const GameObjectInfo *goinfo = ObjectMgr::GetGameObjectInfo(entry); if(!goinfo) { @@ -150,7 +150,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); - GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow); + GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow); if (!goinfo) { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b475706f1..31cbad0af 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -464,7 +464,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // some critters required for quests (need normal entry instead possible heroic in any cases) if(GetTypeId() == TYPEID_PLAYER) - if(CreatureInfo const* normalInfo = objmgr.GetCreatureTemplate(pVictim->GetEntry())) + if(CreatureInfo const* normalInfo = ObjectMgr::GetCreatureTemplate(pVictim->GetEntry())) ((Player*)this)->KilledMonster(normalInfo,pVictim->GetGUID()); return damage; diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index 75aa9c37f..d5a359a29 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -614,7 +614,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args) uint32 entry = (uint32)atoi(e); uint32 id = (uint32)atoi(i); - CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); + CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry); if (!ci) return false; From 6abf7e7f58d84a36dbca4509a6ad23694f01c045 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 03:36:43 +0100 Subject: [PATCH 08/23] Make RealmList proper singleton in realmd. --- src/realmd/AuthSocket.cpp | 8 +++----- src/realmd/Main.cpp | 5 ++--- src/realmd/RealmList.cpp | 6 ++++++ src/realmd/RealmList.h | 3 +++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index bac584888..64e615254 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -32,8 +32,6 @@ #include "Auth/Sha1.h" //#include "Util.h" -- for commented utf8ToUpperOnlyLatin -extern RealmList m_realmList; - extern DatabaseType loginDatabase; #define ChunkSize 2048 @@ -881,14 +879,14 @@ bool AuthSocket::_HandleRealmList() delete result; ///- Update realm list if need - m_realmList.UpdateIfNeed(); + RealmList::Instance().UpdateIfNeed(); ///- Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) ByteBuffer pkt; pkt << (uint32) 0; - pkt << (uint16) m_realmList.size(); + pkt << (uint16) RealmList::Instance().size(); RealmList::RealmMap::const_iterator i; - for( i = m_realmList.begin(); i != m_realmList.end(); ++i ) + for( i = RealmList::Instance().begin(); i != RealmList::Instance().end(); ++i ) { uint8 AmountOfCharacters; diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 13fdc5747..2cfe62abd 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -55,7 +55,6 @@ void UnhookSignals(); void HookSignals(); bool stopEvent = false; ///< Setting it to true stops the server -RealmList m_realmList; ///< Holds the list of realms for this server DatabaseType loginDatabase; ///< Accessor to the realm server database @@ -191,8 +190,8 @@ extern int main(int argc, char **argv) return 1; ///- Get the list of realms for the server - m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); - if (m_realmList.size() == 0) + RealmList::Instance().Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); + if (RealmList::Instance().size() == 0) { sLog.outError("No valid realms specified."); return 1; diff --git a/src/realmd/RealmList.cpp b/src/realmd/RealmList.cpp index 1bb0a977d..f41344c00 100644 --- a/src/realmd/RealmList.cpp +++ b/src/realmd/RealmList.cpp @@ -33,6 +33,12 @@ RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) { } +RealmList& RealmList::Instance() +{ + static RealmList realmlist; + return realmlist; +} + /// Load the realm list from the database void RealmList::Initialize(uint32 updateInterval) { diff --git a/src/realmd/RealmList.h b/src/realmd/RealmList.h index 40e3956e8..1ab6d9371 100644 --- a/src/realmd/RealmList.h +++ b/src/realmd/RealmList.h @@ -43,6 +43,8 @@ class RealmList public: typedef std::map RealmMap; + static RealmList& Instance(); + RealmList(); ~RealmList() {} @@ -61,5 +63,6 @@ class RealmList uint32 m_UpdateInterval; time_t m_NextUpdateTime; }; + #endif /// @} From dc725ad6b858507ae442a4a9e08e8aa6c0a8512e Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 03:45:26 +0100 Subject: [PATCH 09/23] [8785] Use macro instead of explicit call to singleton Instance(). * For: ObjectAccessor, MapManager. --- src/game/AchievementMgr.cpp | 2 +- src/game/BattleGroundMgr.cpp | 2 +- src/game/CharacterHandler.cpp | 2 +- src/game/Corpse.cpp | 4 ++-- src/game/GMTicketHandler.cpp | 2 +- src/game/GameEventMgr.cpp | 4 ++-- src/game/GlobalEvents.cpp | 4 ++-- src/game/Group.cpp | 2 +- src/game/InstanceSaveMgr.cpp | 6 +++--- src/game/LFGHandler.cpp | 6 +++--- src/game/Level1.cpp | 10 ++++----- src/game/Level3.cpp | 10 ++++----- src/game/Map.cpp | 8 ++++---- src/game/MapInstanced.cpp | 2 +- src/game/MapManager.h | 3 +++ src/game/MiscHandler.cpp | 2 +- src/game/MovementHandler.cpp | 4 ++-- src/game/Object.cpp | 4 ++-- src/game/ObjectAccessor.cpp | 2 +- src/game/ObjectAccessor.h | 2 ++ src/game/ObjectGridLoader.cpp | 2 +- src/game/ObjectMgr.cpp | 4 ++-- src/game/Player.cpp | 38 +++++++++++++++++------------------ src/game/PoolHandler.cpp | 4 ++-- src/game/QueryHandler.cpp | 2 +- src/game/Transports.cpp | 4 ++-- src/game/World.cpp | 12 +++++------ src/shared/revision_nr.h | 2 +- 28 files changed, 77 insertions(+), 72 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 1cc08ada4..bd204cded 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -886,7 +886,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!miscvalue1) continue; - Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); + Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : mapmgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); if(!map || !map->IsDungeon()) continue; diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 0e9784e5f..d57cc39ea 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1597,7 +1597,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI } // generate a new instance id - bg->SetInstanceID(MapManager::Instance().GenerateInstanceId()); // set instance id + bg->SetInstanceID(mapmgr.GenerateInstanceId()); // set instance id bg->SetClientInstanceID(CreateClientVisibleInstanceId(bgTypeId, queue_id)); // reset the new bg (set status to status_wait_queue from status_none) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index aa550947b..2a9574cf2 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -699,7 +699,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation()); } - ObjectAccessor::Instance().AddObject(pCurrChar); + objaccessor.AddObject(pCurrChar); //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName()); pCurrChar->SendInitialPacketsAfterAddToMap(); diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 166bc34ce..a5b6a73b6 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -50,7 +50,7 @@ void Corpse::AddToWorld() { ///- Register the corpse for guid lookup if(!IsInWorld()) - ObjectAccessor::Instance().AddObject(this); + objaccessor.AddObject(this); Object::AddToWorld(); } @@ -59,7 +59,7 @@ void Corpse::RemoveFromWorld() { ///- Remove the corpse from the accessor if(IsInWorld()) - ObjectAccessor::Instance().RemoveObject(this); + objaccessor.RemoveObject(this); Object::RemoveFromWorld(); } diff --git a/src/game/GMTicketHandler.cpp b/src/game/GMTicketHandler.cpp index 4e062ac9f..6c02aa842 100644 --- a/src/game/GMTicketHandler.cpp +++ b/src/game/GMTicketHandler.cpp @@ -116,7 +116,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) DEBUG_LOG("update the ticket"); //TODO: Guard player map - HashMapHolder::MapType &m = ObjectAccessor::Instance().GetPlayers(); + HashMapHolder::MapType &m = objaccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets()) diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 4f6627629..1e425aed7 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -520,7 +520,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) objmgr.AddCreatureToGrid(*itr, data); // Spawn if necessary (loaded grids only) - Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); + Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); // We use spawn coords to spawn if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY)) { @@ -553,7 +553,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) objmgr.AddGameobjectToGrid(*itr, data); // Spawn if necessary (loaded grids only) // this base map checked as non-instanced and then only existed - Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); + Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { diff --git a/src/game/GlobalEvents.cpp b/src/game/GlobalEvents.cpp index 2a03c05f8..79dc9b7c1 100644 --- a/src/game/GlobalEvents.cpp +++ b/src/game/GlobalEvents.cpp @@ -51,7 +51,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones) /// Resurrectable - convert corpses to bones if(!bones) { - if(!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid)) + if(!objaccessor.ConvertCorpseForPlayer(player_guid)) { sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow); CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); @@ -60,7 +60,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones) else ///- or delete bones { - MapManager::Instance().RemoveBonesFromMap(mapid, guid, positionX, positionY); + mapmgr.RemoveBonesFromMap(mapid, guid, positionX, positionY); ///- remove bones from the database CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 5750ac1c8..49db5d59c 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1561,7 +1561,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) bool isEmpty = true; // if the map is loaded, reset it - Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId()); + Map *map = mapmgr.FindMap(p->GetMapId(), p->GetInstanceId()); if(map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset())) isEmpty = ((InstanceMap*)map)->Reset(method); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index bf2f9c233..98195a8fd 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -168,7 +168,7 @@ void InstanceSave::SaveToDB() // save instance data too std::string data; - Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid); + Map *map = mapmgr.FindMap(GetMapId(),m_instanceid); if(map) { assert(map->IsDungeon()); @@ -567,7 +567,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) { sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); - Map *map = (MapInstanced*)MapManager::Instance().CreateBaseMap(mapid); + Map *map = (MapInstanced*)mapmgr.CreateBaseMap(mapid); if(!map->Instanceable()) return; @@ -584,7 +584,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe { // global reset for all instances of the given map // note: this isn't fast but it's meant to be executed very rarely - Map const *map = MapManager::Instance().CreateBaseMap(mapid); + Map const *map = mapmgr.CreateBaseMap(mapid); if(!map->Instanceable()) return; uint64 now = (uint64)time(NULL); diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index a325afee5..d31c6ecac 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -31,7 +31,7 @@ static void AttemptJoin(Player* _player) return; //TODO: Guard Player Map - HashMapHolder::MapType const& players = ObjectAccessor::Instance().GetPlayers(); + HashMapHolder::MapType const& players = objaccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) { Player *plr = iter->second; @@ -91,7 +91,7 @@ static void AttemptAddMore(Player* _player) return; //TODO: Guard Player map - HashMapHolder::MapType const& players = ObjectAccessor::Instance().GetPlayers(); + HashMapHolder::MapType const& players = objaccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) { Player *plr = iter->second; @@ -302,7 +302,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type) data << uint32(0); // unk //TODO: Guard Player map - HashMapHolder::MapType const& players = ObjectAccessor::Instance().GetPlayers(); + HashMapHolder::MapType const& players = objaccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) { Player *plr = iter->second; diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index b79283248..5e7a2ab8f 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1967,7 +1967,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args) //Save all players in the world bool ChatHandler::HandleSaveAllCommand(const char* /*args*/) { - ObjectAccessor::Instance().SaveAllPlayers(); + objaccessor.SaveAllPlayers(); SendSysMessage(LANG_PLAYERS_SAVED); return true; } @@ -2080,7 +2080,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args) PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str()); Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation, - MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid); + mapmgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid); } return true; @@ -2338,7 +2338,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args) else _player->SaveRecallPosition(); - Map const *map = MapManager::Instance().CreateBaseMap(mapid); + Map const *map = mapmgr.CreateBaseMap(mapid); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); @@ -2431,7 +2431,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) // update to parent zone if exist (client map show only zones without parents) AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; - Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid); + Map const *map = mapmgr.CreateBaseMap(zoneEntry->mapid); if(map->Instanceable()) { @@ -2506,7 +2506,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args) else _player->SaveRecallPosition(); - Map const *map = MapManager::Instance().CreateBaseMap(mapid); + Map const *map = mapmgr.CreateBaseMap(mapid); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 9c3761ae9..898fd519b 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -192,7 +192,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) { sLog.outString( "Re-Loading config settings..." ); sWorld.LoadConfigSettings(true); - MapManager::Instance().InitializeVisibilityDistanceInfo(); + mapmgr.InitializeVisibilityDistanceInfo(); SendGlobalSysMessage("World config settings reloaded."); return true; } @@ -3515,7 +3515,7 @@ bool ChatHandler::HandleReviveCommand(const char* args) } else // will resurrected at login without corpse - ObjectAccessor::Instance().ConvertCorpseForPlayer(target_guid); + objaccessor.ConvertCorpseForPlayer(target_guid); return true; } @@ -4517,7 +4517,7 @@ bool ChatHandler::HandleResetAllCommand(const char * args) } CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin); - HashMapHolder::MapType const& plist = ObjectAccessor::Instance().GetPlayers(); + HashMapHolder::MapType const& plist = objaccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) itr->second->SetAtLoginFlag(atLogin); @@ -6014,8 +6014,8 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/) { - PSendSysMessage("instances loaded: %d", MapManager::Instance().GetNumInstances()); - PSendSysMessage("players in instances: %d", MapManager::Instance().GetNumPlayersInInstances()); + PSendSysMessage("instances loaded: %d", mapmgr.GetNumInstances()); + PSendSysMessage("players in instances: %d", mapmgr.GetNumPlayersInInstances()); PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves()); PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal()); PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal()); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 0114f1ae2..638b20ae9 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -323,7 +323,7 @@ void Map::DeleteFromWorld(T* obj) template<> void Map::DeleteFromWorld(Player* pl) { - ObjectAccessor::Instance().RemoveObject(pl); + objaccessor.RemoveObject(pl); delete pl; } @@ -411,7 +411,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) loader.LoadN(); // Add resurrectable corpses to world object list in grid - ObjectAccessor::Instance().AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this); + objaccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this); setGridObjectDataLoaded(true,cell.GridX(), cell.GridY()); return true; @@ -2059,7 +2059,7 @@ void Map::SendInitSelf( Player * player ) void Map::SendInitTransports( Player * player ) { // Hack to send out transports - MapManager::TransportMap& tmap = MapManager::Instance().m_TransportsByMap; + MapManager::TransportMap& tmap = mapmgr.m_TransportsByMap; // no transports at map if (tmap.find(player->GetMapId()) == tmap.end()) @@ -2086,7 +2086,7 @@ void Map::SendInitTransports( Player * player ) void Map::SendRemoveTransports( Player * player ) { // Hack to send out transports - MapManager::TransportMap& tmap = MapManager::Instance().m_TransportsByMap; + MapManager::TransportMap& tmap = mapmgr.m_TransportsByMap; // no transports at map if (tmap.find(player->GetMapId()) == tmap.end()) diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 2db10d3be..4d1246d1a 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -166,7 +166,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player) { // if no instanceId via group members or instance saves is found // the instance will be created for the first time - NewInstanceId = MapManager::Instance().GenerateInstanceId(); + NewInstanceId = mapmgr.GenerateInstanceId(); Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid()); map = CreateInstance(NewInstanceId, NULL, diff); diff --git a/src/game/MapManager.h b/src/game/MapManager.h index 0492f00f2..ea17d4ae4 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -154,4 +154,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton::MapType& m = ObjectAccessor::Instance().GetPlayers(); + HashMapHolder::MapType& m = objaccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if (security == SEC_PLAYER) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index cca3c718c..b71ab4f04 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -65,7 +65,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SetSemaphoreTeleportFar(false); // relocate the player to the teleport destination - GetPlayer()->SetMap(MapManager::Instance().CreateMap(loc.mapid, GetPlayer())); + GetPlayer()->SetMap(mapmgr.CreateMap(loc.mapid, GetPlayer())); GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation); GetPlayer()->SendInitialPacketsBeforeAddToMap(); @@ -274,7 +274,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) if (plMover && !plMover->m_transport) { // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list - for (MapManager::TransportSet::const_iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) + for (MapManager::TransportSet::const_iterator iter = mapmgr.m_Transports.begin(); iter != mapmgr.m_Transports.end(); ++iter) { if ((*iter)->GetGUID() == movementInfo.t_guid) { diff --git a/src/game/Object.cpp b/src/game/Object.cpp index ec5d0293b..c37b85348 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1589,7 +1589,7 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) { //if object is in world, map for it already created! - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); if(_map) _map->MessageBroadcast(this, data); } @@ -1597,7 +1597,7 @@ void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/) { //if object is in world, map for it already created! - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); if(_map) _map->MessageDistBroadcast(this, data, dist); } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 9e7789e20..40f5b3307 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -249,7 +249,7 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia) // remove resurrectable corpse from grid object registry (loaded state checked into call) // do not load the map if it's not loaded - Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId()); + Map *map = mapmgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId()); if(map) map->Remove(corpse, false); diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 8377724a8..f2aacd985 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -168,4 +168,6 @@ inline Unit* ObjectAccessor::GetUnitInWorld(WorldObject const& obj, uint64 guid) return GetCreatureInWorld(guid); } +#define objaccessor ObjectAccessor::Instance() + #endif diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index b2096c074..6b4918616 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -147,7 +147,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType uint32 player_guid = itr->first; - Corpse *obj = ObjectAccessor::Instance().GetCorpseForPlayerGUID(player_guid); + Corpse *obj = objaccessor.GetCorpseForPlayerGUID(player_guid); if(!obj) continue; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 551e4b325..5410bef43 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -5232,7 +5232,7 @@ void ObjectMgr::LoadGraveyardZones() WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team) { // search for zone associated closest graveyard - uint32 zoneId = MapManager::Instance().GetZoneId(MapId,x,y,z); + uint32 zoneId = mapmgr.GetZoneId(MapId,x,y,z); // Simulate std. algorithm: // found some graveyard associated to (ghost_zone,ghost_map) @@ -6225,7 +6225,7 @@ void ObjectMgr::LoadCorpses() continue; } - ObjectAccessor::Instance().AddCorpse(corpse); + objaccessor.AddCorpse(corpse); ++count; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 6590cd1c2..786d52fcc 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -556,7 +556,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 return false; } - SetMap(MapManager::Instance().CreateMap(info->mapId, this)); + SetMap(mapmgr.CreateMap(info->mapId, this)); uint8 powertype = cEntry->powerType; @@ -1680,12 +1680,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // Check enter rights before map getting to avoid creating instance copy for player // this check not dependent from map instance copy and same for all instance copies of selected map - if (!MapManager::Instance().CanPlayerEnter(mapid, this)) + if (!mapmgr.CanPlayerEnter(mapid, this)) return false; // If the map is not created, assume it is possible to enter it. // It will be created in the WorldPortAck. - Map *map = MapManager::Instance().FindMap(mapid); + Map *map = mapmgr.FindMap(mapid); if (!map || map->CanEnter(this)) { //lets reset near teleport flag if it wasn't reset during chained teleports @@ -3887,7 +3887,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry) // bones will be deleted by corpse/bones deleting thread shortly - ObjectAccessor::Instance().ConvertCorpseForPlayer(playerguid); + objaccessor.ConvertCorpseForPlayer(playerguid); // remove from guild uint32 guildId = GetGuildIdFromDB(playerguid); @@ -4295,18 +4295,18 @@ void Player::CreateCorpse() corpse->SaveToDB(); // register for player, but not show - ObjectAccessor::Instance().AddCorpse(corpse); + objaccessor.AddCorpse(corpse); } void Player::SpawnCorpseBones() { - if(ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID())) + if(objaccessor.ConvertCorpseForPlayer(GetGUID())) SaveToDB(); // prevent loading as ghost without corpse } Corpse* Player::GetCorpse() const { - return ObjectAccessor::Instance().GetCorpseForPlayerGUID(GetGUID()); + return objaccessor.GetCorpseForPlayerGUID(GetGUID()); } void Player::DurabilityLossAll(double percent, bool inventory) @@ -5666,7 +5666,7 @@ void Player::SaveRecallPosition() void Player::SendMessageToSet(WorldPacket *data, bool self) { - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); if(_map) { _map->MessageBroadcast(this, data, self); @@ -5681,7 +5681,7 @@ void Player::SendMessageToSet(WorldPacket *data, bool self) void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) { - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); if(_map) { _map->MessageDistBroadcast(this, data, dist, self); @@ -5694,7 +5694,7 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only) { - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); if(_map) { _map->MessageDistBroadcast(this, data, dist, self, own_team_only); @@ -6179,7 +6179,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) float posz = fields[3].GetFloat(); delete result; - zone = MapManager::Instance().GetZoneId(map,posx,posy,posz); + zone = mapmgr.GetZoneId(map,posx,posy,posz); if (zone > 0) CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow); @@ -7347,7 +7347,7 @@ void Player::RemovedInsignia(Player* looterPlr) // We have to convert player corpse to bones, not to be able to resurrect there // SpawnCorpseBones isn't handy, 'cos it saves player while he in BG - Corpse *bones = ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID(),true); + Corpse *bones = objaccessor.ConvertCorpseForPlayer(GetGUID(),true); if (!bones) return; @@ -12135,7 +12135,7 @@ void Player::PrepareQuestMenu( uint64 guid ) { //we should obtain map pointer from GetMap() in 99% of cases. Special case //only for quests which cast teleport spells on player - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); GameObject *pGameObject = _map->GetGameObject(guid); if( pGameObject ) @@ -12292,7 +12292,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) { //we should obtain map pointer from GetMap() in 99% of cases. Special case //only for quests which cast teleport spells on player - Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); GameObject *pGameObject = _map->GetGameObject(guid); if( pGameObject ) @@ -14293,7 +14293,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if (transGUID != 0) { - for (MapManager::TransportSet::const_iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) + for (MapManager::TransportSet::const_iterator iter = mapmgr.m_Transports.begin(); iter != mapmgr.m_Transports.end(); ++iter) { if( (*iter)->GetGUIDLow() == transGUID) { @@ -14342,7 +14342,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 - SetMap(MapManager::Instance().CreateMap(GetMapId(), this)); + SetMap(mapmgr.CreateMap(GetMapId(), this)); // if the player is in an instance and it has been reset in the meantime teleport him to the entrance if(GetInstanceId() && !sInstanceSaveManager.GetInstanceSave(GetInstanceId())) @@ -14536,7 +14536,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) //we can be relocated from taxi and still have an outdated Map pointer! //so we need to get a new Map pointer! - SetMap(MapManager::Instance().CreateMap(GetMapId(), this)); + SetMap(mapmgr.CreateMap(GetMapId(), this)); SaveRecallPosition(); // save as recall also to prevent recall and fall from sky m_taxi.ClearTaxiDestinations(); @@ -14808,7 +14808,7 @@ void Player::LoadCorpse() { if( isAlive() ) { - ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()); + objaccessor.ConvertCorpseForPlayer(GetGUID()); } else { @@ -16246,7 +16246,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) } // if the map is loaded, reset it - Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId()); + Map *map = mapmgr.FindMap(p->GetMapId(), p->GetInstanceId()); if(map && map->IsDungeon()) ((InstanceMap*)map)->Reset(method); diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index 64b42fa0d..5a22f69fb 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -248,7 +248,7 @@ bool PoolGroup::Spawn1Object(uint32 guid) objmgr.AddCreatureToGrid(guid, data); // Spawn if necessary (loaded grids only) - Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); + Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); // We use spawn coords to spawn if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { @@ -276,7 +276,7 @@ bool PoolGroup::Spawn1Object(uint32 guid) objmgr.AddGameobjectToGrid(guid, data); // Spawn if necessary (loaded grids only) // this base map checked as non-instanced and then only existed - Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); + Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index bd48b94b2..52c656cec 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -299,7 +299,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0) { // if corpse map have entrance - if(Map const* entranceMap = MapManager::Instance().CreateBaseMap(corpseMapEntry->entrance_map)) + if(Map const* entranceMap = mapmgr.CreateBaseMap(corpseMapEntry->entrance_map)) { mapid = corpseMapEntry->entrance_map; x = corpseMapEntry->entrance_x; diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 20170172e..d143c2a7d 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -102,7 +102,7 @@ void MapManager::LoadTransports() m_TransportsByMap[*i].insert(t); //If we someday decide to use the grid to track transports, here: - t->SetMap(MapManager::Instance().CreateMap(mapid, t)); + t->SetMap(mapmgr.CreateMap(mapid, t)); //t->GetMap()->Add((GameObject *)t); ++count; @@ -459,7 +459,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... //player far teleport would try to create same instance, but we need it NOW for transport... //correct me if I'm wrong O.o - Map * newMap = MapManager::Instance().CreateMap(newMapid, this); + Map * newMap = mapmgr.CreateMap(newMapid, this); SetMap(newMap); if(oldMap != newMap) diff --git a/src/game/World.cpp b/src/game/World.cpp index 8efd7bf0f..4624ac8ac 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -569,7 +569,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; } if(reload) - MapManager::Instance().SetGridCleanUpDelay(m_configs[CONFIG_INTERVAL_GRIDCLEAN]); + mapmgr.SetGridCleanUpDelay(m_configs[CONFIG_INTERVAL_GRIDCLEAN]); m_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfig.GetIntDefault("MapUpdateInterval", 100); if(m_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) @@ -578,7 +578,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if(reload) - MapManager::Instance().SetMapUpdateInterval(m_configs[CONFIG_INTERVAL_MAPUPDATE]); + mapmgr.SetMapUpdateInterval(m_configs[CONFIG_INTERVAL_MAPUPDATE]); m_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfig.GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILISECONDS); @@ -1489,7 +1489,7 @@ void World::SetInitialWorldSettings() ///- Initialize MapManager sLog.outString( "Starting Map System" ); - MapManager::Instance().Initialize(); + mapmgr.Initialize(); ///- Initialize Battlegrounds sLog.outString( "Starting BattleGround System" ); @@ -1498,7 +1498,7 @@ void World::SetInitialWorldSettings() //Not sure if this can be moved up in the sequence (with static data loading) as it uses MapManager sLog.outString( "Loading Transports..." ); - MapManager::Instance().LoadTransports(); + mapmgr.LoadTransports(); sLog.outString("Deleting expired bans..." ); loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); @@ -1643,7 +1643,7 @@ void World::Update(uint32 diff) { m_timers[WUPDATE_OBJECTS].Reset(); ///- Update objects when the timer has passed (maps, transport, creatures,...) - MapManager::Instance().Update(diff); // As interval = 0 + mapmgr.Update(diff); // As interval = 0 sBattleGroundMgr.Update(diff); } @@ -1670,7 +1670,7 @@ void World::Update(uint32 diff) /// ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" - MapManager::Instance().DoDelayedMovesAndRemoves(); + mapmgr.DoDelayedMovesAndRemoves(); // update the instance reset times sInstanceSaveManager.Update(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1f179117b..755210c68 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8784" + #define REVISION_NR "8785" #endif // __REVISION_NR_H__ From 33d475caf38acb0ee9441c0d6210c87fd3d90f89 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 04:21:43 +0100 Subject: [PATCH 10/23] [8786] Rename some files. * HostilRefManager.cpp/.h -> HostileRefManager.cpp/.h * PoolHandler.cpp/.h -> PoolManager.cpp/.h --- src/game/Creature.cpp | 2 +- src/game/GameEventMgr.cpp | 2 +- src/game/GameObject.cpp | 2 +- ...ilRefManager.cpp => HostileRefManager.cpp} | 2 +- ...HostilRefManager.h => HostileRefManager.h} | 0 src/game/Level2.cpp | 2 +- src/game/Makefile.am | 8 +++---- src/game/{PoolHandler.cpp => PoolManager.cpp} | 24 +++++++++---------- src/game/{PoolHandler.h => PoolManager.h} | 8 +++---- src/game/Unit.h | 2 +- src/game/World.cpp | 2 +- src/shared/revision_nr.h | 2 +- win/VC100/game.vcxproj | 8 +++---- win/VC80/game.vcproj | 8 +++---- win/VC90/game.vcproj | 8 +++---- 15 files changed, 40 insertions(+), 40 deletions(-) rename src/game/{HostilRefManager.cpp => HostileRefManager.cpp} (99%) rename src/game/{HostilRefManager.h => HostileRefManager.h} (100%) rename src/game/{PoolHandler.cpp => PoolManager.cpp} (97%) rename src/game/{PoolHandler.h => PoolManager.h} (96%) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 09fbf236e..975de602e 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -26,7 +26,7 @@ #include "QuestDef.h" #include "GossipDef.h" #include "Player.h" -#include "PoolHandler.h" +#include "PoolManager.h" #include "Opcodes.h" #include "Log.h" #include "LootMgr.h" diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 1e425aed7..a64596e8f 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -19,7 +19,7 @@ #include "GameEventMgr.h" #include "World.h" #include "ObjectMgr.h" -#include "PoolHandler.h" +#include "PoolManager.h" #include "ProgressBar.h" #include "Language.h" #include "Log.h" diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 92bd2af22..fb01c983f 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -20,7 +20,7 @@ #include "QuestDef.h" #include "GameObject.h" #include "ObjectMgr.h" -#include "PoolHandler.h" +#include "PoolManager.h" #include "SpellMgr.h" #include "Spell.h" #include "UpdateMask.h" diff --git a/src/game/HostilRefManager.cpp b/src/game/HostileRefManager.cpp similarity index 99% rename from src/game/HostilRefManager.cpp rename to src/game/HostileRefManager.cpp index c9cd9cd97..12accb7cf 100644 --- a/src/game/HostilRefManager.cpp +++ b/src/game/HostileRefManager.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "HostilRefManager.h" +#include "HostileRefManager.h" #include "ThreatManager.h" #include "Unit.h" #include "DBCStructure.h" diff --git a/src/game/HostilRefManager.h b/src/game/HostileRefManager.h similarity index 100% rename from src/game/HostilRefManager.h rename to src/game/HostileRefManager.h diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 9749bfc8d..b4f6d587f 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -30,7 +30,7 @@ #include "World.h" #include "GameEventMgr.h" #include "SpellMgr.h" -#include "PoolHandler.h" +#include "PoolManager.h" #include "AccountMgr.h" #include "GMTicketMgr.h" #include "WaypointManager.h" diff --git a/src/game/Makefile.am b/src/game/Makefile.am index 2feb09216..39a6cb5b8 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -148,8 +148,8 @@ libmangosgame_a_SOURCES = \ GuildHandler.cpp \ HomeMovementGenerator.cpp \ HomeMovementGenerator.h \ - HostilRefManager.cpp \ - HostilRefManager.h \ + HostileRefManager.cpp \ + HostileRefManager.h \ IdleMovementGenerator.cpp \ IdleMovementGenerator.h \ InstanceData.cpp \ @@ -218,8 +218,8 @@ libmangosgame_a_SOURCES = \ PlayerDump.h \ PointMovementGenerator.cpp \ PointMovementGenerator.h \ - PoolHandler.cpp \ - PoolHandler.h \ + PoolManager.cpp \ + PoolManager.h \ QueryHandler.cpp \ QuestDef.cpp \ QuestDef.h \ diff --git a/src/game/PoolHandler.cpp b/src/game/PoolManager.cpp similarity index 97% rename from src/game/PoolHandler.cpp rename to src/game/PoolManager.cpp index 5a22f69fb..5090735b5 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolManager.cpp @@ -16,14 +16,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "PoolHandler.h" +#include "PoolManager.h" #include "ObjectMgr.h" #include "ProgressBar.h" #include "Log.h" #include "MapManager.h" #include "Policies/SingletonImp.h" -INSTANTIATE_SINGLETON_1(PoolHandler); +INSTANTIATE_SINGLETON_1(PoolManager); //////////////////////////////////////////////////////////// // Methods of template class PoolGroup @@ -343,14 +343,14 @@ bool PoolGroup::ReSpawn1Object(uint32 /*guid*/) //////////////////////////////////////////////////////////// -// Methods of class PoolHandler +// Methods of class PoolManager -PoolHandler::PoolHandler() +PoolManager::PoolManager() { m_IsPoolSystemStarted = false; } -void PoolHandler::LoadFromDB() +void PoolManager::LoadFromDB() { QueryResult *result = WorldDatabase.Query("SELECT MAX(entry) FROM pool_template"); if (!result) @@ -619,7 +619,7 @@ void PoolHandler::LoadFromDB() } // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks -void PoolHandler::Initialize() +void PoolManager::Initialize() { QueryResult *result = WorldDatabase.Query("SELECT DISTINCT pool_template.entry FROM pool_template LEFT JOIN game_event_pool ON pool_template.entry=game_event_pool.pool_entry LEFT JOIN pool_pool ON pool_template.entry=pool_pool.pool_id WHERE game_event_pool.pool_entry IS NULL AND pool_pool.pool_id IS NULL"); uint32 count=0; @@ -648,7 +648,7 @@ void PoolHandler::Initialize() // Call to spawn a pool, if cache if true the method will spawn only if cached entry is different // If it's same, the gameobject/creature is respawned only (added back to map) -void PoolHandler::SpawnPool(uint16 pool_id, uint32 guid, uint32 type) +void PoolManager::SpawnPool(uint16 pool_id, uint32 guid, uint32 type) { switch (type) { @@ -667,7 +667,7 @@ void PoolHandler::SpawnPool(uint16 pool_id, uint32 guid, uint32 type) } // Call to despawn a pool, all gameobjects/creatures in this pool are removed -void PoolHandler::DespawnPool(uint16 pool_id) +void PoolManager::DespawnPool(uint16 pool_id) { if (!mPoolCreatureGroups[pool_id].isEmpty()) mPoolCreatureGroups[pool_id].DespawnObject(); @@ -682,7 +682,7 @@ void PoolHandler::DespawnPool(uint16 pool_id) // Call to update the pool when a gameobject/creature part of pool [pool_id] is ready to respawn // Here we cache only the creature/gameobject whose guid is passed as parameter // Then the spawn pool call will use this cache to decide -void PoolHandler::UpdatePool(uint16 pool_id, uint32 guid, uint32 type) +void PoolManager::UpdatePool(uint16 pool_id, uint32 guid, uint32 type) { if (uint16 motherpoolid = IsPartOfAPool(pool_id, 0)) SpawnPool(motherpoolid, 0, 0); @@ -691,7 +691,7 @@ void PoolHandler::UpdatePool(uint16 pool_id, uint32 guid, uint32 type) } // Method that tell if the gameobject/creature is part of a pool and return the pool id if yes -uint16 PoolHandler::IsPartOfAPool(uint32 guid, uint32 type) +uint16 PoolManager::IsPartOfAPool(uint32 guid, uint32 type) { if (type == 0) // pool of pool { @@ -715,7 +715,7 @@ uint16 PoolHandler::IsPartOfAPool(uint32 guid, uint32 type) } // Method that check chance integrity of the creatures and gameobjects in this pool -bool PoolHandler::CheckPool(uint16 pool_id) +bool PoolManager::CheckPool(uint16 pool_id) { return pool_id <= max_pool_id && mPoolGameobjectGroups[pool_id].CheckPool() && @@ -724,7 +724,7 @@ bool PoolHandler::CheckPool(uint16 pool_id) } // Method that tell if a creature or gameobject in pool_id is spawned currently -bool PoolHandler::IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type) +bool PoolManager::IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type) { if (pool_id > max_pool_id) return false; diff --git a/src/game/PoolHandler.h b/src/game/PoolManager.h similarity index 96% rename from src/game/PoolHandler.h rename to src/game/PoolManager.h index 9ea0cd376..6d2b83a16 100644 --- a/src/game/PoolHandler.h +++ b/src/game/PoolManager.h @@ -65,11 +65,11 @@ class Pool // for Pool of Pool { }; -class PoolHandler +class PoolManager { public: - PoolHandler(); - ~PoolHandler() {}; + PoolManager(); + ~PoolManager() {}; void LoadFromDB(); uint16 IsPartOfAPool(uint32 guid, uint32 type); bool IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type); @@ -99,5 +99,5 @@ class PoolHandler }; -#define poolhandler MaNGOS::Singleton::Instance() +#define poolhandler MaNGOS::Singleton::Instance() #endif diff --git a/src/game/Unit.h b/src/game/Unit.h index b481c3771..619df4a83 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -26,7 +26,7 @@ #include "UpdateFields.h" #include "SharedDefines.h" #include "ThreatManager.h" -#include "HostilRefManager.h" +#include "HostileRefManager.h" #include "FollowerReference.h" #include "FollowerRefManager.h" #include "Utilities/EventProcessor.h" diff --git a/src/game/World.cpp b/src/game/World.cpp index 4624ac8ac..3f77b6c4d 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -54,7 +54,7 @@ #include "VMapFactory.h" #include "GlobalEvents.h" #include "GameEventMgr.h" -#include "PoolHandler.h" +#include "PoolManager.h" #include "Database/DatabaseImpl.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 755210c68..b24ff9977 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8785" + #define REVISION_NR "8786" #endif // __REVISION_NR_H__ diff --git a/win/VC100/game.vcxproj b/win/VC100/game.vcxproj index 7b26ec3df..6b648c5ac 100644 --- a/win/VC100/game.vcxproj +++ b/win/VC100/game.vcxproj @@ -407,7 +407,7 @@ - + @@ -454,7 +454,7 @@ - + @@ -557,7 +557,7 @@ - + @@ -590,7 +590,7 @@ - + diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index db509f9b2..a7b62a9f2 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -878,11 +878,11 @@ > Date: Sun, 8 Nov 2009 11:38:00 +0100 Subject: [PATCH 11/23] [8787] Cleanup in Errors.h. --- src/game/Object.cpp | 6 ++--- src/shared/Errors.h | 56 ++++++++++++++++++++++++++++++++-------- src/shared/revision_nr.h | 2 +- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index c37b85348..9a5555ad3 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -277,7 +277,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2) if(((Player*)this)->isInFlight()) { - WPAssert(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE); + ASSERT(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE); flags2 = (MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE2); } } @@ -384,7 +384,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2) return; } - WPAssert(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE); + ASSERT(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE); FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(((Player*)this)->GetMotionMaster()->top()); @@ -616,7 +616,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * } } - WPAssert(updateMask && updateMask->GetCount() == m_valuesCount); + ASSERT(updateMask && updateMask->GetCount() == m_valuesCount); *data << (uint8)updateMask->GetBlockCount(); data->append( updateMask->GetMask(), updateMask->GetLength() ); diff --git a/src/shared/Errors.h b/src/shared/Errors.h index 01d504229..701bda930 100644 --- a/src/shared/Errors.h +++ b/src/shared/Errors.h @@ -22,22 +22,56 @@ #include "Common.h" #ifndef HAVE_CONFIG_H -#define HAVE_ACE_STACK_TRACE_H 1 +# define HAVE_ACE_STACK_TRACE_H 1 #endif #ifdef HAVE_ACE_STACK_TRACE_H -#include "ace/Stack_Trace.h" +# include "ace/Stack_Trace.h" #endif -#ifdef HAVE_ACE_STACK_TRACE_H // old versions ACE not have Stack_Trace.h but used at some oS for better compatibility -#define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__,__FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); } } +#ifdef HAVE_ACE_STACK_TRACE_H +// Normal assert. +#define WPError(CONDITION) \ +if (!(CONDITION)) \ +{ \ + ACE_Stack_Trace st; \ + printf("%s:%i: Error: Assertion in %s failed: %s\nStack Trace:\n%s", \ + __FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION), st.c_str()); \ + assert(STRINGIZE(CONDITION) && 0); \ +} + +// Just warn. +#define WPWarning(CONDITION) \ +if (!(CONDITION)) \ +{ \ + ACE_Stack_Trace st; \ + printf("%s:%i: Warning: Assertion in %s failed: %s\nStack Trace:\n%s",\ + __FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION), st.c_str()); \ +} #else -#define WPAssert( assertion ) { if (!(assertion)) { fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED2:\n %s\n", __FILE__, __LINE__,__FUNCTION__, #assertion); assert( #assertion &&0 ); } } -#endif -#define WPError( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } -#define WPWarning( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } +// Normal assert. +#define WPError(CONDITION) \ +if (!(CONDITION)) \ +{ \ + printf("%s:%i: Error: Assertion in %s failed: %s", \ + __FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION)); \ + assert(STRINGIZE(CONDITION) && 0); \ +} + +// Just warn. +#define WPWarning(CONDITION) \ +if (!(CONDITION)) \ +{ \ + ACE_Stack_Trace st; \ + printf("%s:%i: Warning: Assertion in %s failed: %s",\ + __FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION)); \ +} +#endif + +#ifdef MANGOS_DEBUG +# define ASSERT WPError +#else +# define ASSERT WPError // Error even if in release mode. +#endif -#define WPFatal( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( #assertion &&0 ); abort(); } - -#define ASSERT WPAssert #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b24ff9977..04a47d92b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8786" + #define REVISION_NR "8787" #endif // __REVISION_NR_H__ From 539072fcbd5414f6e6bf8df87842a38b9c8438fd Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sun, 8 Nov 2009 11:56:31 +0100 Subject: [PATCH 12/23] [8788] Clarify error log message for db_script_string Signed-off-by: NoFantasy --- src/game/ObjectMgr.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 5410bef43..49ca02192 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -8060,7 +8060,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set& ids) case SCRIPT_COMMAND_TALK: { if(!GetMangosStringLocale (itrM->second.dataint)) - sLog.outErrorDb( "Table `db_script_string` not has string id %u used db script (ID: %u)", itrM->second.dataint, itrMM->first); + sLog.outErrorDb( "Table `db_script_string` is missing string id %u, used in database script id %u.", itrM->second.dataint, itrMM->first); if(ids.count(itrM->second.dataint)) ids.erase(itrM->second.dataint); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 04a47d92b..2c696aec5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8787" + #define REVISION_NR "8788" #endif // __REVISION_NR_H__ From 0734adb746617eb5ea86b173ab92b40797c51a67 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 12:11:18 +0100 Subject: [PATCH 13/23] [8789] Rename several singleton macros to use more consistent names. * objmgr -> sObjectMgr * spellmgr -> sSpellMgr * WaypointMgr -> sWaypointMgr * poolhandler -> sPoolMgr * objaccessor -> sObjectAccessor * mapmgr -> sMapMgr * sInstanceSaveManager -> sInstanceSaveMgr * ticketmgr -> sTicketMgr * CreatureEAI_Mgr -> sEventAIMgr * auctionmgr -> sAuctionMgr * achievementmgr -> sAchievementMgr --- src/game/AchievementMgr.cpp | 54 ++--- src/game/AchievementMgr.h | 2 +- src/game/ArenaTeam.cpp | 28 +-- src/game/ArenaTeamHandler.cpp | 22 +- src/game/AuctionHouseHandler.cpp | 42 ++-- src/game/AuctionHouseMgr.cpp | 50 ++-- src/game/AuctionHouseMgr.h | 2 +- src/game/BattleGround.cpp | 62 ++--- src/game/BattleGroundEY.cpp | 6 +- src/game/BattleGroundHandler.cpp | 10 +- src/game/BattleGroundMgr.cpp | 28 +-- src/game/Channel.cpp | 42 ++-- src/game/CharacterHandler.cpp | 26 +-- src/game/Chat.cpp | 36 +-- src/game/ChatHandler.cpp | 8 +- src/game/Corpse.cpp | 4 +- src/game/Creature.cpp | 64 +++--- src/game/CreatureEventAI.cpp | 14 +- src/game/CreatureEventAIMgr.cpp | 10 +- src/game/CreatureEventAIMgr.h | 2 +- src/game/GMTicketHandler.cpp | 12 +- src/game/GMTicketMgr.cpp | 2 +- src/game/GMTicketMgr.h | 2 +- src/game/GameEventMgr.cpp | 48 ++-- src/game/GameObject.cpp | 40 ++-- src/game/GlobalEvents.cpp | 4 +- src/game/GossipDef.cpp | 26 +-- src/game/Group.cpp | 54 ++--- src/game/GroupHandler.cpp | 14 +- src/game/Guild.cpp | 24 +- src/game/GuildHandler.cpp | 68 +++--- src/game/HomeMovementGenerator.cpp | 2 +- src/game/InstanceSaveMgr.cpp | 14 +- src/game/InstanceSaveMgr.h | 2 +- src/game/Item.cpp | 10 +- src/game/ItemHandler.cpp | 4 +- src/game/LFGHandler.cpp | 10 +- src/game/Level1.cpp | 18 +- src/game/Level2.cpp | 102 ++++----- src/game/Level3.cpp | 184 +++++++-------- src/game/LootMgr.cpp | 4 +- src/game/Mail.cpp | 32 +-- src/game/Map.cpp | 24 +- src/game/MapInstanced.cpp | 2 +- src/game/MapManager.h | 2 +- src/game/MiscHandler.cpp | 20 +- src/game/MovementHandler.cpp | 8 +- src/game/NPCHandler.cpp | 10 +- src/game/Object.cpp | 14 +- src/game/ObjectAccessor.cpp | 6 +- src/game/ObjectAccessor.h | 2 +- src/game/ObjectGridLoader.cpp | 8 +- src/game/ObjectMgr.cpp | 36 +-- src/game/ObjectMgr.h | 2 +- src/game/Pet.cpp | 40 ++-- src/game/PetHandler.cpp | 2 +- src/game/PetitionsHandler.cpp | 32 +-- src/game/Player.cpp | 302 ++++++++++++------------- src/game/PlayerDump.cpp | 44 ++-- src/game/PoolManager.cpp | 36 +-- src/game/PoolManager.h | 2 +- src/game/QueryHandler.cpp | 14 +- src/game/QuestHandler.cpp | 30 +-- src/game/ScriptCalls.cpp | 2 +- src/game/SkillDiscovery.cpp | 4 +- src/game/SocialMgr.cpp | 2 +- src/game/Spell.cpp | 16 +- src/game/SpellAuras.cpp | 22 +- src/game/SpellEffects.cpp | 34 +-- src/game/SpellHandler.cpp | 4 +- src/game/SpellMgr.cpp | 24 +- src/game/SpellMgr.h | 2 +- src/game/TaxiHandler.cpp | 10 +- src/game/Totem.cpp | 4 +- src/game/Transports.cpp | 6 +- src/game/Unit.cpp | 34 +-- src/game/WaypointManager.cpp | 2 +- src/game/WaypointManager.h | 2 +- src/game/WaypointMovementGenerator.cpp | 4 +- src/game/World.cpp | 214 +++++++++--------- src/game/WorldSession.cpp | 6 +- src/game/debugcmds.cpp | 2 +- src/mangosd/CliRunnable.cpp | 6 +- src/shared/revision_nr.h | 2 +- 84 files changed, 1113 insertions(+), 1113 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index bd204cded..dc96eea42 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -49,7 +49,7 @@ namespace MaNGOS : i_player(pl), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); data << uint8(i_msgtype); data << uint32(LANG_UNIVERSAL); @@ -366,7 +366,7 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) return; - AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); + AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type); for(AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i) { AchievementCriteriaEntry const *achievementCriteria = (*i); @@ -522,7 +522,7 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri uint32 achievement_id = fields[0].GetUInt32(); - // don't must happen: cleanup at server startup in achievementmgr.LoadCompletedAchievements() + // don't must happen: cleanup at server startup in sAchievementMgr.LoadCompletedAchievements() if(!sAchievementStore.LookupEntry(achievement_id)) continue; @@ -575,7 +575,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) sLog.outDebug("AchievementMgr::SendAchievementEarned(%u)", achievement->ID); #endif - if(Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId())) + if(Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId())) { MaNGOS::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID); MaNGOS::LocalizedPacketDo say_do(say_builder); @@ -665,7 +665,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) return; - AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); + AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type); for(AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i) { AchievementCriteriaEntry const *achievementCriteria = (*i); @@ -741,7 +741,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (achievementCriteria->win_bg.additionalRequirement1_type) { // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if (!data || !data->Meets(GetPlayer(),unit)) continue; } @@ -787,7 +787,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; @@ -833,7 +833,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui uint32 counter =0; for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); ++itr) { - Quest const* quest = objmgr.GetQuestTemplate(itr->first); + Quest const* quest = sObjectMgr.GetQuestTemplate(itr->first); if(itr->second.m_rewarded && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID) counter++; } @@ -886,7 +886,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(!miscvalue1) continue; - Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : mapmgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); + Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : sMapMgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); if(!map || !map->IsDungeon()) continue; @@ -955,7 +955,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; @@ -997,7 +997,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case 1789: { // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; break; @@ -1023,7 +1023,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data) continue; @@ -1053,7 +1053,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(achievementCriteria->loot_type.lootTypeCount==1) { // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; } @@ -1076,7 +1076,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(achievementCriteria->win_rated_arena.flag==ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE) { // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit,miscvalue1)) { // reset the progress as we have a win without the requirement. @@ -1191,7 +1191,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(achievementCriteria->do_emote.count) { // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if(!data || !data->Meets(GetPlayer(),unit)) continue; } @@ -1254,7 +1254,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui spellIter != GetPlayer()->GetSpellMap().end(); ++spellIter) { - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spellIter->first); for(SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter) { if(skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine) @@ -1272,7 +1272,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (achievementCriteria->win_duel.duelCount) { // those requirements couldn't be found in the dbc - AchievementCriteriaRequirementSet const* data = achievementmgr.GetCriteriaRequirementSet(achievementCriteria); + AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria); if (!data) continue; @@ -1301,7 +1301,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui spellIter != GetPlayer()->GetSpellMap().end(); ++spellIter) { - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spellIter->first); for(SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter) if (skillIter->second->skillId == achievementCriteria->learn_skill_line.skillLine) spellCount++; @@ -1371,7 +1371,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui CompletedAchievement(achievement); } - if(AchievementEntryList const* achRefList = achievementmgr.GetAchievementByReferencedId(achievement->ID)) + if(AchievementEntryList const* achRefList = sAchievementMgr.GetAchievementByReferencedId(achievement->ID)) { for(AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) if(IsCompletedAchievement(*itr)) @@ -1392,7 +1392,7 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve if(achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL)) { // someone on this realm has already completed that achievement - if(achievementmgr.IsRealmCompleted(achievement)) + if(sAchievementMgr.IsRealmCompleted(achievement)) return false; } @@ -1554,7 +1554,7 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry) uint32 achievmentForTestId = entry->refAchievement ? entry->refAchievement : entry->ID; uint32 achievmentForTestCount = entry->count; - AchievementCriteriaEntryList const* cList = achievementmgr.GetAchievementCriteriaByAchievement(achievmentForTestId); + AchievementCriteriaEntryList const* cList = sAchievementMgr.GetAchievementCriteriaByAchievement(achievmentForTestId); if(!cList) return false; uint32 count = 0; @@ -1683,12 +1683,12 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) // don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement // TODO: where do set this instead? if(!(achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL)) - achievementmgr.SetRealmCompleted(achievement); + sAchievementMgr.SetRealmCompleted(achievement); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT); // reward items and titles if any - AchievementReward const* reward = achievementmgr.GetAchievementReward(achievement); + AchievementReward const* reward = sAchievementMgr.GetAchievementReward(achievement); // no rewards if(!reward) @@ -1713,7 +1713,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) std::string text = reward->text; if ( loc_idx >= 0 ) { - if(AchievementRewardLocale const* loc = achievementmgr.GetAchievementRewardLocale(achievement)) + if(AchievementRewardLocale const* loc = sAchievementMgr.GetAchievementRewardLocale(achievement)) { if (loc->subject.size() > size_t(loc_idx) && !loc->subject[loc_idx].empty()) subject = loc->subject[loc_idx]; @@ -1722,7 +1722,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) } } - uint32 itemTextId = objmgr.CreateItemText( text ); + uint32 itemTextId = sObjectMgr.CreateItemText( text ); MailDraft draft(subject, itemTextId); @@ -2164,7 +2164,7 @@ void AchievementGlobalMgr::LoadRewardLocales() std::string str = fields[1+2*(i-1)].GetCppString(); if(!str.empty()) { - int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i)); + int idx = sObjectMgr.GetOrNewIndexForLocale(LocaleConstant(i)); if(idx >= 0) { if(data.subject.size() <= size_t(idx)) @@ -2176,7 +2176,7 @@ void AchievementGlobalMgr::LoadRewardLocales() str = fields[1+2*(i-1)+1].GetCppString(); if(!str.empty()) { - int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i)); + int idx = sObjectMgr.GetOrNewIndexForLocale(LocaleConstant(i)); if(idx >= 0) { if(data.text.size() <= size_t(idx)) diff --git a/src/game/AchievementMgr.h b/src/game/AchievementMgr.h index caaf16659..b13441194 100644 --- a/src/game/AchievementMgr.h +++ b/src/game/AchievementMgr.h @@ -323,6 +323,6 @@ class AchievementGlobalMgr AchievementRewardLocales m_achievementRewardLocales; }; -#define achievementmgr MaNGOS::Singleton::Instance() +#define sAchievementMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index df1fc7d9f..4464eef96 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -50,9 +50,9 @@ ArenaTeam::~ArenaTeam() bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName) { - if(!objmgr.GetPlayer(captainGuid)) // player not exist + if(!sObjectMgr.GetPlayer(captainGuid)) // player not exist return false; - if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist + if(sObjectMgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist return false; sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid)); @@ -61,7 +61,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam m_Name = ArenaTeamName; m_Type = type; - m_TeamId = objmgr.GenerateArenaTeamId(); + m_TeamId = sObjectMgr.GenerateArenaTeamId(); // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB CharacterDatabase.escape_string(ArenaTeamName); @@ -90,7 +90,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) if(GetMembersSize() >= GetType() * 2) return false; - Player *pl = objmgr.GetPlayer(PlayerGuid); + Player *pl = sObjectMgr.GetPlayer(PlayerGuid); if(pl) { if(pl->GetArenaTeamId(GetSlot())) @@ -250,7 +250,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult) void ArenaTeam::SetCaptain(const uint64& guid) { // disable remove/promote buttons - Player *oldcaptain = objmgr.GetPlayer(GetCaptain()); + Player *oldcaptain = sObjectMgr.GetPlayer(GetCaptain()); if(oldcaptain) oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1); @@ -261,7 +261,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), m_TeamId); // enable remove/promote buttons - Player *newcaptain = objmgr.GetPlayer(guid); + Player *newcaptain = sObjectMgr.GetPlayer(guid); if(newcaptain) newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0); } @@ -277,7 +277,7 @@ void ArenaTeam::DelMember(uint64 guid) } } - if(Player *player = objmgr.GetPlayer(guid)) + if(Player *player = sObjectMgr.GetPlayer(guid)) { player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team @@ -309,7 +309,7 @@ void ArenaTeam::Disband(WorldSession *session) CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); //< this should be alredy done by calling DelMember(memberGuids[j]); for each member CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", m_TeamId); CharacterDatabase.CommitTransaction(); - objmgr.RemoveArenaTeam(m_TeamId); + sObjectMgr.RemoveArenaTeam(m_TeamId); } void ArenaTeam::Roster(WorldSession *session) @@ -326,7 +326,7 @@ void ArenaTeam::Roster(WorldSession *session) for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { - pl = objmgr.GetPlayer(itr->guid); + pl = sObjectMgr.GetPlayer(itr->guid); data << uint64(itr->guid); // guid data << uint8((pl ? 1 : 0)); // online flag @@ -384,7 +384,7 @@ void ArenaTeam::NotifyStatsChanged() // updates arena team stats for every member of the team (not only the ones who participated!) for(MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { - Player * plr = objmgr.GetPlayer(itr->guid); + Player * plr = sObjectMgr.GetPlayer(itr->guid); if(plr) Stats(plr->GetSession()); } @@ -457,7 +457,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket *packet) { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { - Player *player = objmgr.GetPlayer(itr->guid); + Player *player = sObjectMgr.GetPlayer(itr->guid); if(player) player->GetSession()->SendPacket(packet); } @@ -529,8 +529,8 @@ void ArenaTeam::FinishGame(int32 mod) m_stats.games_season += 1; // update team's rank m_stats.rank = 1; - ObjectMgr::ArenaTeamMap::const_iterator i = objmgr.GetArenaTeamMapBegin(); - for ( ; i != objmgr.GetArenaTeamMapEnd(); ++i) + ObjectMgr::ArenaTeamMap::const_iterator i = sObjectMgr.GetArenaTeamMapBegin(); + for ( ; i != sObjectMgr.GetArenaTeamMapEnd(); ++i) { if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating) ++m_stats.rank; @@ -700,7 +700,7 @@ bool ArenaTeam::IsFighting() const { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { - if (Player *p = objmgr.GetPlayer(itr->guid)) + if (Player *p = sObjectMgr.GetPlayer(itr->guid)) { if (p->GetMap()->IsBattleArena()) return true; diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index b30d5c937..831ace1c1 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -34,13 +34,13 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data) recv_data >> guid; sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); - if(Player *plr = objmgr.GetPlayer(guid)) + if(Player *plr = sObjectMgr.GetPlayer(guid)) { for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i) { if(uint32 a_id = plr->GetArenaTeamId(i)) { - if(ArenaTeam *at = objmgr.GetArenaTeamById(a_id)) + if(ArenaTeam *at = sObjectMgr.GetArenaTeamById(a_id)) at->InspectStats(this, plr->GetGUID()); } } @@ -54,7 +54,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; recv_data >> ArenaTeamId; - if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId)) + if(ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId)) { arenateam->Query(this); arenateam->Stats(this); @@ -68,7 +68,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId)) + if(ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId)) arenateam->Roster(this); } @@ -103,7 +103,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data) return; } - ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId); + ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId); if(!arenateam) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM); @@ -154,7 +154,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode - ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited()); + ArenaTeam *at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited()); if(!at) return; @@ -164,7 +164,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/) return; } - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != objmgr.GetPlayerTeamByGUID(at->GetCaptain())) + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptain())) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_NOT_ALLIED);// not let enemies sign petition return; @@ -196,7 +196,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); + ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId); if(!at) return; @@ -233,7 +233,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data) uint32 ArenaTeamId; // arena team id recv_data >> ArenaTeamId; - if(ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId)) + if(ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId)) { if(at->GetCaptain() != _player->GetGUID()) return; @@ -256,7 +256,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data) recv_data >> ArenaTeamId; recv_data >> name; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); + ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId); if(!at) // arena team not found return; @@ -300,7 +300,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data) recv_data >> ArenaTeamId; recv_data >> name; - ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId); + ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId); if(!at) // arena team not found return; diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index a0089c394..7c131a1d7 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -107,11 +107,11 @@ void WorldSession::SendAuctionOwnerNotification( AuctionEntry* auction) void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPrice) { uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder,0, HIGHGUID_PLAYER); - Player *oldBidder = objmgr.GetPlayer(oldBidder_guid); + Player *oldBidder = sObjectMgr.GetPlayer(oldBidder_guid); uint32 oldBidder_accId = 0; if(!oldBidder) - oldBidder_accId = objmgr.GetPlayerAccountIdByGUID(oldBidder_guid); + oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid); // old bidder exist if(oldBidder || oldBidder_accId) @@ -132,11 +132,11 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri void WorldSession::SendAuctionCancelledToBidderMail( AuctionEntry* auction ) { uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - Player *bidder = objmgr.GetPlayer(bidder_guid); + Player *bidder = sObjectMgr.GetPlayer(bidder_guid); uint32 bidder_accId = 0; if(!bidder) - bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid); + bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); // bidder exist if(bidder || bidder_accId) @@ -202,7 +202,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) Item *it = pl->GetItemByGuid( item ); //do not allow to sell already auctioned items - if(auctionmgr.GetAItem(GUID_LOPART(item))) + 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)); SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR); @@ -227,7 +227,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) return; } - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); + AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() ); //we have to take deposit : uint32 deposit = AuctionHouseMgr::GetAuctionDeposit( auctionHouseEntry, etime, it ); @@ -248,7 +248,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) uint32 auction_time = uint32(etime * sWorld.getRate(RATE_AUCTION_TIME)); AuctionEntry *AH = new AuctionEntry; - AH->Id = objmgr.GenerateAuctionID(); + AH->Id = sObjectMgr.GenerateAuctionID(); AH->auctioneer = GUID_LOPART(auctioneer); AH->item_guidlow = GUID_LOPART(item); AH->item_template = it->GetEntry(); @@ -264,7 +264,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, auction_time, AH->GetHouseId()); auctionHouse->AddAuction(AH); - auctionmgr.AddAItem(it); + sAuctionMgr.AddAItem(it); pl->MoveItemFromInventory( it->GetBagSlot(), it->GetSlot(), true); CharacterDatabase.BeginTransaction(); @@ -300,7 +300,7 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); + AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() ); AuctionEntry *auction = auctionHouse->GetAuction(auctionId); Player *pl = GetPlayer(); @@ -313,8 +313,8 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data ) } // impossible have online own another character (use this for speedup check in case online owner) - Player* auction_owner = objmgr.GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)); - if( !auction_owner && objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId()) + Player* auction_owner = sObjectMgr.GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)); + if( !auction_owner && sObjectMgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId()) { //you cannot bid your another character auction: SendAuctionCommandResult( 0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR ); @@ -387,13 +387,13 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data ) auction->bid = auction->buyout; GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout); - auctionmgr.SendAuctionSalePendingMail( auction ); - auctionmgr.SendAuctionSuccessfulMail( auction ); - auctionmgr.SendAuctionWonMail( auction ); + sAuctionMgr.SendAuctionSalePendingMail( auction ); + sAuctionMgr.SendAuctionSuccessfulMail( auction ); + sAuctionMgr.SendAuctionWonMail( auction ); SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK); - auctionmgr.RemoveAItem(auction->item_guidlow); + sAuctionMgr.RemoveAItem(auction->item_guidlow); auctionHouse->RemoveAuction(auction->Id); auction->DeleteFromDB(); @@ -424,14 +424,14 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); + AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() ); AuctionEntry *auction = auctionHouse->GetAuction(auctionId); Player *pl = GetPlayer(); if (auction && auction->owner == pl->GetGUIDLow()) { - Item *pItem = auctionmgr.GetAItem(auction->item_guidlow); + Item *pItem = sAuctionMgr.GetAItem(auction->item_guidlow); if (pItem) { if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid @@ -474,7 +474,7 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data ) auction->DeleteFromDB(); pl->SaveInventoryAndGoldToDB(); CharacterDatabase.CommitTransaction(); - auctionmgr.RemoveAItem( auction->item_guidlow ); + sAuctionMgr.RemoveAItem( auction->item_guidlow ); auctionHouse->RemoveAuction( auction->Id ); delete auction; } @@ -506,7 +506,7 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); + AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() ); WorldPacket data( SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4) ); Player *pl = GetPlayer(); @@ -553,7 +553,7 @@ void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); + AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() ); WorldPacket data( SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4) ); data << (uint32) 0; // amount place holder @@ -597,7 +597,7 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); + AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap( pCreature->getFaction() ); //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index 1d84ad4cc..f0c917ecb 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -79,7 +79,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction ) return; uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - Player *bidder = objmgr.GetPlayer(bidder_guid); + Player *bidder = sObjectMgr.GetPlayer(bidder_guid); uint32 bidder_accId = 0; @@ -96,30 +96,30 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction ) } else { - bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid); + bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); bidder_security = accmgr.GetSecurity(bidder_accId); if(bidder_security > SEC_PLAYER ) // not do redundant DB requests { - if(!objmgr.GetPlayerNameByGUID(bidder_guid,bidder_name)) - bidder_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); + if(!sObjectMgr.GetPlayerNameByGUID(bidder_guid,bidder_name)) + bidder_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); } } if( bidder_security > SEC_PLAYER ) { std::string owner_name; - if(!objmgr.GetPlayerNameByGUID(auction->owner,owner_name)) - owner_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); + if(!sObjectMgr.GetPlayerNameByGUID(auction->owner,owner_name)) + owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); - uint32 owner_accid = objmgr.GetPlayerAccountIdByGUID(auction->owner); + uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(auction->owner); sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)", bidder_name.c_str(),bidder_accId,pItem->GetProto()->Name1,pItem->GetEntry(),pItem->GetCount(),auction->bid,owner_name.c_str(),owner_accid); } } else if(!bidder) - bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid); + bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); // receiver exist if(bidder || bidder_accId) @@ -134,7 +134,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction ) sLog.outDebug( "AuctionWon body string : %s", msgAuctionWonBody.str().c_str() ); //prepare mail data... : - uint32 itemTextId = objmgr.CreateItemText( msgAuctionWonBody.str() ); + uint32 itemTextId = sObjectMgr.CreateItemText( msgAuctionWonBody.str() ); // set owner to bidder (to prevent delete item with sender char deleting) // owner in `data` will set at mail receive and item extracting @@ -163,10 +163,10 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction ) void AuctionHouseMgr::SendAuctionSalePendingMail( AuctionEntry * auction ) { uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); - Player *owner = objmgr.GetPlayer(owner_guid); + Player *owner = sObjectMgr.GetPlayer(owner_guid); // owner exist (online or offline) - if(owner || objmgr.GetPlayerAccountIdByGUID(owner_guid)) + if(owner || sObjectMgr.GetPlayerAccountIdByGUID(owner_guid)) { std::ostringstream msgAuctionSalePendingSubject; msgAuctionSalePendingSubject << auction->item_template << ":0:" << AUCTION_SALE_PENDING; @@ -184,7 +184,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail( AuctionEntry * auction ) sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); - uint32 itemTextId = objmgr.CreateItemText( msgAuctionSalePendingBody.str() ); + uint32 itemTextId = sObjectMgr.CreateItemText( msgAuctionSalePendingBody.str() ); MailDraft(msgAuctionSalePendingSubject.str(), itemTextId) .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_AUCTION); @@ -195,11 +195,11 @@ void AuctionHouseMgr::SendAuctionSalePendingMail( AuctionEntry * auction ) void AuctionHouseMgr::SendAuctionSuccessfulMail( AuctionEntry * auction ) { uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); - Player *owner = objmgr.GetPlayer(owner_guid); + Player *owner = sObjectMgr.GetPlayer(owner_guid); uint32 owner_accId = 0; if(!owner) - owner_accId = objmgr.GetPlayerAccountIdByGUID(owner_guid); + owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid); // owner exist if(owner || owner_accId) @@ -217,7 +217,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail( AuctionEntry * auction ) sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); - uint32 itemTextId = objmgr.CreateItemText( auctionSuccessfulBody.str() ); + uint32 itemTextId = sObjectMgr.CreateItemText( auctionSuccessfulBody.str() ); uint32 profit = auction->bid + auction->deposit - auctionCut; @@ -246,11 +246,11 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction ) } uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); - Player *owner = objmgr.GetPlayer(owner_guid); + Player *owner = sObjectMgr.GetPlayer(owner_guid); uint32 owner_accId = 0; if(!owner) - owner_accId = objmgr.GetPlayerAccountIdByGUID(owner_guid); + owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid); // owner exist if(owner || owner_accId) @@ -388,7 +388,7 @@ void AuctionHouseMgr::LoadAuctions() aItem->startbid = fields[9].GetUInt32(); aItem->deposit = fields[10].GetUInt32(); - CreatureData const* auctioneerData = objmgr.GetCreatureData(aItem->auctioneer); + CreatureData const* auctioneerData = sObjectMgr.GetCreatureData(aItem->auctioneer); if(!auctioneerData) { aItem->DeleteFromDB(); @@ -514,7 +514,7 @@ void AuctionHouseObject::Update() ///- Either cancel the auction if there was no bidder if (itr->second->bidder == 0) { - auctionmgr.SendAuctionExpiredMail( itr->second ); + sAuctionMgr.SendAuctionExpiredMail( itr->second ); } ///- Or perform the transaction else @@ -522,13 +522,13 @@ void AuctionHouseObject::Update() //we should send an "item sold" message if the seller is online //we send the item to the winner //we send the money to the seller - auctionmgr.SendAuctionSuccessfulMail( itr->second ); - auctionmgr.SendAuctionWonMail( itr->second ); + sAuctionMgr.SendAuctionSuccessfulMail( itr->second ); + sAuctionMgr.SendAuctionWonMail( itr->second ); } ///- In any case clear the auction itr->second->DeleteFromDB(); - auctionmgr.RemoveAItem(itr->second->item_guidlow); + sAuctionMgr.RemoveAItem(itr->second->item_guidlow); delete itr->second; RemoveAuction(itr->first); } @@ -573,7 +573,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr) { AuctionEntry *Aentry = itr->second; - Item *item = auctionmgr.GetAItem(Aentry->item_guidlow); + Item *item = sAuctionMgr.GetAItem(Aentry->item_guidlow); if (!item) continue; @@ -604,7 +604,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player // local name if ( loc_idx >= 0 ) { - ItemLocale const *il = objmgr.GetItemLocale(proto->ItemId); + ItemLocale const *il = sObjectMgr.GetItemLocale(proto->ItemId); if (il) { if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) @@ -627,7 +627,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player //this function inserts to WorldPacket auction's data bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const { - Item *pItem = auctionmgr.GetAItem(item_guidlow); + Item *pItem = sAuctionMgr.GetAItem(item_guidlow); if (!pItem) { sLog.outError("auction to item, that doesn't exist !!!!"); diff --git a/src/game/AuctionHouseMgr.h b/src/game/AuctionHouseMgr.h index 2775838d9..fbcba207f 100644 --- a/src/game/AuctionHouseMgr.h +++ b/src/game/AuctionHouseMgr.h @@ -160,6 +160,6 @@ class AuctionHouseMgr ItemMap mAitems; }; -#define auctionmgr MaNGOS::Singleton::Instance() +#define sAuctionMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 1480bc769..9517b206a 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -42,7 +42,7 @@ namespace MaNGOS : i_msgtype(msgtype), i_textId(textId), i_source(source), i_args(args) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); if (i_args) { @@ -87,7 +87,7 @@ namespace MaNGOS : i_language(language), i_textId(textId), i_source(source), i_args(args) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); if(i_args) { @@ -134,9 +134,9 @@ namespace MaNGOS : i_msgtype(msgtype), i_textId(textId), i_source(source), i_arg1(arg1), i_arg2(arg2) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); - char const* arg1str = i_arg1 ? objmgr.GetMangosString(i_arg1,loc_idx) : ""; - char const* arg2str = i_arg2 ? objmgr.GetMangosString(i_arg2,loc_idx) : ""; + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); + char const* arg1str = i_arg1 ? sObjectMgr.GetMangosString(i_arg1,loc_idx) : ""; + char const* arg2str = i_arg2 ? sObjectMgr.GetMangosString(i_arg2,loc_idx) : ""; char str [2048]; snprintf(str,2048,text, arg1str, arg2str ); @@ -168,9 +168,9 @@ namespace MaNGOS : i_language(language), i_textId(textId), i_source(source), i_arg1(arg1), i_arg2(arg2) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); - char const* arg1str = i_arg1 ? objmgr.GetMangosString(i_arg1,loc_idx) : ""; - char const* arg2str = i_arg2 ? objmgr.GetMangosString(i_arg2,loc_idx) : ""; + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); + char const* arg1str = i_arg1 ? sObjectMgr.GetMangosString(i_arg1,loc_idx) : ""; + char const* arg2str = i_arg2 ? sObjectMgr.GetMangosString(i_arg2,loc_idx) : ""; char str [2048]; snprintf(str,2048,text, arg1str, arg2str ); @@ -455,7 +455,7 @@ void BattleGround::Update(uint32 diff) //TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START); for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player *plr = objmgr.GetPlayer(itr->first)) + if (Player *plr = sObjectMgr.GetPlayer(itr->first)) plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); CheckArenaWinConditions(); @@ -466,7 +466,7 @@ void BattleGround::Update(uint32 diff) PlaySoundToAll(SOUND_BG_START); for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player* plr = objmgr.GetPlayer(itr->first)) + if (Player* plr = sObjectMgr.GetPlayer(itr->first)) plr->RemoveAurasDueToSpell(SPELL_PREPARATION); //Announce BG starting if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) @@ -517,7 +517,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (plr) plr->GetSession()->SendPacket(packet); else @@ -529,7 +529,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player * { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { @@ -561,7 +561,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { @@ -584,7 +584,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { @@ -604,7 +604,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) { for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { @@ -629,7 +629,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr) { @@ -698,8 +698,8 @@ void BattleGround::EndBattleGround(uint32 winner) // arena rating calculation if (isArena() && isRated()) { - winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner)); - loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner))); + winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner)); + loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner))); if (winner_arena_team && loser_arena_team) { loser_rating = loser_arena_team->GetStats().rating; @@ -719,7 +719,7 @@ void BattleGround::EndBattleGround(uint32 winner) for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); uint32 team = itr->second.Team; if (!plr) @@ -937,7 +937,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) std::string subject = markProto->Name1; int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0 ) - if (ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId)) + if (ItemLocale const *il = sObjectMgr.GetItemLocale(markProto->ItemId)) if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) subject = il->Name[loc_idx]; @@ -945,7 +945,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) std::string textFormat = plr->GetSession()->GetMangosString(LANG_BG_MARK_BY_MAIL); char textBuf[300]; snprintf(textBuf,300,textFormat.c_str(),GetName(),GetName()); - uint32 itemTextId = objmgr.CreateItemText( textBuf ); + uint32 itemTextId = sObjectMgr.CreateItemText( textBuf ); MailDraft(subject, itemTextId) .AddItem(markItem) @@ -1003,7 +1003,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac m_PlayerScores.erase(itr2); } - Player *plr = objmgr.GetPlayer(guid); + Player *plr = sObjectMgr.GetPlayer(guid); // should remove spirit of redemption if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) @@ -1040,8 +1040,8 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (isRated() && GetStatus() == STATUS_IN_PROGRESS) { //left a rated match while the encounter was in progress, consider as loser - ArenaTeam * winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); - ArenaTeam * loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team)); + ArenaTeam * winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); + ArenaTeam * loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team)); if (winner_arena_team && loser_arena_team) loser_arena_team->MemberLost(plr,winner_arena_team->GetRating()); } @@ -1062,8 +1062,8 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (isRated() && GetStatus() == STATUS_IN_PROGRESS) { //left a rated match while the encounter was in progress, consider as loser - ArenaTeam * others_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); - ArenaTeam * players_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team)); + ArenaTeam * others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); + ArenaTeam * players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team)); if (others_arena_team && players_arena_team) players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating()); } @@ -1384,7 +1384,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created // so we must create it specific for this instance GameObject * go = new GameObject; - if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(), + if(!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(), PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY)) { sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry); @@ -1397,7 +1397,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float // without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata // iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed - GameObjectData& data = objmgr.NewGOData(guid); + GameObjectData& data = sObjectMgr.NewGOData(guid); data.id = entry; data.mapid = GetMapId(); @@ -1727,7 +1727,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer ) for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); if (!plr || plr == killer) continue; @@ -1784,7 +1784,7 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const { if (itr->second.Team == Team) { - Player * pl = objmgr.GetPlayer(itr->first); + Player * pl = sObjectMgr.GetPlayer(itr->first); if (pl && pl->isAlive()) ++count; } @@ -1810,7 +1810,7 @@ void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid ) WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player ) { - return objmgr.GetClosestGraveYard( player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam() ); + return sObjectMgr.GetClosestGraveYard( player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam() ); } bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index cab99dec5..8f5999109 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -131,7 +131,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() uint8 j = 0; while (j < m_PlayersNearPoint[BG_EY_NODES_MAX].size()) { - Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[BG_EY_NODES_MAX][j]); + Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_NODES_MAX][j]); if (!plr) { sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[BG_EY_NODES_MAX][j])); @@ -167,7 +167,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() uint8 j = 0; while (j < m_PlayersNearPoint[i].size()) { - Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[i][j]); + Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]); if (!plr) { sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); @@ -222,7 +222,7 @@ void BattleGroundEY::UpdatePointStatuses() for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i) { - Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]); + Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[point][i]); if (plr) { UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 868f5b9d9..903a5de89 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -205,11 +205,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv uint32 count1 = 0; //always constant zero? uint32 count2 = 0; //count of next fields - Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID()); + Player *ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID()); if (ali_plr) ++count2; - Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID()); + Player *horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID()); if (horde_plr) ++count2; @@ -467,7 +467,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) // if player leaves rated arena match before match start, it is counted as he played but he lost if (isRated) { - ArenaTeam * at = objmgr.GetArenaTeamById(team); + ArenaTeam * at = sObjectMgr.GetArenaTeamById(team); if (at) { sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating); @@ -698,7 +698,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) { ateamId = _player->GetArenaTeamId(arenaslot); // check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice) - ArenaTeam * at = objmgr.GetArenaTeamById(ateamId); + ArenaTeam * at = sObjectMgr.GetArenaTeamById(ateamId); if (!at) { _player->GetSession()->SendNotInArenaTeamPacket(arenatype); @@ -770,7 +770,7 @@ void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) { uint64 playerGuid; recv_data >> playerGuid; - Player *reportedPlayer = objmgr.GetPlayer(playerGuid); + Player *reportedPlayer = sObjectMgr.GetPlayer(playerGuid); if (!reportedPlayer) { diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index d57cc39ea..2f23cbd5e 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -247,7 +247,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueue //remove player from queue and from group info, if group info is empty then remove it too void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount) { - //Player *plr = objmgr.GetPlayer(guid); + //Player *plr = sObjectMgr.GetPlayer(guid); int32 queue_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; @@ -322,11 +322,11 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou //if player leaves queue and he is invited to rated arena match, then he have to loose if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount) { - ArenaTeam * at = objmgr.GetArenaTeamById(group->ArenaTeamId); + ArenaTeam * at = sObjectMgr.GetArenaTeamById(group->ArenaTeamId); if (at) { sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating); - Player *plr = objmgr.GetPlayer(guid); + Player *plr = sObjectMgr.GetPlayer(guid); if (plr) at->MemberLost(plr, group->OpponentsTeamRating); else @@ -348,7 +348,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou { // remove next player, this is recursive // first send removal information - if (Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first)) + if (Player *plr2 = sObjectMgr.GetPlayer(group->Players.begin()->first)) { BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType); @@ -386,7 +386,7 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe { if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) { - Player *plr = objmgr.GetPlayer(playerGUID); + Player *plr = sObjectMgr.GetPlayer(playerGUID); BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId); if (!bg || !plr) return; @@ -446,7 +446,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b for(std::map::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) { // get the player - Player* plr = objmgr.GetPlayer(itr->first); + Player* plr = sObjectMgr.GetPlayer(itr->first); // if offline, skip him, this should not happen - player is removed from queue when he logs out if (!plr) continue; @@ -1009,7 +1009,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - Player* plr = objmgr.GetPlayer( m_PlayerGuid ); + Player* plr = sObjectMgr.GetPlayer( m_PlayerGuid ); // player logged off (we should do nothing, he is correctly removed from queue in another procedure) if (!plr) return true; @@ -1054,7 +1054,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/) */ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - Player* plr = objmgr.GetPlayer( m_PlayerGuid ); + Player* plr = sObjectMgr.GetPlayer( m_PlayerGuid ); if (!plr) // player logged off (we should do nothing, he is correctly removed from queue in another procedure) return true; @@ -1332,7 +1332,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) for(int i = 1; i >= 0; --i) { uint32 at_id = bg->m_ArenaTeamIds[i]; - ArenaTeam * at = objmgr.GetArenaTeamById(at_id); + ArenaTeam * at = sObjectMgr.GetArenaTeamById(at_id); if (at) *data << at->GetName(); else @@ -1364,7 +1364,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) } else { - Player *plr = objmgr.GetPlayer(itr->first); + Player *plr = sObjectMgr.GetPlayer(itr->first); uint32 team = bg->GetPlayerTeam(itr->first); if (!team && plr) team = plr->GetTeam(); @@ -1597,7 +1597,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI } // generate a new instance id - bg->SetInstanceID(mapmgr.GenerateInstanceId()); // set instance id + bg->SetInstanceID(sMapMgr.GenerateInstanceId()); // set instance id bg->SetClientInstanceID(CreateClientVisibleInstanceId(bgTypeId, queue_id)); // reset the new bg (set status to status_wait_queue from status_none) @@ -1807,7 +1807,7 @@ void BattleGroundMgr::DistributeArenaPoints() std::map PlayerPoints; //at first update all points for all team members - for(ObjectMgr::ArenaTeamMap::iterator team_itr = objmgr.GetArenaTeamMapBegin(); team_itr != objmgr.GetArenaTeamMapEnd(); ++team_itr) + for(ObjectMgr::ArenaTeamMap::iterator team_itr = sObjectMgr.GetArenaTeamMapBegin(); team_itr != sObjectMgr.GetArenaTeamMapEnd(); ++team_itr) { if (ArenaTeam * at = team_itr->second) { @@ -1821,7 +1821,7 @@ void BattleGroundMgr::DistributeArenaPoints() //update to database CharacterDatabase.PExecute("UPDATE characters SET arena_pending_points = '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first); //add points if player is online - Player* pl = objmgr.GetPlayer(plr_itr->first); + Player* pl = sObjectMgr.GetPlayer(plr_itr->first); if (pl) pl->ModifyArenaPoints(plr_itr->second); } @@ -1831,7 +1831,7 @@ void BattleGroundMgr::DistributeArenaPoints() sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END); sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START); - for(ObjectMgr::ArenaTeamMap::iterator titr = objmgr.GetArenaTeamMapBegin(); titr != objmgr.GetArenaTeamMapEnd(); ++titr) + for(ObjectMgr::ArenaTeamMap::iterator titr = sObjectMgr.GetArenaTeamMapBegin(); titr != sObjectMgr.GetArenaTeamMapEnd(); ++titr) { if (ArenaTeam * at = titr->second) { diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index e0fca88c6..026c2eae2 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -77,7 +77,7 @@ void Channel::Join(uint64 p, const char *pass) return; } - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if(plr) { @@ -135,7 +135,7 @@ void Channel::Leave(uint64 p, bool send) } else { - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if(send) { @@ -170,7 +170,7 @@ void Channel::Leave(uint64 p, bool send) void Channel::KickOrBan(uint64 good, const char *badname, bool ban) { AccountTypes sec = SEC_PLAYER; - Player *gplr = objmgr.GetPlayer(good); + Player *gplr = sObjectMgr.GetPlayer(good); if(gplr) sec = gplr->GetSession()->GetSecurity(); @@ -188,7 +188,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) } else { - Player *bad = objmgr.GetPlayer(badname); + Player *bad = sObjectMgr.GetPlayer(badname); if(bad == NULL || !IsOn(bad->GetGUID())) { WorldPacket data; @@ -231,7 +231,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) void Channel::UnBan(uint64 good, const char *badname) { uint32 sec = 0; - Player *gplr = objmgr.GetPlayer(good); + Player *gplr = sObjectMgr.GetPlayer(good); if(gplr) sec = gplr->GetSession()->GetSecurity(); @@ -249,7 +249,7 @@ void Channel::UnBan(uint64 good, const char *badname) } else { - Player *bad = objmgr.GetPlayer(badname); + Player *bad = sObjectMgr.GetPlayer(badname); if(bad == NULL || !IsBanned(bad->GetGUID())) { WorldPacket data; @@ -270,7 +270,7 @@ void Channel::UnBan(uint64 good, const char *badname) void Channel::Password(uint64 p, const char *pass) { uint32 sec = 0; - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); @@ -298,7 +298,7 @@ void Channel::Password(uint64 p, const char *pass) void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) { - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if (!plr) return; @@ -318,7 +318,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) } else { - Player *newp = objmgr.GetPlayer(p2n); + Player *newp = sObjectMgr.GetPlayer(p2n); if(!newp) { WorldPacket data; @@ -367,7 +367,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) void Channel::SetOwner(uint64 p, const char *newname) { - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if (!plr) return; @@ -389,7 +389,7 @@ void Channel::SetOwner(uint64 p, const char *newname) return; } - Player *newp = objmgr.GetPlayer(newname); + Player *newp = sObjectMgr.GetPlayer(newname); if(newp == NULL || !IsOn(newp->GetGUID())) { WorldPacket data; @@ -451,7 +451,7 @@ void Channel::List(Player* player) uint32 count = 0; for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - Player *plr = objmgr.GetPlayer(i->first); + Player *plr = sObjectMgr.GetPlayer(i->first); // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all @@ -473,7 +473,7 @@ void Channel::List(Player* player) void Channel::Announce(uint64 p) { uint32 sec = 0; - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); @@ -505,7 +505,7 @@ void Channel::Announce(uint64 p) void Channel::Moderate(uint64 p) { uint32 sec = 0; - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); @@ -542,7 +542,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang) lang = LANG_UNIVERSAL; uint32 sec = 0; - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if(plr) sec = plr->GetSession()->GetSecurity(); @@ -593,7 +593,7 @@ void Channel::Invite(uint64 p, const char *newname) return; } - Player *newp = objmgr.GetPlayer(newname); + Player *newp = sObjectMgr.GetPlayer(newname); if(!newp) { WorldPacket data; @@ -602,7 +602,7 @@ void Channel::Invite(uint64 p, const char *newname) return; } - Player *plr = objmgr.GetPlayer(p); + Player *plr = sObjectMgr.GetPlayer(p); if (!plr) return; @@ -665,7 +665,7 @@ void Channel::SendToAll(WorldPacket *data, uint64 p) { for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - Player *plr = objmgr.GetPlayer(i->first); + Player *plr = sObjectMgr.GetPlayer(i->first); if(plr) { if(!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p))) @@ -680,7 +680,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who) { if(i->first != who) { - Player *plr = objmgr.GetPlayer(i->first); + Player *plr = sObjectMgr.GetPlayer(i->first); if(plr) plr->GetSession()->SendPacket(data); } @@ -689,7 +689,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who) void Channel::SendToOne(WorldPacket *data, uint64 who) { - Player *plr = objmgr.GetPlayer(who); + Player *plr = sObjectMgr.GetPlayer(who); if(plr) plr->GetSession()->SendPacket(data); } @@ -793,7 +793,7 @@ void Channel::MakeChannelOwner(WorldPacket *data) { std::string name = ""; - if(!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty()) + if(!sObjectMgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty()) name = "PLAYER_NOT_FOUND"; MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE); diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 2a9574cf2..815a48c5e 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -255,14 +255,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } - if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(name)) + if (GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(name)) { data << (uint8)CHAR_NAME_RESERVED; SendPacket( &data ); return; } - if (objmgr.GetPlayerGUIDByName(name)) + if (sObjectMgr.GetPlayerGUIDByName(name)) { data << (uint8)CHAR_CREATE_NAME_IN_USE; SendPacket( &data ); @@ -432,7 +432,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) recv_data >> hairStyle >> hairColor >> facialHair >> outfitId; Player *pNewChar = new Player(this); - if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId )) + if(!pNewChar->Create( sObjectMgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId )) { // Player not create (race/class problem?) delete pNewChar; @@ -469,14 +469,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) recv_data >> guid; // can't delete loaded character - if(objmgr.GetPlayer(guid)) + if(sObjectMgr.GetPlayer(guid)) return; uint32 accountId = 0; std::string name; // is guild leader - if(objmgr.GetGuildByLeader(guid)) + if(sObjectMgr.GetGuildByLeader(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER; @@ -485,7 +485,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) } // is arena team captain - if(objmgr.GetArenaTeamByCaptain(guid)) + if(sObjectMgr.GetArenaTeamByCaptain(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN; @@ -637,7 +637,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) if(pCurrChar->GetGuildId() != 0) { - Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId()); + Guild* guild = sObjectMgr.GetGuildById(pCurrChar->GetGuildId()); if(guild) { data.Initialize(SMSG_GUILD_EVENT, (2+guild->GetMOTD().size()+1)); @@ -692,14 +692,14 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) if (!pCurrChar->GetMap()->Add(pCurrChar)) { - AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId()); + AreaTrigger const* at = sObjectMgr.GetGoBackTrigger(pCurrChar->GetMapId()); if(at) pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation()); else pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation()); } - objaccessor.AddObject(pCurrChar); + sObjectAccessor.AddObject(pCurrChar); //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName()); pCurrChar->SendInitialPacketsAfterAddToMap(); @@ -918,7 +918,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(newname)) + if (GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(CHAR_NAME_RESERVED); @@ -981,7 +981,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) // not accept declined names for unsupported languages std::string name; - if(!objmgr.GetPlayerNameByGUID(guid, name)) + if(!sObjectMgr.GetPlayerNameByGUID(guid, name)) { WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); data << uint32(1); @@ -1181,7 +1181,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(newname)) + if (GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_NAME_RESERVED); @@ -1190,7 +1190,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) } // character with this name already exist - if (uint64 newguid = objmgr.GetPlayerGUIDByName(newname)) + if (uint64 newguid = sObjectMgr.GetPlayerGUIDByName(newname)) { if (newguid != guid) { diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 781ef878e..20473b17e 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -698,7 +698,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong) if (target) target_session = target->GetSession(); else if (guid) - target_account = objmgr.GetPlayerAccountIdByGUID(guid); + target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid); if(!target_session && !target_account) { @@ -1243,7 +1243,7 @@ valid examples: c = reader.peek(); } - linkedQuest = objmgr.GetQuestTemplate(questid); + linkedQuest = sObjectMgr.GetQuestTemplate(questid); if(!linkedQuest) { @@ -1414,7 +1414,7 @@ valid examples: if (linkedSpell->Attributes & SPELL_ATTR_TRADESPELL) { // lookup skillid - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(linkedSpell->Id); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(linkedSpell->Id); if (bounds.first == bounds.second) { return false; @@ -1461,7 +1461,7 @@ valid examples: { if (linkedQuest->GetTitle() != buffer) { - QuestLocale const *ql = objmgr.GetQuestLocale(linkedQuest->GetQuestId()); + QuestLocale const *ql = sObjectMgr.GetQuestLocale(linkedQuest->GetQuestId()); if (!ql) { @@ -1502,12 +1502,12 @@ valid examples: if (expectedName != buffer) { - ItemLocale const *il = objmgr.GetItemLocale(linkedItem->ItemId); + ItemLocale const *il = sObjectMgr.GetItemLocale(linkedItem->ItemId); bool foundName = false; for(uint8 i=LOCALE_koKR; i= il->Name.size()) // using strange database/client combinations can lead to this case expectedName = linkedItem->Name1; @@ -1758,7 +1758,7 @@ Player * ChatHandler::getSelectedPlayer() if (guid == 0) return m_session->GetPlayer(); - return objmgr.GetPlayer(guid); + return sObjectMgr.GetPlayer(guid); } Unit* ChatHandler::getSelectedUnit() @@ -1935,7 +1935,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); - if(!obj && objmgr.GetGOData(lowguid)) // guid is DB guid of object + if(!obj && sObjectMgr.GetGOData(lowguid)) // guid is DB guid of object { // search near player then CellPair p(MaNGOS::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); @@ -2036,9 +2036,9 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text) // id case (explicit or from shift link) if(cId[0] >= '0' || cId[0] >= '9') if(uint32 id = atoi(cId)) - return objmgr.GetGameTele(id); + return sObjectMgr.GetGameTele(id); - return objmgr.GetGameTele(cId); + return sObjectMgr.GetGameTele(cId); } enum GuidLinkType @@ -2075,10 +2075,10 @@ uint64 ChatHandler::extractGuidFromLink(char* text) if(!normalizePlayerName(name)) return 0; - if(Player* player = objmgr.GetPlayer(name.c_str())) + if(Player* player = sObjectMgr.GetPlayer(name.c_str())) return player->GetGUID(); - if(uint64 guid = objmgr.GetPlayerGUIDByName(name)) + if(uint64 guid = sObjectMgr.GetPlayerGUIDByName(name)) return guid; return 0; @@ -2087,7 +2087,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text) { uint32 lowguid = (uint32)atol(idS); - if(CreatureData const* data = objmgr.GetCreatureData(lowguid) ) + if(CreatureData const* data = sObjectMgr.GetCreatureData(lowguid) ) return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT); else return 0; @@ -2096,7 +2096,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text) { uint32 lowguid = (uint32)atol(idS); - if(GameObjectData const* data = objmgr.GetGOData(lowguid) ) + if(GameObjectData const* data = sObjectMgr.GetGOData(lowguid) ) return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_GAMEOBJECT); else return 0; @@ -2133,14 +2133,14 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe return false; } - Player* pl = objmgr.GetPlayer(name.c_str()); + Player* pl = sObjectMgr.GetPlayer(name.c_str()); // if allowed player pointer if(player) *player = pl; // if need guid value from DB (in name case for check player existence) - uint64 guid = !pl && (player_guid || player_name) ? objmgr.GetPlayerGUIDByName(name) : 0; + uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGUIDByName(name) : 0; // if allowed player guid (if no then only online players allowed) if(player_guid) @@ -2226,7 +2226,7 @@ int ChatHandler::GetSessionDbLocaleIndex() const const char *CliHandler::GetMangosString(int32 entry) const { - return objmgr.GetMangosStringForDBCLocale(entry); + return sObjectMgr.GetMangosStringForDBCLocale(entry); } bool CliHandler::isAvailable(ChatCommand const& cmd) const @@ -2258,5 +2258,5 @@ LocaleConstant CliHandler::GetSessionDbcLocale() const int CliHandler::GetSessionDbLocaleIndex() const { - return objmgr.GetDBCLocaleIndex(); + return sObjectMgr.GetDBCLocaleIndex(); } diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index edd647ee4..d043af46f 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -206,7 +206,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) break; } - Player *player = objmgr.GetPlayer(to.c_str()); + Player *player = sObjectMgr.GetPlayer(to.c_str()); uint32 tSecurity = GetSecurity(); uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER; if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers())) @@ -280,7 +280,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if (GetPlayer()->GetGuildId()) { - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if (guild) guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); } @@ -306,7 +306,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if (GetPlayer()->GetGuildId()) { - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if (guild) guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); } @@ -602,7 +602,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data ) recv_data >> iguid; recv_data >> unk; // probably related to spam reporting - Player *player = objmgr.GetPlayer(iguid); + Player *player = sObjectMgr.GetPlayer(iguid); if(!player || !player->GetSession()) return; diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index a5b6a73b6..e31a2d94f 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -50,7 +50,7 @@ void Corpse::AddToWorld() { ///- Register the corpse for guid lookup if(!IsInWorld()) - objaccessor.AddObject(this); + sObjectAccessor.AddObject(this); Object::AddToWorld(); } @@ -59,7 +59,7 @@ void Corpse::RemoveFromWorld() { ///- Remove the corpse from the accessor if(IsInWorld()) - objaccessor.RemoveObject(this); + sObjectAccessor.RemoveObject(this); Object::RemoveFromWorld(); } diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 975de602e..812def559 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -219,14 +219,14 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) // known valid are: CLASS_WARRIOR,CLASS_PALADIN,CLASS_ROGUE,CLASS_MAGE SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class)); - uint32 display_id = objmgr.ChooseDisplayId(team, GetCreatureInfo(), data); + uint32 display_id = sObjectMgr.ChooseDisplayId(team, GetCreatureInfo(), data); if (!display_id) // Cancel load if no display id { sLog.outErrorDb("Creature (Entry: %u) has model %u not found in table `creature_model_info`, can't load. ", Entry, display_id); return false; } - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (!minfo) // Cancel load if no model defined { sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ",Entry); @@ -369,9 +369,9 @@ void Creature::Update(uint32 diff) //Call AI respawn virtual function i_AI->JustRespawned(); - uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), GetTypeId()); + uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow(), GetTypeId()); if (poolid) - poolhandler.UpdatePool(poolid, GetGUIDLow(), TYPEID_UNIT); + sPoolMgr.UpdatePool(poolid, GetGUIDLow(), TYPEID_UNIT); else GetMap()->Add(this); } @@ -398,7 +398,7 @@ void Creature::Update(uint32 diff) } else { - Group* group = objmgr.GetGroupByLeader(lootingGroupLeaderGUID); + Group* group = sObjectMgr.GetGroupByLeader(lootingGroupLeaderGUID); if (group) group->EndRoll(); m_groupLootTimer = 0; @@ -761,7 +761,7 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) if(gso->Id==1) { uint32 textid=GetNpcTextId(); - GossipText const* gossiptext=objmgr.GetGossipText(textid); + GossipText const* gossiptext=sObjectMgr.GetGossipText(textid); if(!gossiptext) cantalking=false; } @@ -835,7 +835,7 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) int loc_idx = pPlayer->GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - NpcOptionLocale const *no = objmgr.GetNpcOptionLocale(gso->Id); + NpcOptionLocale const *no = sObjectMgr.GetNpcOptionLocale(gso->Id); if (no) { if (no->OptionText.size() > loc_idx && !no->OptionText[loc_idx].empty()) @@ -1031,7 +1031,7 @@ uint32 Creature::GetNpcTextId() if (!m_DBTableGuid) return DEFAULT_GOSSIP_MESSAGE; - if(uint32 pos = objmgr.GetNpcGossip(m_DBTableGuid)) + if(uint32 pos = sObjectMgr.GetNpcGossip(m_DBTableGuid)) return pos; return DEFAULT_GOSSIP_MESSAGE; @@ -1054,7 +1054,7 @@ void Creature::LoadGossipOptions() uint32 npcflags=GetUInt32Value(UNIT_NPC_FLAGS); - CacheNpcOptionList const& noList = objmgr.GetNpcOptions (); + CacheNpcOptionList const& noList = sObjectMgr.GetNpcOptions (); for (CacheNpcOptionList::const_iterator i = noList.begin (); i != noList.end (); ++i) if(i->NpcFlag & npcflags) addGossipOption(*i); @@ -1116,7 +1116,7 @@ void Creature::SaveToDB() { // this should only be used when the creature has already been loaded // preferably after adding to map, because mapid may not be valid otherwise - CreatureData const *data = objmgr.GetCreatureData(m_DBTableGuid); + CreatureData const *data = sObjectMgr.GetCreatureData(m_DBTableGuid); if(!data) { sLog.outError("Creature::SaveToDB failed, cannot get creature data!"); @@ -1131,7 +1131,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) // update in loaded data if (!m_DBTableGuid) m_DBTableGuid = GetGUIDLow(); - CreatureData& data = objmgr.NewOrExistCreatureData(m_DBTableGuid); + CreatureData& data = sObjectMgr.NewOrExistCreatureData(m_DBTableGuid); uint32 displayId = GetNativeDisplayId(); @@ -1143,22 +1143,22 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) displayId != cinfo->DisplayID_H[0] && displayId != cinfo->DisplayID_H[1]) { if (cinfo->DisplayID_A[0]) - if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_A[0])) + if (CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelInfo(cinfo->DisplayID_A[0])) if(displayId == minfo->modelid_other_gender) displayId = 0; if (displayId && cinfo->DisplayID_A[1]) - if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_A[1])) + if (CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelInfo(cinfo->DisplayID_A[1])) if(displayId == minfo->modelid_other_gender) displayId = 0; if (displayId && cinfo->DisplayID_H[0]) - if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_H[0])) + if (CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelInfo(cinfo->DisplayID_H[0])) if(displayId == minfo->modelid_other_gender) displayId = 0; if (displayId && cinfo->DisplayID_H[1]) - if (CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_H[1])) + if (CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelInfo(cinfo->DisplayID_H[1])) if(displayId == minfo->modelid_other_gender) displayId = 0; } @@ -1345,7 +1345,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const bool Creature::LoadFromDB(uint32 guid, Map *map) { - CreatureData const* data = objmgr.GetCreatureData(guid); + CreatureData const* data = sObjectMgr.GetCreatureData(guid); if(!data) { @@ -1364,7 +1364,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) return false; } else - guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); + guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT); uint16 team = 0; if(!Create(guid,map,data->phaseMask,data->id,team,data)) @@ -1384,7 +1384,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) m_isDeadByDefault = data->is_dead; m_deathState = m_isDeadByDefault ? DEAD : ALIVE; - m_respawnTime = objmgr.GetCreatureRespawnTime(m_DBTableGuid,GetInstanceId()); + m_respawnTime = sObjectMgr.GetCreatureRespawnTime(m_DBTableGuid,GetInstanceId()); if(m_respawnTime > time(NULL)) // not ready to respawn { m_deathState = DEAD; @@ -1398,7 +1398,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) else if(m_respawnTime) // respawn time set but expired { m_respawnTime = 0; - objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); + sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); } uint32 curhealth = data->curhealth; @@ -1434,7 +1434,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) return; } - EquipmentInfo const *einfo = objmgr.GetEquipmentInfo(equip_entry); + EquipmentInfo const *einfo = sObjectMgr.GetEquipmentInfo(equip_entry); if (!einfo) return; @@ -1445,7 +1445,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) bool Creature::hasQuest(uint32 quest_id) const { - QuestRelations const& qr = objmgr.mCreatureQuestRelations; + QuestRelations const& qr = sObjectMgr.mCreatureQuestRelations; for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr) { if(itr->second==quest_id) @@ -1456,7 +1456,7 @@ bool Creature::hasQuest(uint32 quest_id) const bool Creature::hasInvolvedQuest(uint32 quest_id) const { - QuestRelations const& qr = objmgr.mCreatureQuestInvolvedRelations; + QuestRelations const& qr = sObjectMgr.mCreatureQuestInvolvedRelations; for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr) { if(itr->second==quest_id) @@ -1473,8 +1473,8 @@ void Creature::DeleteFromDB() return; } - objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); - objmgr.DeleteCreatureData(m_DBTableGuid); + sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); + sObjectMgr.DeleteCreatureData(m_DBTableGuid); WorldDatabase.BeginTransaction(); WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); @@ -1607,7 +1607,7 @@ void Creature::Respawn() if(getDeathState()==DEAD) { if (m_DBTableGuid) - objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); + sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0); m_respawnTime = time(NULL); // respawn at next tick } } @@ -1902,9 +1902,9 @@ void Creature::SaveRespawnTime() return; if(m_respawnTime > time(NULL)) // dead (no corpse) - objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); + sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); else if(m_deathTimer > 0) // dead (corpse) - objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS); + sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS); } bool Creature::IsOutOfThreatArea(Unit* pVictim) const @@ -2139,7 +2139,7 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* { if (m_DBTableGuid) { - if (CreatureData const* data = objmgr.GetCreatureData(GetDBTableGUIDLow())) + if (CreatureData const* data = sObjectMgr.GetCreatureData(GetDBTableGUIDLow())) { x = data->posX; y = data->posY; @@ -2203,7 +2203,7 @@ std::string Creature::GetAIName() const std::string Creature::GetScriptName() const { - return objmgr.GetScriptName(GetScriptId()); + return sObjectMgr.GetScriptName(GetScriptId()); } uint32 Creature::GetScriptId() const @@ -2213,7 +2213,7 @@ uint32 Creature::GetScriptId() const VendorItemData const* Creature::GetVendorItems() const { - return objmgr.GetNpcVendorItemList(GetEntry()); + return sObjectMgr.GetNpcVendorItemList(GetEntry()); } uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) @@ -2290,7 +2290,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us TrainerSpellData const* Creature::GetTrainerSpells() const { - return objmgr.GetNpcTrainerSpells(GetEntry()); + return sObjectMgr.GetNpcTrainerSpells(GetEntry()); } // overwrite WorldObject function for proper name localization @@ -2298,7 +2298,7 @@ const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const { if (loc_idx >= 0) { - CreatureLocale const *cl = objmgr.GetCreatureLocale(GetEntry()); + CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry()); if (cl) { if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty()) diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 87edbf125..078e4335a 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -55,8 +55,8 @@ int CreatureEventAI::Permissible(const Creature *creature) CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) { // Need make copy for filter unneeded steps and safe in case table reload - CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry()); - if (CreatureEvents != CreatureEAI_Mgr.GetCreatureEventAIMap().end()) + CreatureEventAI_Event_Map::const_iterator CreatureEvents = sEventAIMgr.GetCreatureEventAIMap().find(m_creature->GetEntry()); + if (CreatureEvents != sEventAIMgr.GetCreatureEventAIMap().end()) { std::vector::const_iterator i; for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i) @@ -406,7 +406,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId)) { - uint32 display_id = objmgr.ChooseDisplayId(0,ci); + uint32 display_id = sObjectMgr.ChooseDisplayId(0,ci); m_creature->SetDisplayId(display_id); } } @@ -672,8 +672,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker); - CreatureEventAI_Summon_Map::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId); - if (i == CreatureEAI_Mgr.GetCreatureEventAISummonMap().end()) + CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId); + if (i == sEventAIMgr.GetCreatureEventAISummonMap().end()) { sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry()); return; @@ -1259,9 +1259,9 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* return; } - CreatureEventAI_TextMap::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAITextMap().find(textEntry); + CreatureEventAI_TextMap::const_iterator i = sEventAIMgr.GetCreatureEventAITextMap().find(textEntry); - if (i == CreatureEAI_Mgr.GetCreatureEventAITextMap().end()) + if (i == sEventAIMgr.GetCreatureEventAITextMap().end()) { sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); return; diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index 5361073eb..d94ee1a12 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -36,7 +36,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use) m_CreatureEventAI_TextMap.clear(); // Load EventAI Text - objmgr.LoadMangosStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID); + sObjectMgr.LoadMangosStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID); // Gather Additional data from EventAI Texts QueryResult *result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts"); @@ -67,7 +67,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use) } // range negative (don't must be happen, loaded from same table) - if (!objmgr.GetMangosStringLocale(i)) + if (!sObjectMgr.GetMangosStringLocale(i)) { sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i); continue; @@ -411,7 +411,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case EVENT_T_QUEST_ACCEPT: case EVENT_T_QUEST_COMPLETE: - if (!objmgr.GetQuestTemplate(temp.quest.questId)) + if (!sObjectMgr.GetQuestTemplate(temp.quest.questId)) sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); sLog.outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); continue; @@ -619,7 +619,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent); break; case ACTION_T_QUEST_EVENT: - if (Quest const* qid = objmgr.GetQuestTemplate(action.quest_event.questId)) + if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event.questId)) { if (!qid->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId); @@ -661,7 +661,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step); break; case ACTION_T_QUEST_EVENT_ALL: - if (Quest const* qid = objmgr.GetQuestTemplate(action.quest_event_all.questId)) + if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId)) { if (!qid->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId); diff --git a/src/game/CreatureEventAIMgr.h b/src/game/CreatureEventAIMgr.h index 1345774e6..c8aed6687 100644 --- a/src/game/CreatureEventAIMgr.h +++ b/src/game/CreatureEventAIMgr.h @@ -45,5 +45,5 @@ class CreatureEventAIMgr CreatureEventAI_TextMap m_CreatureEventAI_TextMap; }; -#define CreatureEAI_Mgr MaNGOS::Singleton::Instance() +#define sEventAIMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/GMTicketHandler.cpp b/src/game/GMTicketHandler.cpp index 6c02aa842..a2868ad62 100644 --- a/src/game/GMTicketHandler.cpp +++ b/src/game/GMTicketHandler.cpp @@ -50,7 +50,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/ ) data << (uint32)0; SendPacket( &data ); - GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow()); + GMTicket* ticket = sTicketMgr.GetGMTicket(GetPlayer()->GetGUIDLow()); if(ticket) SendGMTicketGetTicket(0x06,ticket->GetText()); else @@ -62,7 +62,7 @@ void WorldSession::HandleGMTicketUpdateTextOpcode( WorldPacket & recv_data ) std::string ticketText; recv_data >> ticketText; - if(GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) + if(GMTicket* ticket = sTicketMgr.GetGMTicket(GetPlayer()->GetGUIDLow())) ticket->SetText(ticketText.c_str()); else sLog.outError("Ticket update: Player %s (GUID: %u) doesn't have active ticket", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); @@ -70,7 +70,7 @@ void WorldSession::HandleGMTicketUpdateTextOpcode( WorldPacket & recv_data ) void WorldSession::HandleGMTicketDeleteTicketOpcode( WorldPacket & /*recv_data*/ ) { - ticketmgr.Delete(GetPlayer()->GetGUIDLow()); + sTicketMgr.Delete(GetPlayer()->GetGUIDLow()); WorldPacket data( SMSG_GMTICKET_DELETETICKET, 4 ); data << uint32(9); @@ -95,7 +95,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) sLog.outDebug("TicketCreate: map %u, x %f, y %f, z %f, text %s", map, x, y, z, ticketText.c_str()); - if(ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) + if(sTicketMgr.GetGMTicket(GetPlayer()->GetGUIDLow())) { WorldPacket data( SMSG_GMTICKET_CREATE, 4 ); data << uint32(1); // 1 - You already have GM ticket @@ -103,7 +103,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) return; } - ticketmgr.Create(_player->GetGUIDLow(), ticketText.c_str()); + sTicketMgr.Create(_player->GetGUIDLow(), ticketText.c_str()); WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 ); data << (uint32)time(NULL); @@ -116,7 +116,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) DEBUG_LOG("update the ticket"); //TODO: Guard player map - HashMapHolder::MapType &m = objaccessor.GetPlayers(); + HashMapHolder::MapType &m = sObjectAccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets()) diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index 621c18b42..17ed65c7b 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -72,7 +72,7 @@ void GMTicketMgr::DeleteAll() { for(GMTicketMap::const_iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr) { - if(Player* owner = objmgr.GetPlayer(MAKE_NEW_GUID(itr->first,0,HIGHGUID_PLAYER))) + if(Player* owner = sObjectMgr.GetPlayer(MAKE_NEW_GUID(itr->first,0,HIGHGUID_PLAYER))) owner->GetSession()->SendGMTicketGetTicket(0x0A,0); } CharacterDatabase.PExecute("DELETE FROM character_ticket"); diff --git a/src/game/GMTicketMgr.h b/src/game/GMTicketMgr.h index 65487da0a..54e4df428 100644 --- a/src/game/GMTicketMgr.h +++ b/src/game/GMTicketMgr.h @@ -121,5 +121,5 @@ class GMTicketMgr GMTicketMap m_GMTicketMap; }; -#define ticketmgr MaNGOS::Singleton::Instance() +#define sTicketMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index a64596e8f..270942f05 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -305,7 +305,7 @@ void GameEventMgr::LoadFromDB() if(newModelEquipSet.equipment_id > 0) { - if(!objmgr.GetEquipmentInfo(newModelEquipSet.equipment_id)) + if(!sObjectMgr.GetEquipmentInfo(newModelEquipSet.equipment_id)) { sLog.outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", guid, newModelEquipSet.equipment_id); continue; @@ -399,7 +399,7 @@ void GameEventMgr::LoadFromDB() continue; } - if (!poolhandler.CheckPool(entry)) + if (!sPoolMgr.CheckPool(entry)) { sLog.outErrorDb("Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); continue; @@ -514,13 +514,13 @@ void GameEventMgr::GameEventSpawn(int16 event_id) for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();itr != mGameEventCreatureGuids[internal_event_id].end();++itr) { // Add to correct cell - CreatureData const* data = objmgr.GetCreatureData(*itr); + CreatureData const* data = sObjectMgr.GetCreatureData(*itr); if (data) { - objmgr.AddCreatureToGrid(*itr, data); + sObjectMgr.AddCreatureToGrid(*itr, data); // Spawn if necessary (loaded grids only) - Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); + Map* map = const_cast(sMapMgr.CreateBaseMap(data->mapid)); // We use spawn coords to spawn if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY)) { @@ -547,13 +547,13 @@ void GameEventMgr::GameEventSpawn(int16 event_id) for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();itr != mGameEventGameobjectGuids[internal_event_id].end();++itr) { // Add to correct cell - GameObjectData const* data = objmgr.GetGOData(*itr); + GameObjectData const* data = sObjectMgr.GetGOData(*itr); if (data) { - objmgr.AddGameobjectToGrid(*itr, data); + 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(mapmgr.CreateBaseMap(data->mapid)); + Map* map = const_cast(sMapMgr.CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { @@ -580,9 +580,9 @@ void GameEventMgr::GameEventSpawn(int16 event_id) for (IdList::iterator itr = mGameEventPoolIds[internal_event_id].begin();itr != mGameEventPoolIds[internal_event_id].end();++itr) { - poolhandler.SpawnPool(*itr, 0, 0); - poolhandler.SpawnPool(*itr, 0, TYPEID_GAMEOBJECT); - poolhandler.SpawnPool(*itr, 0, TYPEID_UNIT); + sPoolMgr.SpawnPool(*itr, 0, 0); + sPoolMgr.SpawnPool(*itr, 0, TYPEID_GAMEOBJECT); + sPoolMgr.SpawnPool(*itr, 0, TYPEID_UNIT); } } @@ -599,9 +599,9 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();itr != mGameEventCreatureGuids[internal_event_id].end();++itr) { // Remove the creature from grid - if( CreatureData const* data = objmgr.GetCreatureData(*itr) ) + if( CreatureData const* data = sObjectMgr.GetCreatureData(*itr) ) { - objmgr.RemoveCreatureFromGrid(*itr, data); + sObjectMgr.RemoveCreatureFromGrid(*itr, data); if( Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT)) ) pCreature->AddObjectToRemoveList(); @@ -617,9 +617,9 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();itr != mGameEventGameobjectGuids[internal_event_id].end();++itr) { // Remove the gameobject from grid - if(GameObjectData const* data = objmgr.GetGOData(*itr)) + if(GameObjectData const* data = sObjectMgr.GetGOData(*itr)) { - objmgr.RemoveGameobjectFromGrid(*itr, data); + sObjectMgr.RemoveGameobjectFromGrid(*itr, data); if( GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT)) ) pGameobject->AddObjectToRemoveList(); @@ -633,7 +633,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) for (IdList::iterator itr = mGameEventPoolIds[internal_event_id].begin();itr != mGameEventPoolIds[internal_event_id].end();++itr) { - poolhandler.DespawnPool(*itr); + sPoolMgr.DespawnPool(*itr); } } @@ -642,7 +642,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) for(ModelEquipList::iterator itr = mGameEventModelEquip[event_id].begin();itr != mGameEventModelEquip[event_id].end();++itr) { // Remove the creature from grid - CreatureData const* data = objmgr.GetCreatureData(itr->first); + CreatureData const* data = sObjectMgr.GetCreatureData(itr->first); if(!data) continue; @@ -657,7 +657,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) pCreature->LoadEquipment(itr->second.equipment_id, true); if (itr->second.modelid >0 && itr->second.modelid_prev != itr->second.modelid) { - CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(itr->second.modelid); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelInfo(itr->second.modelid); if (minfo) { pCreature->SetDisplayId(itr->second.modelid); @@ -672,7 +672,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) pCreature->LoadEquipment(itr->second.equipement_id_prev, true); if (itr->second.modelid_prev >0 && itr->second.modelid_prev != itr->second.modelid) { - CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(itr->second.modelid_prev); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelInfo(itr->second.modelid_prev); if (minfo) { pCreature->SetDisplayId(itr->second.modelid_prev); @@ -685,12 +685,12 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) } else // If not spawned { - CreatureData const* data2 = objmgr.GetCreatureData(itr->first); + CreatureData const* data2 = sObjectMgr.GetCreatureData(itr->first); if (data2 && activate) { CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(data2->id); - uint32 display_id = objmgr.ChooseDisplayId(0,cinfo,data2); - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); + uint32 display_id = sObjectMgr.ChooseDisplayId(0,cinfo,data2); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; @@ -703,7 +703,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) } // now last step: put in data // just to have write access to it - CreatureData& data2 = objmgr.NewOrExistCreatureData(itr->first); + CreatureData& data2 = sObjectMgr.NewOrExistCreatureData(itr->first); if (activate) { data2.displayid = itr->second.modelid; @@ -722,7 +722,7 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool Activate) QuestRelList::iterator itr; for (itr = mGameEventQuests[event_id].begin();itr != mGameEventQuests[event_id].end();++itr) { - QuestRelations &CreatureQuestMap = objmgr.mCreatureQuestRelations; + QuestRelations &CreatureQuestMap = sObjectMgr.mCreatureQuestRelations; if (Activate) // Add the pair(id,quest) to the multimap CreatureQuestMap.insert(QuestRelations::value_type(itr->first, itr->second)); else diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index fb01c983f..5dbd927b1 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -258,9 +258,9 @@ void GameObject::Update(uint32 /*p_time*/) return; } // respawn timer - uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT); + uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT); if (poolid) - poolhandler.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT); + sPoolMgr.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT); else GetMap()->Add(this); break; @@ -473,9 +473,9 @@ void GameObject::Delete() SetGoState(GO_STATE_READY); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); - uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT); + uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT); if (poolid) - poolhandler.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT); + sPoolMgr.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT); else AddObjectToRemoveList(); } @@ -497,7 +497,7 @@ void GameObject::SaveToDB() { // this should only be used when the gameobject has already been loaded // preferably after adding to map, because mapid may not be valid otherwise - GameObjectData const *data = objmgr.GetGOData(m_DBTableGuid); + GameObjectData const *data = sObjectMgr.GetGOData(m_DBTableGuid); if(!data) { sLog.outError("GameObject::SaveToDB failed, cannot get gameobject data!"); @@ -517,7 +517,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) if (!m_DBTableGuid) m_DBTableGuid = GetGUIDLow(); // update in loaded data (changing data only in this place) - GameObjectData& data = objmgr.NewGOData(m_DBTableGuid); + GameObjectData& data = sObjectMgr.NewGOData(m_DBTableGuid); // data->guid = guid don't must be update at save data.id = GetEntry(); @@ -564,7 +564,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) bool GameObject::LoadFromDB(uint32 guid, Map *map) { - GameObjectData const* data = objmgr.GetGOData(guid); + GameObjectData const* data = sObjectMgr.GetGOData(guid); if( !data ) { @@ -589,7 +589,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) GOState go_state = data->go_state; m_DBTableGuid = guid; - if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); + if (map->GetInstanceId() != 0) guid = sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state) ) return false; @@ -607,13 +607,13 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) { m_spawnedByDefault = true; m_respawnDelayTime = data->spawntimesecs; - m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId()); + m_respawnTime = sObjectMgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId()); // ready to respawn if(m_respawnTime && m_respawnTime <= time(NULL)) { m_respawnTime = 0; - objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); + sObjectMgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); } } else @@ -629,8 +629,8 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) void GameObject::DeleteFromDB() { - objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); - objmgr.DeleteGOData(m_DBTableGuid); + sObjectMgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); + sObjectMgr.DeleteGOData(m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM game_event_gameobject WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM gameobject_battleground WHERE guid = '%u'", m_DBTableGuid); @@ -646,7 +646,7 @@ GameObjectInfo const *GameObject::GetGOInfo() const /*********************************************************/ bool GameObject::hasQuest(uint32 quest_id) const { - QuestRelations const& qr = objmgr.mGOQuestRelations; + QuestRelations const& qr = sObjectMgr.mGOQuestRelations; for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr) { if(itr->second==quest_id) @@ -657,7 +657,7 @@ bool GameObject::hasQuest(uint32 quest_id) const bool GameObject::hasInvolvedQuest(uint32 quest_id) const { - QuestRelations const& qr = objmgr.mGOQuestInvolvedRelations; + QuestRelations const& qr = sObjectMgr.mGOQuestInvolvedRelations; for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr) { if(itr->second==quest_id) @@ -682,7 +682,7 @@ Unit* GameObject::GetOwner() const void GameObject::SaveRespawnTime() { if(m_respawnTime > time(NULL) && m_spawnedByDefault) - objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); + sObjectMgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); } bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const @@ -725,13 +725,13 @@ void GameObject::Respawn() if(m_spawnedByDefault && m_respawnTime > 0) { m_respawnTime = time(NULL); - objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); + sObjectMgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0); } } bool GameObject::ActivateToQuest( Player *pTarget)const { - if(!objmgr.IsGameObjectForQuests(GetEntry())) + if(!sObjectMgr.IsGameObjectForQuests(GetEntry())) return false; switch(GetGoType()) @@ -1012,9 +1012,9 @@ void GameObject::Use(Unit* user) uint32 zone, subzone; GetZoneAndAreaId(zone,subzone); - int32 zone_skill = objmgr.GetFishingBaseSkillLevel( subzone ); + int32 zone_skill = sObjectMgr.GetFishingBaseSkillLevel( subzone ); if(!zone_skill) - zone_skill = objmgr.GetFishingBaseSkillLevel( zone ); + zone_skill = sObjectMgr.GetFishingBaseSkillLevel( zone ); //provide error, no fishable zone or area should be 0 if(!zone_skill) @@ -1293,7 +1293,7 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const { if (loc_idx >= 0) { - GameObjectLocale const *cl = objmgr.GetGameObjectLocale(GetEntry()); + GameObjectLocale const *cl = sObjectMgr.GetGameObjectLocale(GetEntry()); if (cl) { if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty()) diff --git a/src/game/GlobalEvents.cpp b/src/game/GlobalEvents.cpp index 79dc9b7c1..97be1fda8 100644 --- a/src/game/GlobalEvents.cpp +++ b/src/game/GlobalEvents.cpp @@ -51,7 +51,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones) /// Resurrectable - convert corpses to bones if(!bones) { - if(!objaccessor.ConvertCorpseForPlayer(player_guid)) + if(!sObjectAccessor.ConvertCorpseForPlayer(player_guid)) { sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow); CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); @@ -60,7 +60,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones) else ///- or delete bones { - mapmgr.RemoveBonesFromMap(mapid, guid, positionX, positionY); + sMapMgr.RemoveBonesFromMap(mapid, guid, positionX, positionY); ///- remove bones from the database CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index a046f0c12..51b84708b 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -147,7 +147,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) { QuestMenuItem const& qItem = mQuestMenu.GetItem(iI); uint32 questID = qItem.m_qId; - Quest const* pQuest = objmgr.GetQuestTemplate(questID); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(questID); data << uint32(questID); data << uint32(qItem.m_qIcon); @@ -157,7 +157,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - QuestLocale const *ql = objmgr.GetQuestLocale(questID); + QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID); if (ql) { if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty()) @@ -195,7 +195,7 @@ void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flag void PlayerMenu::SendPointOfInterest( uint32 poi_id ) { - PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id); + PointOfInterest const* poi = sObjectMgr.GetPointOfInterest(poi_id); if(!poi) { sLog.outErrorDb("Requested send not existed POI (Id: %u), ignore.",poi_id); @@ -207,7 +207,7 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id ) int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - PointOfInterestLocale const *pl = objmgr.GetPointOfInterestLocale(poi_id); + PointOfInterestLocale const *pl = sObjectMgr.GetPointOfInterestLocale(poi_id); if (pl) { if (pl->IconName.size() > size_t(loc_idx) && !pl->IconName[loc_idx].empty()) @@ -229,7 +229,7 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id ) void PlayerMenu::SendTalking( uint32 textID ) { - GossipText const* pGossip = objmgr.GetGossipText(textID); + GossipText const* pGossip = sObjectMgr.GetGossipText(textID); WorldPacket data( SMSG_NPC_TEXT_UPDATE, 100 ); // guess size data << textID; // can be < 0 @@ -261,7 +261,7 @@ void PlayerMenu::SendTalking( uint32 textID ) int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); + NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textID); if (nl) { for (int i=0;i<8;++i) @@ -340,7 +340,7 @@ QuestMenu::~QuestMenu() void QuestMenu::AddMenuItem( uint32 QuestId, uint8 Icon) { - Quest const* qinfo = objmgr.GetQuestTemplate(QuestId); + Quest const* qinfo = sObjectMgr.GetQuestTemplate(QuestId); if (!qinfo) return; ASSERT( m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS ); @@ -384,14 +384,14 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl QuestMenuItem const& qmi = mQuestMenu.GetItem(iI); uint32 questID = qmi.m_qId; - Quest const *pQuest = objmgr.GetQuestTemplate(questID); + Quest const *pQuest = sObjectMgr.GetQuestTemplate(questID); std::string title = pQuest ? pQuest->GetTitle() : ""; int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - if(QuestLocale const *ql = objmgr.GetQuestLocale(questID)) + if(QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID)) { if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty()) title=ql->Title[loc_idx]; @@ -429,7 +429,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId()); + QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty()) @@ -525,7 +525,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId()); + QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty()) @@ -647,7 +647,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId()); + QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty()) @@ -735,7 +735,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID int loc_idx = pSession->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - QuestLocale const *ql = objmgr.GetQuestLocale(pQuest->GetQuestId()); + QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()); if (ql) { if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty()) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 49db5d59c..3656ea0d0 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -99,7 +99,7 @@ bool Group::Create(const uint64 &guid, const char * name) m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; if(!isBGGroup()) { - Player *leader = objmgr.GetPlayer(guid); + Player *leader = sObjectMgr.GetPlayer(guid); if(leader) { m_dungeonDifficulty = leader->GetDungeonDifficulty(); @@ -145,7 +145,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool m_leaderGuid = leaderGuid; // group leader not exist - if(!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName)) + if(!sObjectMgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName)) { if(!external) delete result; return false; @@ -202,7 +202,7 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant) member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); // skip non-existed member - if(!objmgr.GetPlayerNameByGUID(member.guid, member.name)) + if(!sObjectMgr.GetPlayerNameByGUID(member.guid, member.name)) return false; member.group = subgroup; @@ -226,7 +226,7 @@ void Group::ConvertToRaid() // update quest related GO states (quest activity dependent from raid membership) for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) - if(Player* player = objmgr.GetPlayer(citr->guid)) + if(Player* player = sObjectMgr.GetPlayer(citr->guid)) player->UpdateForQuestWorldObjects(); } @@ -301,7 +301,7 @@ bool Group::AddMember(const uint64 &guid, const char* name) return false; SendUpdate(); - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); if(player) { if(!IsLeader(player->GetGUID()) && !isBGGroup()) @@ -343,7 +343,7 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method) { bool leaderChanged = _removeMember(guid); - if(Player *player = objmgr.GetPlayer( guid )) + if(Player *player = sObjectMgr.GetPlayer( guid )) { // quest related GO state dependent from raid membership if(isRaidGroup()) @@ -409,7 +409,7 @@ void Group::Disband(bool hideDestroy) for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - player = objmgr.GetPlayer(citr->guid); + player = sObjectMgr.GetPlayer(citr->guid); if(!player) continue; @@ -490,7 +490,7 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r) for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = objmgr.GetPlayer(itr->first); + Player *p = sObjectMgr.GetPlayer(itr->first); if(!p || !p->GetSession()) continue; @@ -514,7 +514,7 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = objmgr.GetPlayer(itr->first); + Player *p = sObjectMgr.GetPlayer(itr->first); if(!p || !p->GetSession()) continue; @@ -537,7 +537,7 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = objmgr.GetPlayer(itr->first); + Player *p = sObjectMgr.GetPlayer(itr->first); if(!p || !p->GetSession()) continue; @@ -557,7 +557,7 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r) for( Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr) { - Player *p = objmgr.GetPlayer(itr->first); + Player *p = sObjectMgr.GetPlayer(itr->first); if(!p || !p->GetSession()) continue; @@ -571,7 +571,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature) std::vector::iterator i; ItemPrototype const *item; uint8 itemSlot = 0; - Player *player = objmgr.GetPlayer(playerGUID); + Player *player = sObjectMgr.GetPlayer(playerGUID); Group *group = player->GetGroup(); for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) @@ -586,7 +586,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature) //roll for over-threshold item if it's one-player loot if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) { - uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); Roll* r = new Roll(newitemGUID, *i); //a vector is filled with only near party members @@ -624,7 +624,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature) void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature) { ItemPrototype const *item; - Player *player = objmgr.GetPlayer(playerGUID); + Player *player = sObjectMgr.GetPlayer(playerGUID); Group *group = player->GetGroup(); uint8 itemSlot = 0; @@ -635,7 +635,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea //only roll for one-player items, not for ones everyone can get if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) { - uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); + uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); Roll* r = new Roll(newitemGUID, *i); for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) @@ -677,7 +677,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creature) { - Player *player = objmgr.GetPlayer(playerGUID); + Player *player = sObjectMgr.GetPlayer(playerGUID); if(!player) return; @@ -801,7 +801,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) } } SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll); - player = objmgr.GetPlayer(maxguid); + player = sObjectMgr.GetPlayer(maxguid); if(player && player->GetSession()) { @@ -848,7 +848,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) } } SendLootRollWon(0, maxguid, maxresul, ROLL_GREED, *roll); - player = objmgr.GetPlayer(maxguid); + player = sObjectMgr.GetPlayer(maxguid); if(player && player->GetSession()) { @@ -951,7 +951,7 @@ void Group::SendUpdate() for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - player = objmgr.GetPlayer(citr->guid); + player = sObjectMgr.GetPlayer(citr->guid); if(!player || !player->GetSession() || player->GetGroup() != this ) continue; // guess size @@ -966,7 +966,7 @@ void Group::SendUpdate() { if(citr->guid == citr2->guid) continue; - Player* member = objmgr.GetPlayer(citr2->guid); + Player* member = sObjectMgr.GetPlayer(citr2->guid); uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE; onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0); @@ -1036,7 +1036,7 @@ void Group::OfflineReadyCheck() { for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - Player *pl = objmgr.GetPlayer(citr->guid); + Player *pl = sObjectMgr.GetPlayer(citr->guid); if (!pl || !pl->GetSession()) { WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9); @@ -1078,7 +1078,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u if(!guid) return false; - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); MemberSlot member; member.guid = guid; @@ -1124,7 +1124,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u bool Group::_removeMember(const uint64 &guid) { - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); if (player) { //if we are removing player from battleground raid @@ -1185,7 +1185,7 @@ void Group::_setLeader(const uint64 &guid) ")", GUID_LOPART(m_leaderGuid), GUID_LOPART(slot->guid) ); - Player *player = objmgr.GetPlayer(slot->guid); + Player *player = sObjectMgr.GetPlayer(slot->guid); if(player) { for(uint8 i = 0; i < MAX_DIFFICULTY; ++i) @@ -1316,7 +1316,7 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group) { if(!isRaidGroup()) return; - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); if (!player) { @@ -1561,7 +1561,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) bool isEmpty = true; // if the map is loaded, reset it - Map *map = mapmgr.FindMap(p->GetMapId(), p->GetInstanceId()); + Map *map = sMapMgr.FindMap(p->GetMapId(), p->GetInstanceId()); if(map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset())) isEmpty = ((InstanceMap*)map)->Reset(method); @@ -1680,7 +1680,7 @@ void Group::_homebindIfInstance(Player *player) { // leaving the group in an instance, the homebind timer is started // unless the player is permanently saved to the instance - InstanceSave *save = sInstanceSaveManager.GetInstanceSave(player->GetInstanceId()); + InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(player->GetInstanceId()); InstancePlayerBind *playerBind = save ? player->GetBoundInstance(save->GetMapId(), save->GetDifficulty()) : NULL; if(!playerBind || !playerBind->perm) player->m_InstanceValid = false; diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 74c9e04be..0c54d41e5 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -64,7 +64,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) return; } - Player *player = objmgr.GetPlayer(membername.c_str()); + Player *player = sObjectMgr.GetPlayer(membername.c_str()); // no player if(!player) @@ -181,7 +181,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ ) return; } - Player* leader = objmgr.GetPlayer(group->GetLeaderGUID()); + Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGUID()); // forming a new group, create it if(!group->IsCreated()) @@ -189,7 +189,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ ) if( leader ) group->RemoveInvite(leader); group->Create(group->GetLeaderGUID(), group->GetLeaderName()); - objmgr.AddGroup(group); + sObjectMgr.AddGroup(group); } // everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!! @@ -204,7 +204,7 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ ) if (!group) return; // remember leader if online - Player *leader = objmgr.GetPlayer(group->GetLeaderGUID()); + Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID()); // uninvite, group can be deleted GetPlayer()->UninviteFromGroup(); @@ -307,7 +307,7 @@ void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); /** error handling **/ if (!player || !group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group) @@ -511,7 +511,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) /********************/ // everything's fine, do it - group->ChangeMembersGroup(objmgr.GetPlayer(name.c_str()), groupNr); + group->ChangeMembersGroup(sObjectMgr.GetPlayer(name.c_str()), groupNr); } void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) @@ -774,7 +774,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data ) uint64 Guid; recv_data >> Guid; - Player *player = objmgr.GetPlayer(Guid); + Player *player = sObjectMgr.GetPlayer(Guid); if(!player) { WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2); diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index b7216fc29..b7bed3884 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -64,7 +64,7 @@ Guild::~Guild() bool Guild::Create(Player* leader, std::string gname) { - if (objmgr.GetGuildByName(gname)) + if (sObjectMgr.GetGuildByName(gname)) return false; WorldSession* lSession = leader->GetSession(); @@ -77,7 +77,7 @@ bool Guild::Create(Player* leader, std::string gname) MOTD = "No message set."; m_GuildBankMoney = 0; m_PurchasedTabs = 0; - m_Id = objmgr.GenerateGuildId(); + m_Id = sObjectMgr.GenerateGuildId(); sLog.outDebug("GUILD: creating guild %s to leader: %u", gname.c_str(), GUID_LOPART(m_LeaderGuid)); @@ -107,18 +107,18 @@ void Guild::CreateDefaultGuildRanks(int locale_idx) CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid = '%u'", m_Id); - CreateRank(objmgr.GetMangosString(LANG_GUILD_MASTER, locale_idx), GR_RIGHT_ALL); - CreateRank(objmgr.GetMangosString(LANG_GUILD_OFFICER, locale_idx), GR_RIGHT_ALL); - CreateRank(objmgr.GetMangosString(LANG_GUILD_VETERAN, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); - CreateRank(objmgr.GetMangosString(LANG_GUILD_MEMBER, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); - CreateRank(objmgr.GetMangosString(LANG_GUILD_INITIATE, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); + CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_MASTER, locale_idx), GR_RIGHT_ALL); + CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_OFFICER, locale_idx), GR_RIGHT_ALL); + CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_VETERAN, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); + CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_MEMBER, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); + CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_INITIATE, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); SetBankMoneyPerDay((uint32)GR_GUILDMASTER, WITHDRAW_MONEY_UNLIMITED); } bool Guild::AddMember(uint64 plGuid, uint32 plRank) { - Player* pl = objmgr.GetPlayer(plGuid); + Player* pl = sObjectMgr.GetPlayer(plGuid); if (pl) { if (pl->GetGuildId() != 0) @@ -482,7 +482,7 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) SetLeader(newLeaderGUID); // If player not online data in data field will be loaded from guild tabs no need to update it !! - if (Player *newLeader = objmgr.GetPlayer(newLeaderGUID)) + if (Player *newLeader = sObjectMgr.GetPlayer(newLeaderGUID)) newLeader->SetRank(GR_GUILDMASTER); // when leader non-exist (at guild load with deleted leader only) not send broadcasts @@ -507,7 +507,7 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) members.erase(GUID_LOPART(guid)); - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); // If player not online data in data field will be loaded from guild tabs no need to update it !! if (player) { @@ -524,7 +524,7 @@ void Guild::ChangeRank(uint64 guid, uint32 newRank) if (itr != members.end()) itr->second.RankId = newRank; - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); // If player not online data in data field will be loaded from guild tabs no need to update it !! if (player) player->SetRank(newRank); @@ -723,7 +723,7 @@ void Guild::Disband() CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid = '%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id); CharacterDatabase.CommitTransaction(); - objmgr.RemoveGuild(m_Id); + sObjectMgr.RemoveGuild(m_Id); } void Guild::Roster(WorldSession *session /*= NULL*/) diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 4765a1e47..7c7677bd3 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -34,7 +34,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) uint32 guildId; recvPacket >> guildId; - if(Guild *guild = objmgr.GetGuildById(guildId)) + if(Guild *guild = sObjectMgr.GetGuildById(guildId)) { guild->Query(this); return; @@ -60,7 +60,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) return; } - objmgr.AddGuild(guild); + sObjectMgr.AddGuild(guild); } void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) @@ -81,7 +81,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) return; } - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -143,7 +143,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(plName)) return; - Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -196,12 +196,12 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) sLog.outDebug("WORLD: Received CMSG_GUILD_ACCEPT"); - guild = objmgr.GetGuildById(player->GetGuildIdInvited()); + guild = sObjectMgr.GetGuildById(player->GetGuildIdInvited()); if(!guild || player->GetGuildId()) return; // not let enemies sign guild charter - if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != objmgr.GetPlayerTeamByGUID(guild->GetLeader())) + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(guild->GetLeader())) return; if(!guild->AddMember(GetPlayer()->GetGUID(),guild->GetLowestRank())) @@ -230,7 +230,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) { sLog.outDebug("WORLD: Received CMSG_GUILD_INFO"); - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -252,7 +252,7 @@ void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/) { sLog.outDebug("WORLD: Received CMSG_GUILD_ROSTER"); - if(Guild* guild = objmgr.GetGuildById(_player->GetGuildId())) + if(Guild* guild = sObjectMgr.GetGuildById(_player->GetGuildId())) guild->Roster(this); } @@ -266,7 +266,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(plName)) return; - Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -327,7 +327,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(plName)) return; - Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { @@ -389,7 +389,7 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) { sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE"); - Guild *guild = objmgr.GetGuildById(_player->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -427,7 +427,7 @@ void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) { sLog.outDebug("WORLD: Received CMSG_GUILD_DISBAND"); - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -457,7 +457,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(name)) return; - Guild *guild = objmgr.GetGuildById(oldLeader->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(oldLeader->GetGuildId()); if (!guild) { @@ -504,7 +504,7 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) else MOTD = ""; - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -537,7 +537,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(name)) return; - Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if (!guild) { @@ -576,7 +576,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) if (!normalizePlayerName(plName)) return; - Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild* guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if (!guild) { @@ -612,7 +612,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) sLog.outDebug("WORLD: Received CMSG_GUILD_RANK"); - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam @@ -662,7 +662,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) std::string rankname; recvPacket >> rankname; - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -688,7 +688,7 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) { sLog.outDebug("WORLD: Received CMSG_GUILD_DEL_RANK"); - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -724,7 +724,7 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) std::string GINFO; recvPacket >> GINFO; - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); @@ -763,7 +763,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { //"You are not part of a guild!"; @@ -800,7 +800,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) sLog.outDebug("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)"); if(uint32 GuildId = GetPlayer()->GetGuildId()) - if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId)) pGuild->DisplayGuildEventLog(this); } @@ -811,7 +811,7 @@ void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)"); if(uint32 GuildId = GetPlayer()->GetGuildId()) - if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId)) pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); } @@ -821,7 +821,7 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ ) if(uint32 GuildId = GetPlayer()->GetGuildId()) { - if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId)) { uint32 rankId = GetPlayer()->GetRank(); @@ -857,7 +857,7 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data ) if (uint32 GuildId = GetPlayer()->GetGuildId()) { - if(Guild *pGuild = objmgr.GetGuildById(GuildId)) + if(Guild *pGuild = sObjectMgr.GetGuildById(GuildId)) { pGuild->DisplayGuildBankTabsInfo(this); // this also will load guild bank if not yet return; @@ -883,7 +883,7 @@ void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data ) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; @@ -917,7 +917,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data ) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; @@ -965,7 +965,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data ) if (GuildId == 0) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if(!pGuild) return; @@ -1025,7 +1025,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) return; } - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild || !pGuild->IsGuildBankLoaded()) { recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet @@ -1123,7 +1123,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if(!pGuild) return; @@ -1173,7 +1173,7 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data ) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; @@ -1196,7 +1196,7 @@ void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data ) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; @@ -1221,7 +1221,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; @@ -1244,7 +1244,7 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data) if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index 56f0da15e..e046b51b4 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -68,7 +68,7 @@ HomeMovementGenerator::Update(Creature &owner, const uint32& time_diff // restore orientation of not moving creature at returning to home if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE) { - if(CreatureData const* data = objmgr.GetCreatureData(owner.GetDBTableGUIDLow())) + if(CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) { owner.SetOrientation(data->orientation); WorldPacket packet; diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 98195a8fd..c5a679cdb 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -168,7 +168,7 @@ void InstanceSave::SaveToDB() // save instance data too std::string data; - Map *map = mapmgr.FindMap(GetMapId(),m_instanceid); + Map *map = sMapMgr.FindMap(GetMapId(),m_instanceid); if(map) { assert(map->IsDungeon()); @@ -214,8 +214,8 @@ bool InstanceSave::UnloadIfEmpty() { if(m_playerList.empty() && m_groupList.empty()) { - if(!sInstanceSaveManager.lock_instLists) - sInstanceSaveManager.RemoveInstanceSave(GetInstanceId()); + if(!sInstanceSaveMgr.lock_instLists) + sInstanceSaveMgr.RemoveInstanceSave(GetInstanceId()); return false; } else @@ -258,7 +258,7 @@ void InstanceSaveManager::CleanupInstances() bar.step(); // load reset times and clean expired instances - sInstanceSaveManager.LoadResetTimes(); + sInstanceSaveMgr.LoadResetTimes(); // clean character/group - instance binds with invalid group/characters _DelHelper(CharacterDatabase, "character_instance.guid, instance", "character_instance", "LEFT JOIN characters ON character_instance.guid = characters.guid WHERE characters.guid IS NULL"); @@ -567,7 +567,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) { sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); - Map *map = (MapInstanced*)mapmgr.CreateBaseMap(mapid); + Map *map = (MapInstanced*)sMapMgr.CreateBaseMap(mapid); if(!map->Instanceable()) return; @@ -577,14 +577,14 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) Map* iMap = ((MapInstanced*)map)->FindMap(instanceId); if(iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY); - else objmgr.DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded + else sObjectMgr.DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded } void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLeft) { // global reset for all instances of the given map // note: this isn't fast but it's meant to be executed very rarely - Map const *map = mapmgr.CreateBaseMap(mapid); + Map const *map = sMapMgr.CreateBaseMap(mapid); if(!map->Instanceable()) return; uint64 now = (uint64)time(NULL); diff --git a/src/game/InstanceSaveMgr.h b/src/game/InstanceSaveMgr.h index d285f7a23..c080fd5da 100644 --- a/src/game/InstanceSaveMgr.h +++ b/src/game/InstanceSaveMgr.h @@ -169,5 +169,5 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton::Instance() +#define sInstanceSaveMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/Item.cpp b/src/game/Item.cpp index e5eaabea1..00bbe883b 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -446,7 +446,7 @@ ItemPrototype const *Item::GetProto() const Player* Item::GetOwner()const { - return objmgr.GetPlayer(GetOwnerGUID()); + return sObjectMgr.GetPlayer(GetOwnerGUID()); } uint32 Item::GetSkill() @@ -774,7 +774,7 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const bool Item::IsTargetValidForItemUse(Unit* pUnitTarget) { - ItemRequiredTargetMapBounds bounds = objmgr.GetItemRequiredTargetMapBounds(GetProto()->ItemId); + ItemRequiredTargetMapBounds bounds = sObjectMgr.GetItemRequiredTargetMapBounds(GetProto()->ItemId); if (bounds.first == bounds.second) return true; @@ -945,7 +945,7 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) assert(count !=0 && "pProto->Stackable==0 but checked at loading already"); Item *pItem = NewItemOrBag( pProto ); - if( pItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), item, player) ) + if( pItem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), item, player) ) { pItem->SetCount( count ); return pItem; @@ -985,14 +985,14 @@ bool Item::IsBindedNotWith( Player const* player ) const return true; // online - if(Player* owner = objmgr.GetPlayer(GetOwnerGUID())) + if(Player* owner = sObjectMgr.GetPlayer(GetOwnerGUID())) { return owner->GetSession()->GetAccountId() != player->GetSession()->GetAccountId(); } // offline slow case else { - return objmgr.GetPlayerAccountIdByGUID(GetOwnerGUID()) != player->GetSession()->GetAccountId(); + return sObjectMgr.GetPlayerAccountIdByGUID(GetOwnerGUID()) != player->GetSession()->GetAccountId(); } } diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index ba80d0880..23af0d5d6 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -294,7 +294,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) int loc_idx = GetSessionDbLocaleIndex(); if ( loc_idx >= 0 ) { - ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); + ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId); if (il) { if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) @@ -980,7 +980,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); + ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId); if (il) { if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index d31c6ecac..dfd32d221 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -31,7 +31,7 @@ static void AttemptJoin(Player* _player) return; //TODO: Guard Player Map - HashMapHolder::MapType const& players = objaccessor.GetPlayers(); + HashMapHolder::MapType const& players = sObjectAccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) { Player *plr = iter->second; @@ -62,7 +62,7 @@ static void AttemptJoin(Player* _player) continue; } - objmgr.AddGroup(group); + sObjectMgr.AddGroup(group); } // stop at success join @@ -91,7 +91,7 @@ static void AttemptAddMore(Player* _player) return; //TODO: Guard Player map - HashMapHolder::MapType const& players = objaccessor.GetPlayers(); + HashMapHolder::MapType const& players = sObjectAccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) { Player *plr = iter->second; @@ -120,7 +120,7 @@ static void AttemptAddMore(Player* _player) return; // can't create group (??) } - objmgr.AddGroup(group); + sObjectMgr.AddGroup(group); } // stop at join fail (full) @@ -302,7 +302,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type) data << uint32(0); // unk //TODO: Guard Player map - HashMapHolder::MapType const& players = objaccessor.GetPlayers(); + HashMapHolder::MapType const& players = sObjectAccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) { Player *plr = iter->second; diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 5e7a2ab8f..eb4af753a 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -113,7 +113,7 @@ bool ChatHandler::HandleNpcWhisperCommand(const char* args) uint64 receiver_guid= atol(receiver_str); // check online security - if (HasLowerSecurity(objmgr.GetPlayer(receiver_guid), 0)) + if (HasLowerSecurity(sObjectMgr.GetPlayer(receiver_guid), 0)) return false; pCreature->MonsterWhisper(text,receiver_guid); @@ -545,7 +545,7 @@ bool ChatHandler::HandleGonameCommand(const char* args) InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind if (!gBind) - if (InstanceSave *save = sInstanceSaveManager.GetInstanceSave(target->GetInstanceId())) + if (InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(target->GetInstanceId())) _player->BindToInstance(save, !save->CanReset()); } @@ -1911,7 +1911,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) std::ostringstream reply; - GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); + GameTeleMap const & teleMap = sObjectMgr.GetGameTeleMap(); for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) { GameTele const* tele = &itr->second; @@ -1967,7 +1967,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args) //Save all players in the world bool ChatHandler::HandleSaveAllCommand(const char* /*args*/) { - objaccessor.SaveAllPlayers(); + sObjectAccessor.SaveAllPlayers(); SendSysMessage(LANG_PLAYERS_SAVED); return true; } @@ -2005,7 +2005,7 @@ bool ChatHandler::HandleSendMailCommand(const char* args) // from console show not existed sender MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0; + uint32 itemTextId = !text.empty() ? sObjectMgr.CreateItemText( text ) : 0; MailDraft(subject, itemTextId) .SendMailTo(MailReceiver(target,GUID_LOPART(target_guid)),sender); @@ -2080,7 +2080,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args) PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str()); Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation, - mapmgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid); + sMapMgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid); } return true; @@ -2338,7 +2338,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args) else _player->SaveRecallPosition(); - Map const *map = mapmgr.CreateBaseMap(mapid); + Map const *map = sMapMgr.CreateBaseMap(mapid); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); @@ -2431,7 +2431,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) // update to parent zone if exist (client map show only zones without parents) AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; - Map const *map = mapmgr.CreateBaseMap(zoneEntry->mapid); + Map const *map = sMapMgr.CreateBaseMap(zoneEntry->mapid); if(map->Instanceable()) { @@ -2506,7 +2506,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args) else _player->SaveRecallPosition(); - Map const *map = mapmgr.CreateBaseMap(mapid); + Map const *map = sMapMgr.CreateBaseMap(mapid); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index b4f6d587f..d1b6cb378 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -64,7 +64,7 @@ bool ChatHandler::HandleMuteCommand(const char* args) if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name)) return false; - uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); + uint32 account_id = target ? target->GetSession()->GetAccountId() : sObjectMgr.GetPlayerAccountIdByGUID(target_guid); // find only player from same account if any if(!target) @@ -104,7 +104,7 @@ bool ChatHandler::HandleUnmuteCommand(const char* args) if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) return false; - uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); + uint32 account_id = target ? target->GetSession()->GetAccountId() : sObjectMgr.GetPlayerAccountIdByGUID(target_guid); // find only player from same account if any if(!target) @@ -358,7 +358,7 @@ bool ChatHandler::HandleGoObjectCommand(const char* args) int mapid; // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(guid)) + if (GameObjectData const* go_data = sObjectMgr.GetGOData(guid)) { x = go_data->posX; y = go_data->posY; @@ -470,8 +470,8 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) z = fields[4].GetFloat(); o = fields[5].GetFloat(); mapid = fields[6].GetUInt16(); - pool_id = poolhandler.IsPartOfAPool(lowguid, TYPEID_GAMEOBJECT); - if (!pool_id || (pool_id && poolhandler.IsSpawnedObject(pool_id, lowguid, TYPEID_GAMEOBJECT))) + pool_id = sPoolMgr.IsPartOfAPool(lowguid, TYPEID_GAMEOBJECT); + if (!pool_id || (pool_id && sPoolMgr.IsSpawnedObject(pool_id, lowguid, TYPEID_GAMEOBJECT))) found = true; } while( result->NextRow() && (!found) ); @@ -524,7 +524,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) GameObject* obj = NULL; // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); if(!obj) @@ -572,7 +572,7 @@ bool ChatHandler::HandleGameObjectTurnCommand(const char* args) GameObject* obj = NULL; // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); if(!obj) @@ -626,7 +626,7 @@ bool ChatHandler::HandleGameObjectMoveCommand(const char* args) GameObject* obj = NULL; // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); if(!obj) @@ -726,7 +726,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args) Map *map = chr->GetMap(); GameObject* pGameObj = new GameObject; - uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); + uint32 db_lowGUID = sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); if(!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { @@ -756,7 +756,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args) map->Add(pGameObj); // TODO: is it really necessary to add both the real and DB table guid here ? - objmgr.AddGameobjectToGrid(db_lowGUID, objmgr.GetGOData(db_lowGUID)); + sObjectMgr.AddGameobjectToGrid(db_lowGUID, sObjectMgr.GetGOData(db_lowGUID)); PSendSysMessage(LANG_GAMEOBJECT_ADD,id,gInfo->name,db_lowGUID,x,y,z); return true; @@ -777,7 +777,7 @@ bool ChatHandler::HandleGameObjectPhaseCommand(const char* args) GameObject* obj = NULL; // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); if(!obj) @@ -1074,7 +1074,7 @@ bool ChatHandler::HandleNpcAddCommand(const char* args) Map *map = chr->GetMap(); Creature* pCreature = new Creature; - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, (uint32)teamval)) + if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, (uint32)teamval)) { delete pCreature; return false; @@ -1097,7 +1097,7 @@ bool ChatHandler::HandleNpcAddCommand(const char* args) pCreature->LoadFromDB(db_guid, map); map->Add(pCreature); - objmgr.AddCreatureToGrid(db_guid, objmgr.GetCreatureData(db_guid)); + sObjectMgr.AddCreatureToGrid(db_guid, sObjectMgr.GetCreatureData(db_guid)); return true; } @@ -1134,13 +1134,13 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(const char* args) uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; - if(!objmgr.IsVendorItemValid(vendor_entry,itemId,maxcount,incrtime,extendedcost,m_session->GetPlayer())) + if(!sObjectMgr.IsVendorItemValid(vendor_entry,itemId,maxcount,incrtime,extendedcost,m_session->GetPlayer())) { SetSentErrorMessage(true); return false; } - objmgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost); + sObjectMgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost); ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId); @@ -1171,7 +1171,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(const char* args) } uint32 itemId = atol(pitem); - if(!objmgr.RemoveVendorItem(vendor->GetEntry(),itemId)) + if(!sObjectMgr.RemoveVendorItem(vendor->GetEntry(),itemId)) { PSendSysMessage(LANG_ITEM_NOT_IN_LIST,itemId); SetSentErrorMessage(true); @@ -1205,7 +1205,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(const char* args) // attempt check creature existence by DB data if(!pCreature) { - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid); @@ -1226,7 +1226,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(const char* args) Player* player = m_session->GetPlayer(); - WaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), wait, 0); + sWaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), wait, 0); // update movement type WorldDatabase.PExecuteLog("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE,lowguid); @@ -1273,7 +1273,7 @@ bool ChatHandler::HandleNpcChangeLevelCommand(const char* args) { if(((Pet*)pCreature)->getPetType()==HUNTER_PET) { - pCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(lvl)/4); + pCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(lvl)/4); pCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); } ((Pet*)pCreature)->GivePetLevel(lvl); @@ -1330,7 +1330,7 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args) if(!lowguid) return false; - if (CreatureData const* cr_data = objmgr.GetCreatureData(lowguid)) + if (CreatureData const* cr_data = sObjectMgr.GetCreatureData(lowguid)) unit = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); } else @@ -1377,7 +1377,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args) // Attempting creature load from DB data if(!pCreature) { - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid); @@ -1411,7 +1411,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args) if (pCreature) { - if(CreatureData const* data = objmgr.GetCreatureData(pCreature->GetDBTableGUIDLow())) + if(CreatureData const* data = sObjectMgr.GetCreatureData(pCreature->GetDBTableGUIDLow())) { const_cast(data)->posX = x; const_cast(data)->posY = y; @@ -1517,7 +1517,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) // attempt check creature existence by DB data if(!pCreature) { - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid); @@ -1549,7 +1549,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) // update movement type if(doNotDelete == false) - WaypointMgr.DeletePath(lowguid); + sWaypointMgr.DeletePath(lowguid); if(pCreature) { @@ -1933,7 +1933,7 @@ bool ChatHandler::HandleNpcNameCommand(const char* /*args*/) } pCreature->SetName(args); - uint32 idname = objmgr.AddCreatureTemplate(pCreature->GetName()); + uint32 idname = sObjectMgr.AddCreatureTemplate(pCreature->GetName()); pCreature->SetUInt32Value(OBJECT_FIELD_ENTRY, idname); pCreature->SaveToDB(); @@ -1980,7 +1980,7 @@ bool ChatHandler::HandleNpcSubNameCommand(const char* /*args*/) return true; } - uint32 idname = objmgr.AddCreatureSubName(pCreature->GetName(),args,pCreature->GetUInt32Value(UNIT_FIELD_DISPLAYID)); + uint32 idname = sObjectMgr.AddCreatureSubName(pCreature->GetName(),args,pCreature->GetUInt32Value(UNIT_FIELD_DISPLAYID)); pCreature->SetUInt32Value(OBJECT_FIELD_ENTRY, idname); pCreature->SaveToDB(); @@ -2197,7 +2197,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) void ChatHandler::ShowTicket(uint64 guid, char const* text, char const* time) { std::string name; - if(!objmgr.GetPlayerNameByGUID(guid,name)) + if(!sObjectMgr.GetPlayerNameByGUID(guid,name)) name = GetMangosString(LANG_UNKNOWN); std::string nameLink = playerLink(name); @@ -2220,7 +2220,7 @@ bool ChatHandler::HandleTicketCommand(const char* args) return false; } - size_t count = ticketmgr.GetTicketCount(); + size_t count = sTicketMgr.GetTicketCount(); bool accept = m_session->GetPlayer()->isAcceptTickets(); @@ -2287,7 +2287,7 @@ bool ChatHandler::HandleTicketCommand(const char* args) return false; // ticket $char_name - GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(target_guid)); + GMTicket* ticket = sTicketMgr.GetGMTicket(GUID_LOPART(target_guid)); if(!ticket) return false; @@ -2308,7 +2308,7 @@ bool ChatHandler::HandleDelTicketCommand(const char *args) // delticket all if(strncmp(px,"all",4) == 0) { - ticketmgr.DeleteAll(); + sTicketMgr.DeleteAll(); SendSysMessage(LANG_COMMAND_ALLTICKETDELETED); return true; } @@ -2329,10 +2329,10 @@ bool ChatHandler::HandleDelTicketCommand(const char *args) uint32 guid = fields[0].GetUInt32(); delete result; - ticketmgr.Delete(guid); + sTicketMgr.Delete(guid); //notify player - if(Player* pl = objmgr.GetPlayer(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER))) + if(Player* pl = sObjectMgr.GetPlayer(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER))) { pl->GetSession()->SendGMTicketGetTicket(0x0A, 0); PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, GetNameLink(pl).c_str()); @@ -2350,7 +2350,7 @@ bool ChatHandler::HandleDelTicketCommand(const char *args) return false; // delticket $char_name - ticketmgr.Delete(GUID_LOPART(target_guid)); + sTicketMgr.Delete(GUID_LOPART(target_guid)); // notify players about ticket deleting if(target) @@ -2447,7 +2447,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) }while( result->NextRow() ); delete result; - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2481,7 +2481,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) } lowguid = atoi((char*)guid_str); - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2504,7 +2504,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) sLog.outDebug("DEBUG: HandleWpAddCommand - point == 0"); Player* player = m_session->GetPlayer(); - WaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0); + sWaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0); // update movement type if(target) @@ -2627,7 +2627,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) } lowguid = atoi((char*)guid_str); - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2696,7 +2696,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) PSendSysMessage("DEBUG: wp modify add, GUID: %u", lowguid); // Get the creature for which we read the waypoint - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2737,7 +2737,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // create the waypoint creature wpGuid = 0; Creature* wpCreature = new Creature; - if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT,0)) + if (!wpCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT,0)) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature; @@ -2761,7 +2761,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) } } - WaypointMgr.AddAfterNode(lowguid, point, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), 0, 0, wpGuid); + sWaypointMgr.AddAfterNode(lowguid, point, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), 0, 0, wpGuid); if(!wpGuid) return false; @@ -2775,7 +2775,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) PSendSysMessage("DEBUG: wp modify del, GUID: %u", lowguid); // Get the creature for which we read the waypoint - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2799,7 +2799,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // Adjust the waypoints // Respawn the owner of the waypoints - WaypointMgr.DeleteNode(lowguid, point); + sWaypointMgr.DeleteNode(lowguid, point); if(npcCreature) { @@ -2835,7 +2835,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) Map *map = chr->GetMap(); { // Get the creature for which we read the waypoint - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2857,7 +2857,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) wpCreature->AddObjectToRemoveList(); // re-create Creature* wpCreature2 = new Creature; - if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0)) + if (!wpCreature2->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0)) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature2; @@ -2880,7 +2880,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) //npcCreature->GetMap()->Add(wpCreature2); } - WaypointMgr.SetNodePosition(lowguid, point, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ()); + sWaypointMgr.SetNodePosition(lowguid, point, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ()); if(npcCreature) { @@ -2897,7 +2897,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) } // move // Create creature - npc that has the waypoint - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2912,7 +2912,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) return false; } - WaypointMgr.SetNodeText(lowguid, point, show_str, arg_str); + sWaypointMgr.SetNodeText(lowguid, point, show_str, arg_str); Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT)); if(npcCreature) @@ -3006,7 +3006,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) uint32 lowguid = atoi((char*)guid_str); - CreatureData const* data = objmgr.GetCreatureData(lowguid); + CreatureData const* data = sObjectMgr.GetCreatureData(lowguid); if(!data) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -3161,7 +3161,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) float o = chr->GetOrientation(); Creature* wpCreature = new Creature; - if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0)) + if (!wpCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0)) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete wpCreature; @@ -3219,7 +3219,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) Map *map = chr->GetMap(); Creature* pCreature = new Creature; - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0)) + if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0)) { PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete pCreature; @@ -3279,7 +3279,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) Map *map = chr->GetMap(); Creature* pCreature = new Creature; - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0)) + if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0)) { PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); delete pCreature; diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 898fd519b..660e8e78f 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -116,7 +116,7 @@ bool ChatHandler::HandleReloadAllQuestCommand(const char* /*args*/) HandleReloadQuestTemplateCommand("a"); sLog.outString( "Re-Loading Quests Relations..." ); - objmgr.LoadQuestRelations(); + sObjectMgr.LoadQuestRelations(); SendGlobalSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); return true; } @@ -192,7 +192,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) { sLog.outString( "Re-Loading config settings..." ); sWorld.LoadConfigSettings(true); - mapmgr.InitializeVisibilityDistanceInfo(); + sMapMgr.InitializeVisibilityDistanceInfo(); SendGlobalSysMessage("World config settings reloaded."); return true; } @@ -200,7 +200,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) bool ChatHandler::HandleReloadAchievementCriteriaRequirementCommand(const char*) { sLog.outString( "Re-Loading Additional Achievement Criteria Requirements Data..." ); - achievementmgr.LoadAchievementCriteriaRequirements(); + sAchievementMgr.LoadAchievementCriteriaRequirements(); SendGlobalSysMessage("DB table `achievement_criteria_requirement` reloaded."); return true; } @@ -208,7 +208,7 @@ bool ChatHandler::HandleReloadAchievementCriteriaRequirementCommand(const char*) bool ChatHandler::HandleReloadAchievementRewardCommand(const char*) { sLog.outString( "Re-Loading Achievement Reward Data..." ); - achievementmgr.LoadRewards(); + sAchievementMgr.LoadRewards(); SendGlobalSysMessage("DB table `achievement_reward` reloaded."); return true; } @@ -216,7 +216,7 @@ bool ChatHandler::HandleReloadAchievementRewardCommand(const char*) bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*) { sLog.outString( "Re-Loading Tavern Area Triggers..." ); - objmgr.LoadTavernAreaTriggers(); + sObjectMgr.LoadTavernAreaTriggers(); SendGlobalSysMessage("DB table `areatrigger_tavern` reloaded."); return true; } @@ -224,7 +224,7 @@ bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*) bool ChatHandler::HandleReloadAreaTriggerTeleportCommand(const char*) { sLog.outString( "Re-Loading AreaTrigger teleport definitions..." ); - objmgr.LoadAreaTriggerTeleports(); + sObjectMgr.LoadAreaTriggerTeleports(); SendGlobalSysMessage("DB table `areatrigger_teleport` reloaded."); return true; } @@ -239,7 +239,7 @@ bool ChatHandler::HandleReloadCommandCommand(const char*) bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(const char*) { sLog.outString( "Loading Quests Relations... (`creature_questrelation`)" ); - objmgr.LoadCreatureQuestRelations(); + sObjectMgr.LoadCreatureQuestRelations(); SendGlobalSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); return true; } @@ -247,7 +247,7 @@ bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(const char*) bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*) { sLog.outString( "Loading Quests Relations... (`creature_involvedrelation`)" ); - objmgr.LoadCreatureInvolvedRelations(); + sObjectMgr.LoadCreatureInvolvedRelations(); SendGlobalSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); return true; } @@ -255,7 +255,7 @@ bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*) bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*) { sLog.outString( "Loading Quests Relations... (`gameobject_questrelation`)" ); - objmgr.LoadGameobjectQuestRelations(); + sObjectMgr.LoadGameobjectQuestRelations(); SendGlobalSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); return true; } @@ -263,7 +263,7 @@ bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*) bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(const char*) { sLog.outString( "Loading Quests Relations... (`gameobject_involvedrelation`)" ); - objmgr.LoadGameobjectInvolvedRelations(); + sObjectMgr.LoadGameobjectInvolvedRelations(); SendGlobalSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); return true; } @@ -271,7 +271,7 @@ bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(const char*) bool ChatHandler::HandleReloadQuestAreaTriggersCommand(const char*) { sLog.outString( "Re-Loading Quest Area Triggers..." ); - objmgr.LoadQuestAreaTriggers(); + sObjectMgr.LoadQuestAreaTriggers(); SendGlobalSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); return true; } @@ -279,12 +279,12 @@ bool ChatHandler::HandleReloadQuestAreaTriggersCommand(const char*) bool ChatHandler::HandleReloadQuestTemplateCommand(const char*) { sLog.outString( "Re-Loading Quest Templates..." ); - objmgr.LoadQuests(); + sObjectMgr.LoadQuests(); SendGlobalSysMessage("DB table `quest_template` (quest definitions) reloaded."); /// dependent also from `gameobject` but this table not reloaded anyway sLog.outString( "Re-Loading GameObjects for quests..." ); - objmgr.LoadGameObjectForQuests(); + sObjectMgr.LoadGameObjectForQuests(); SendGlobalSysMessage("Data GameObjects for quests reloaded."); return true; } @@ -399,7 +399,7 @@ bool ChatHandler::HandleReloadLootTemplatesSpellCommand(const char*) bool ChatHandler::HandleReloadMangosStringCommand(const char*) { sLog.outString( "Re-Loading mangos_string Table!" ); - objmgr.LoadMangosStrings(); + sObjectMgr.LoadMangosStrings(); SendGlobalSysMessage("DB table `mangos_string` reloaded."); return true; } @@ -407,7 +407,7 @@ bool ChatHandler::HandleReloadMangosStringCommand(const char*) bool ChatHandler::HandleReloadNpcOptionCommand(const char*) { sLog.outString( "Re-Loading `npc_option` Table!" ); - objmgr.LoadNpcOptions(); + sObjectMgr.LoadNpcOptions(); SendGlobalSysMessage("DB table `npc_option` reloaded."); return true; } @@ -415,7 +415,7 @@ bool ChatHandler::HandleReloadNpcOptionCommand(const char*) bool ChatHandler::HandleReloadNpcGossipCommand(const char*) { sLog.outString( "Re-Loading `npc_gossip` Table!" ); - objmgr.LoadNpcTextId(); + sObjectMgr.LoadNpcTextId(); SendGlobalSysMessage("DB table `npc_gossip` reloaded."); return true; } @@ -423,7 +423,7 @@ bool ChatHandler::HandleReloadNpcGossipCommand(const char*) bool ChatHandler::HandleReloadNpcTrainerCommand(const char*) { sLog.outString( "Re-Loading `npc_trainer` Table!" ); - objmgr.LoadTrainerSpell(); + sObjectMgr.LoadTrainerSpell(); SendGlobalSysMessage("DB table `npc_trainer` reloaded."); return true; } @@ -431,7 +431,7 @@ bool ChatHandler::HandleReloadNpcTrainerCommand(const char*) bool ChatHandler::HandleReloadNpcVendorCommand(const char*) { sLog.outString( "Re-Loading `npc_vendor` Table!" ); - objmgr.LoadVendors(); + sObjectMgr.LoadVendors(); SendGlobalSysMessage("DB table `npc_vendor` reloaded."); return true; } @@ -439,7 +439,7 @@ bool ChatHandler::HandleReloadNpcVendorCommand(const char*) bool ChatHandler::HandleReloadPointsOfInterestCommand(const char*) { sLog.outString( "Re-Loading `points_of_interest` Table!" ); - objmgr.LoadPointsOfInterest(); + sObjectMgr.LoadPointsOfInterest(); SendGlobalSysMessage("DB table `points_of_interest` reloaded."); return true; } @@ -447,7 +447,7 @@ bool ChatHandler::HandleReloadPointsOfInterestCommand(const char*) bool ChatHandler::HandleReloadSpellClickSpellsCommand(const char*) { sLog.outString( "Re-Loading `npc_spellclick_spells` Table!" ); - objmgr.LoadNPCSpellClickSpells(); + sObjectMgr.LoadNPCSpellClickSpells(); SendGlobalSysMessage("DB table `npc_spellclick_spells` reloaded."); return true; } @@ -455,7 +455,7 @@ bool ChatHandler::HandleReloadSpellClickSpellsCommand(const char*) bool ChatHandler::HandleReloadReservedNameCommand(const char*) { sLog.outString( "Loading ReservedNames... (`reserved_name`)" ); - objmgr.LoadReservedPlayersNames(); + sObjectMgr.LoadReservedPlayersNames(); SendGlobalSysMessage("DB table `reserved_name` (player reserved names) reloaded."); return true; } @@ -479,7 +479,7 @@ bool ChatHandler::HandleReloadSkillExtraItemTemplateCommand(const char* /*args*/ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/) { sLog.outString( "Re-Loading Skill Fishing base level requirements..." ); - objmgr.LoadFishingBaseSkillLevel(); + sObjectMgr.LoadFishingBaseSkillLevel(); SendGlobalSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); return true; } @@ -487,7 +487,7 @@ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/) bool ChatHandler::HandleReloadSpellAreaCommand(const char*) { sLog.outString( "Re-Loading SpellArea Data..." ); - spellmgr.LoadSpellAreas(); + sSpellMgr.LoadSpellAreas(); SendGlobalSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded."); return true; } @@ -495,7 +495,7 @@ bool ChatHandler::HandleReloadSpellAreaCommand(const char*) bool ChatHandler::HandleReloadSpellChainCommand(const char*) { sLog.outString( "Re-Loading Spell Chain Data... " ); - spellmgr.LoadSpellChains(); + sSpellMgr.LoadSpellChains(); SendGlobalSysMessage("DB table `spell_chain` (spell ranks) reloaded."); return true; } @@ -503,7 +503,7 @@ bool ChatHandler::HandleReloadSpellChainCommand(const char*) bool ChatHandler::HandleReloadSpellElixirCommand(const char*) { sLog.outString( "Re-Loading Spell Elixir types..." ); - spellmgr.LoadSpellElixirs(); + sSpellMgr.LoadSpellElixirs(); SendGlobalSysMessage("DB table `spell_elixir` (spell elixir types) reloaded."); return true; } @@ -511,7 +511,7 @@ bool ChatHandler::HandleReloadSpellElixirCommand(const char*) bool ChatHandler::HandleReloadSpellLearnSpellCommand(const char*) { sLog.outString( "Re-Loading Spell Learn Spells..." ); - spellmgr.LoadSpellLearnSpells(); + sSpellMgr.LoadSpellLearnSpells(); SendGlobalSysMessage("DB table `spell_learn_spell` reloaded."); return true; } @@ -519,7 +519,7 @@ bool ChatHandler::HandleReloadSpellLearnSpellCommand(const char*) bool ChatHandler::HandleReloadSpellProcEventCommand(const char*) { sLog.outString( "Re-Loading Spell Proc Event conditions..." ); - spellmgr.LoadSpellProcEvents(); + sSpellMgr.LoadSpellProcEvents(); SendGlobalSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); return true; } @@ -527,7 +527,7 @@ bool ChatHandler::HandleReloadSpellProcEventCommand(const char*) bool ChatHandler::HandleReloadSpellBonusesCommand(const char*) { sLog.outString( "Re-Loading Spell Bonus Data..." ); - spellmgr.LoadSpellBonusess(); + sSpellMgr.LoadSpellBonusess(); SendGlobalSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; } @@ -535,7 +535,7 @@ bool ChatHandler::HandleReloadSpellBonusesCommand(const char*) bool ChatHandler::HandleReloadSpellProcItemEnchantCommand(const char*) { sLog.outString( "Re-Loading Spell Proc Item Enchant..." ); - spellmgr.LoadSpellProcItemEnchant(); + sSpellMgr.LoadSpellProcItemEnchant(); SendGlobalSysMessage("DB table `spell_proc_item_enchant` (item enchantment ppm) reloaded."); return true; } @@ -543,7 +543,7 @@ bool ChatHandler::HandleReloadSpellProcItemEnchantCommand(const char*) bool ChatHandler::HandleReloadSpellScriptTargetCommand(const char*) { sLog.outString( "Re-Loading SpellsScriptTarget..." ); - spellmgr.LoadSpellScriptTarget(); + sSpellMgr.LoadSpellScriptTarget(); SendGlobalSysMessage("DB table `spell_script_target` (spell targets selection in case specific creature/GO requirements) reloaded."); return true; } @@ -551,7 +551,7 @@ bool ChatHandler::HandleReloadSpellScriptTargetCommand(const char*) bool ChatHandler::HandleReloadSpellTargetPositionCommand(const char*) { sLog.outString( "Re-Loading Spell target coordinates..." ); - spellmgr.LoadSpellTargetPositions(); + sSpellMgr.LoadSpellTargetPositions(); SendGlobalSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); return true; } @@ -559,7 +559,7 @@ bool ChatHandler::HandleReloadSpellTargetPositionCommand(const char*) bool ChatHandler::HandleReloadSpellThreatsCommand(const char*) { sLog.outString( "Re-Loading Aggro Spells Definitions..."); - spellmgr.LoadSpellThreats(); + sSpellMgr.LoadSpellThreats(); SendGlobalSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); return true; } @@ -567,7 +567,7 @@ bool ChatHandler::HandleReloadSpellThreatsCommand(const char*) bool ChatHandler::HandleReloadSpellPetAurasCommand(const char*) { sLog.outString( "Re-Loading Spell pet auras..."); - spellmgr.LoadSpellPetAuras(); + sSpellMgr.LoadSpellPetAuras(); SendGlobalSysMessage("DB table `spell_pet_auras` reloaded."); return true; } @@ -575,7 +575,7 @@ bool ChatHandler::HandleReloadSpellPetAurasCommand(const char*) bool ChatHandler::HandleReloadPageTextsCommand(const char*) { sLog.outString( "Re-Loading Page Texts..." ); - objmgr.LoadPageTexts(); + sObjectMgr.LoadPageTexts(); SendGlobalSysMessage("DB table `page_texts` reloaded."); return true; } @@ -591,7 +591,7 @@ bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*) bool ChatHandler::HandleReloadItemRequiredTragetCommand(const char*) { sLog.outString( "Re-Loading Item Required Targets Table..." ); - objmgr.LoadItemRequiredTarget(); + sObjectMgr.LoadItemRequiredTarget(); SendGlobalSysMessage("DB table `item_required_target` reloaded."); return true; } @@ -616,7 +616,7 @@ bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg) if(*arg!='a') sLog.outString( "Re-Loading Scripts from `gameobject_scripts`..."); - objmgr.LoadGameObjectScripts(); + sObjectMgr.LoadGameObjectScripts(); if(*arg!='a') SendGlobalSysMessage("DB table `gameobject_scripts` reloaded."); @@ -636,7 +636,7 @@ bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg) if(*arg!='a') sLog.outString( "Re-Loading Scripts from `event_scripts`..."); - objmgr.LoadEventScripts(); + sObjectMgr.LoadEventScripts(); if(*arg!='a') SendGlobalSysMessage("DB table `event_scripts` reloaded."); @@ -648,7 +648,7 @@ bool ChatHandler::HandleReloadEventAITextsCommand(const char* arg) { sLog.outString( "Re-Loading Texts from `creature_ai_texts`..."); - CreatureEAI_Mgr.LoadCreatureEventAI_Texts(true); + sEventAIMgr.LoadCreatureEventAI_Texts(true); SendGlobalSysMessage("DB table `creature_ai_texts` reloaded."); return true; } @@ -656,7 +656,7 @@ bool ChatHandler::HandleReloadEventAITextsCommand(const char* arg) bool ChatHandler::HandleReloadEventAISummonsCommand(const char* arg) { sLog.outString( "Re-Loading Summons from `creature_ai_summons`..."); - CreatureEAI_Mgr.LoadCreatureEventAI_Summons(true); + sEventAIMgr.LoadCreatureEventAI_Summons(true); SendGlobalSysMessage("DB table `creature_ai_summons` reloaded."); return true; } @@ -664,7 +664,7 @@ bool ChatHandler::HandleReloadEventAISummonsCommand(const char* arg) bool ChatHandler::HandleReloadEventAIScriptsCommand(const char* arg) { sLog.outString( "Re-Loading Scripts from `creature_ai_scripts`..."); - CreatureEAI_Mgr.LoadCreatureEventAI_Scripts(); + sEventAIMgr.LoadCreatureEventAI_Scripts(); SendGlobalSysMessage("DB table `creature_ai_scripts` reloaded."); return true; } @@ -681,7 +681,7 @@ bool ChatHandler::HandleReloadQuestEndScriptsCommand(const char* arg) if(*arg!='a') sLog.outString( "Re-Loading Scripts from `quest_end_scripts`..."); - objmgr.LoadQuestEndScripts(); + sObjectMgr.LoadQuestEndScripts(); if(*arg!='a') SendGlobalSysMessage("DB table `quest_end_scripts` reloaded."); @@ -701,7 +701,7 @@ bool ChatHandler::HandleReloadQuestStartScriptsCommand(const char* arg) if(*arg!='a') sLog.outString( "Re-Loading Scripts from `quest_start_scripts`..."); - objmgr.LoadQuestStartScripts(); + sObjectMgr.LoadQuestStartScripts(); if(*arg!='a') SendGlobalSysMessage("DB table `quest_start_scripts` reloaded."); @@ -721,7 +721,7 @@ bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg) if(*arg!='a') sLog.outString( "Re-Loading Scripts from `spell_scripts`..."); - objmgr.LoadSpellScripts(); + sObjectMgr.LoadSpellScripts(); if(*arg!='a') SendGlobalSysMessage("DB table `spell_scripts` reloaded."); @@ -732,7 +732,7 @@ bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg) bool ChatHandler::HandleReloadDbScriptStringCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Script strings from `db_script_string`..."); - objmgr.LoadDbScriptStrings(); + sObjectMgr.LoadDbScriptStrings(); SendGlobalSysMessage("DB table `db_script_string` reloaded."); return true; } @@ -741,7 +741,7 @@ bool ChatHandler::HandleReloadGameGraveyardZoneCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Graveyard-zone links..."); - objmgr.LoadGraveyardZones(); + sObjectMgr.LoadGraveyardZones(); SendGlobalSysMessage("DB table `game_graveyard_zone` reloaded."); @@ -752,7 +752,7 @@ bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Game Tele coordinates..."); - objmgr.LoadGameTele(); + sObjectMgr.LoadGameTele(); SendGlobalSysMessage("DB table `game_tele` reloaded."); @@ -762,7 +762,7 @@ bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*) { sLog.outString( "Re-Loading Locales Achievement Reward Data..." ); - achievementmgr.LoadRewardLocales(); + sAchievementMgr.LoadRewardLocales(); SendGlobalSysMessage("DB table `locales_achievement_reward` reloaded."); return true; } @@ -770,7 +770,7 @@ bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*) bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Creature ..."); - objmgr.LoadCreatureLocales(); + sObjectMgr.LoadCreatureLocales(); SendGlobalSysMessage("DB table `locales_creature` reloaded."); return true; } @@ -778,7 +778,7 @@ bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Gameobject ... "); - objmgr.LoadGameObjectLocales(); + sObjectMgr.LoadGameObjectLocales(); SendGlobalSysMessage("DB table `locales_gameobject` reloaded."); return true; } @@ -786,7 +786,7 @@ bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Item ... "); - objmgr.LoadItemLocales(); + sObjectMgr.LoadItemLocales(); SendGlobalSysMessage("DB table `locales_item` reloaded."); return true; } @@ -794,7 +794,7 @@ bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales NPC Text ... "); - objmgr.LoadNpcTextLocales(); + sObjectMgr.LoadNpcTextLocales(); SendGlobalSysMessage("DB table `locales_npc_text` reloaded."); return true; } @@ -802,7 +802,7 @@ bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Page Text ... "); - objmgr.LoadPageTextLocales(); + sObjectMgr.LoadPageTextLocales(); SendGlobalSysMessage("DB table `locales_page_text` reloaded."); return true; } @@ -810,7 +810,7 @@ bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) bool ChatHandler::HandleReloadLocalesPointsOfInterestCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Points Of Interest ... "); - objmgr.LoadPointOfInterestLocales(); + sObjectMgr.LoadPointOfInterestLocales(); SendGlobalSysMessage("DB table `locales_points_of_interest` reloaded."); return true; } @@ -818,7 +818,7 @@ bool ChatHandler::HandleReloadLocalesPointsOfInterestCommand(const char* /*arg*/ bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Quest ... "); - objmgr.LoadQuestLocales(); + sObjectMgr.LoadQuestLocales(); SendGlobalSysMessage("DB table `locales_quest` reloaded."); return true; } @@ -826,7 +826,7 @@ bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) bool ChatHandler::HandleReloadMailLevelRewardCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Player level dependent mail rewards..." ); - objmgr.LoadMailLevelRewards(); + sObjectMgr.LoadMailLevelRewards(); SendGlobalSysMessage("DB table `mail_level_reward` reloaded."); return true; } @@ -1086,7 +1086,7 @@ bool ChatHandler::HandleUnLearnCommand(const char* args) } if(allRanks) - spell_id = spellmgr.GetFirstSpellInChain (spell_id); + spell_id = sSpellMgr.GetFirstSpellInChain (spell_id); if (target->HasSpell(spell_id)) target->removeSpell(spell_id,false,!allRanks); @@ -1837,7 +1837,7 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) continue; // skip spells with first rank learned as talent (and all talents then also) - uint32 first_rank = spellmgr.GetFirstSpellInChain(spellInfo->Id); + uint32 first_rank = sSpellMgr.GetFirstSpellInChain(spellInfo->Id); if(GetTalentSpellCost(first_rank) > 0 ) continue; @@ -2038,7 +2038,7 @@ bool ChatHandler::HandleLearnCommand(const char* args) else targetPlayer->learnSpell(spell,false); - uint32 first_spell = spellmgr.GetFirstSpellInChain(spell); + uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell); if(GetTalentSpellCost(first_spell)) targetPlayer->SendTalentsInfoData(false); @@ -2622,7 +2622,7 @@ bool ChatHandler::HandleLookupItemCommand(const char* args) int loc_idx = GetSessionDbLocaleIndex(); if ( loc_idx >= 0 ) { - ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); + ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId); if (il) { if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) @@ -2860,7 +2860,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) // unit32 used to prevent interpreting uint8 as char at output // find rank of learned spell for learning spell, or talent rank - uint32 rank = talentCost ? talentCost : spellmgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); + uint32 rank = talentCost ? talentCost : sSpellMgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format std::ostringstream ss; @@ -2919,7 +2919,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) uint32 counter = 0 ; - ObjectMgr::QuestMap const& qTemplates = objmgr.GetQuestTemplates(); + ObjectMgr::QuestMap const& qTemplates = sObjectMgr.GetQuestTemplates(); for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter) { Quest * qinfo = iter->second; @@ -2927,7 +2927,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) int loc_idx = GetSessionDbLocaleIndex(); if ( loc_idx >= 0 ) { - QuestLocale const *il = objmgr.GetQuestLocale(qinfo->GetQuestId()); + QuestLocale const *il = sObjectMgr.GetQuestLocale(qinfo->GetQuestId()); if (il) { if (il->Title.size() > loc_idx && !il->Title[loc_idx].empty()) @@ -3027,7 +3027,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char* args) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - CreatureLocale const *cl = objmgr.GetCreatureLocale (id); + CreatureLocale const *cl = sObjectMgr.GetCreatureLocale (id); if (cl) { if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty ()) @@ -3092,7 +3092,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args) int loc_idx = GetSessionDbLocaleIndex(); if ( loc_idx >= 0 ) { - GameObjectLocale const *gl = objmgr.GetGameObjectLocale(id); + GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(id); if (gl) { if (gl->Name.size() > loc_idx && !gl->Name[loc_idx].empty()) @@ -3237,7 +3237,7 @@ bool ChatHandler::HandleGuildCreateCommand(const char* args) return false; } - objmgr.AddGuild (guild); + sObjectMgr.AddGuild (guild); return true; } @@ -3260,7 +3260,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args) return false; std::string glName = guildStr; - Guild* targetGuild = objmgr.GetGuildByName (glName); + Guild* targetGuild = sObjectMgr.GetGuildByName (glName); if (!targetGuild) return false; @@ -3282,7 +3282,7 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args) if (!glId) return false; - Guild* targetGuild = objmgr.GetGuildById (glId); + Guild* targetGuild = sObjectMgr.GetGuildById (glId); if (!targetGuild) return false; @@ -3308,7 +3308,7 @@ bool ChatHandler::HandleGuildRankCommand(const char *args) if (!glId) return false; - Guild* targetGuild = objmgr.GetGuildById (glId); + Guild* targetGuild = sObjectMgr.GetGuildById (glId); if (!targetGuild) return false; @@ -3331,7 +3331,7 @@ bool ChatHandler::HandleGuildDeleteCommand(const char* args) std::string gld = guildStr; - Guild* targetGuild = objmgr.GetGuildByName (gld); + Guild* targetGuild = sObjectMgr.GetGuildByName (gld); if (!targetGuild) return false; @@ -3515,7 +3515,7 @@ bool ChatHandler::HandleReviveCommand(const char* args) } else // will resurrected at login without corpse - objaccessor.ConvertCorpseForPlayer(target_guid); + sObjectAccessor.ConvertCorpseForPlayer(target_guid); return true; } @@ -3626,7 +3626,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char* args) return false; } - if(objmgr.AddGraveYardLink(g_id,zoneId,g_team)) + if(sObjectMgr.AddGraveYardLink(g_id,zoneId,g_team)) PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id,zoneId); else PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id,zoneId); @@ -3652,14 +3652,14 @@ bool ChatHandler::HandleNearGraveCommand(const char* args) Player* player = m_session->GetPlayer(); uint32 zone_id = player->GetZoneId(); - WorldSafeLocsEntry const* graveyard = objmgr.GetClosestGraveYard( + WorldSafeLocsEntry const* graveyard = sObjectMgr.GetClosestGraveYard( player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(),player->GetMapId(),g_team); if(graveyard) { uint32 g_id = graveyard->ID; - GraveYardData const* data = objmgr.FindGraveYardData(g_id,zone_id); + GraveYardData const* data = sObjectMgr.FindGraveYardData(g_id,zone_id); if (!data) { PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR,g_id); @@ -4164,7 +4164,7 @@ bool ChatHandler::HandleTeleAddCommand(const char * args) std::string name = args; - if(objmgr.GetGameTele(name)) + if(sObjectMgr.GetGameTele(name)) { SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST); SetSentErrorMessage(true); @@ -4179,7 +4179,7 @@ bool ChatHandler::HandleTeleAddCommand(const char * args) tele.mapId = player->GetMapId(); tele.name = name; - if(objmgr.AddGameTele(tele)) + if(sObjectMgr.AddGameTele(tele)) { SendSysMessage(LANG_COMMAND_TP_ADDED); } @@ -4200,7 +4200,7 @@ bool ChatHandler::HandleTeleDelCommand(const char * args) std::string name = args; - if(!objmgr.DeleteGameTele(name)) + if(!sObjectMgr.DeleteGameTele(name)) { SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); SetSentErrorMessage(true); @@ -4517,7 +4517,7 @@ bool ChatHandler::HandleResetAllCommand(const char * args) } CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin); - HashMapHolder::MapType const& plist = objaccessor.GetPlayers(); + HashMapHolder::MapType const& plist = sObjectAccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) itr->second->SetAtLoginFlag(atLogin); @@ -4688,7 +4688,7 @@ bool ChatHandler::HandleQuestAdd(const char* args) uint32 entry = atol(cId); - Quest const* pQuest = objmgr.GetQuestTemplate(entry); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry); if(!pQuest) { @@ -4742,7 +4742,7 @@ bool ChatHandler::HandleQuestRemove(const char* args) uint32 entry = atol(cId); - Quest const* pQuest = objmgr.GetQuestTemplate(entry); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry); if(!pQuest) { @@ -4792,7 +4792,7 @@ bool ChatHandler::HandleQuestComplete(const char* args) uint32 entry = atol(cId); - Quest const* pQuest = objmgr.GetQuestTemplate(entry); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry); // If player doesn't have the quest if(!pQuest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE) @@ -5044,7 +5044,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char* args) if (!extractPlayerTarget((char*)args,&target,&target_guid)) return false; - uint32 accountid = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); + uint32 accountid = target ? target->GetSession()->GetAccountId() : sObjectMgr.GetPlayerAccountIdByGUID(target_guid); std::string accountname; if (!accmgr.GetName(accountid,accountname)) @@ -5456,7 +5456,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) return false; } - if (objmgr.GetPlayerAccountIdByGUID(guid)) + if (sObjectMgr.GetPlayerAccountIdByGUID(guid)) { PSendSysMessage(LANG_CHARACTER_GUID_IN_USE,guid); SetSentErrorMessage(true); @@ -5515,10 +5515,10 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args) return false; } - guid = objmgr.GetPlayerGUIDByName(name); + guid = sObjectMgr.GetPlayerGUIDByName(name); } - if(!objmgr.GetPlayerAccountIdByGUID(guid)) + if(!sObjectMgr.GetPlayerAccountIdByGUID(guid)) { PSendSysMessage(LANG_PLAYER_NOT_FOUND); SetSentErrorMessage(true); @@ -6014,11 +6014,11 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/) { - PSendSysMessage("instances loaded: %d", mapmgr.GetNumInstances()); - PSendSysMessage("players in instances: %d", mapmgr.GetNumPlayersInInstances()); - PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves()); - PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal()); - PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal()); + PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances()); + PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances()); + PSendSysMessage("instance saves: %d", sInstanceSaveMgr.GetNumInstanceSaves()); + PSendSysMessage("players bound: %d", sInstanceSaveMgr.GetNumBoundPlayersTotal()); + PSendSysMessage("groups bound: %d", sInstanceSaveMgr.GetNumBoundGroupsTotal()); return true; } @@ -6227,7 +6227,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args) // from console show not existed sender MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0; + uint32 itemTextId = !text.empty() ? sObjectMgr.CreateItemText( text ) : 0; // fill mail MailDraft draft(subject, itemTextId); @@ -6287,7 +6287,7 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args) // from console show not existed sender MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); - uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0; + uint32 itemTextId = !text.empty() ? sObjectMgr.CreateItemText( text ) : 0; MailDraft(subject, itemTextId) .AddMoney(money) @@ -6349,7 +6349,7 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args) return false; } - PlayerInfo const* info = objmgr.GetPlayerInfo(player->getRace(), player->getClass()); + PlayerInfo const* info = sObjectMgr.GetPlayerInfo(player->getRace(), player->getClass()); if(!info) return false; diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 2efe2d619..8600c749b 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -133,7 +133,7 @@ void LootStore::LoadLootTable() } // (condition + cond_value1/2) are converted into single conditionId - uint16 conditionId = objmgr.GetConditionId(condition, cond_value1, cond_value2); + uint16 conditionId = sObjectMgr.GetConditionId(condition, cond_value1, cond_value2); LootStoreItem storeitem = LootStoreItem(item, chanceOrQuestChance, group, conditionId, mincountOrRef, maxcount); @@ -337,7 +337,7 @@ LootItem::LootItem(LootStoreItem const& li) bool LootItem::AllowedForPlayer(Player const * player) const { // DB conditions check - if ( !objmgr.IsPlayerMeetToCondition(player,conditionId) ) + if ( !sObjectMgr.IsPlayerMeetToCondition(player,conditionId) ) return false; if ( needs_quest ) diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 67aabcd06..061bfbb99 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -91,7 +91,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) uint64 rc = 0; if (normalizePlayerName(receiver)) - rc = objmgr.GetPlayerGUIDByName(receiver); + rc = sObjectMgr.GetPlayerGUIDByName(receiver); if (!rc) { @@ -119,7 +119,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) return; } - Player *receive = objmgr.GetPlayer(rc); + Player *receive = sObjectMgr.GetPlayer(rc); uint32 rc_team = 0; uint8 mails_count = 0; // do not allow to send to one player more than 100 mails @@ -131,7 +131,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) } else { - rc_team = objmgr.GetPlayerTeamByGUID(rc); + rc_team = sObjectMgr.GetPlayerTeamByGUID(rc); if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc))) { Field *fields = result->Fetch(); @@ -156,7 +156,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) uint32 rc_account = receive ? receive->GetSession()->GetAccountId() - : objmgr.GetPlayerAccountIdByGUID(rc); + : sObjectMgr.GetPlayerAccountIdByGUID(rc); Item* items[MAX_MAIL_ITEMS]; @@ -206,7 +206,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) pl->SendMailResult(0, MAIL_SEND, MAIL_OK); - uint32 itemTextId = !body.empty() ? objmgr.CreateItemText( body ) : 0; + uint32 itemTextId = !body.empty() ? sObjectMgr.CreateItemText( body ) : 0; pl->ModifyMoney( -int32(reqmoney) ); pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost); @@ -415,7 +415,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) if (m->COD > 0) // if there is COD, take COD money from player and send them to sender by mail { uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER); - Player *receive = objmgr.GetPlayer(sender_guid); + Player *receive = sObjectMgr.GetPlayer(sender_guid); uint32 sender_accId = 0; @@ -430,16 +430,16 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) else { // can be calculated early - sender_accId = objmgr.GetPlayerAccountIdByGUID(sender_guid); + sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid); - if(!objmgr.GetPlayerNameByGUID(sender_guid, sender_name)) - sender_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); + if(!sObjectMgr.GetPlayerNameByGUID(sender_guid, sender_name)) + sender_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); } sLog.outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); } else if(!receive) - sender_accId = objmgr.GetPlayerAccountIdByGUID(sender_guid); + sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid); // check player existence if(receive || sender_accId) @@ -650,7 +650,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket & recv_data ) WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10));// guess size data << itemTextId; - data << objmgr.GetItemText( itemTextId ); + data << sObjectMgr.GetItemText( itemTextId ); SendPacket(&data); } @@ -688,11 +688,11 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) return; } - itemTextId = objmgr.CreateItemText(mailTemplateEntry->content[GetSessionDbcLocale()]); + itemTextId = sObjectMgr.CreateItemText(mailTemplateEntry->content[GetSessionDbcLocale()]); } Item *bodyItem = new Item; // This is not bag and then can be used new Item. - if(!bodyItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl)) + if(!bodyItem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl)) { delete bodyItem; return; @@ -871,11 +871,11 @@ void MailDraft::deleteIncludedItems( bool inDB /*= false*/ ) void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid ) { - Player *receiver = objmgr.GetPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); + Player *receiver = sObjectMgr.GetPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); uint32 rc_account = 0; if(!receiver) - rc_account = objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); + rc_account = sObjectMgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER)); if(!receiver && !rc_account) // sender not exist { @@ -918,7 +918,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende prepareItems(pReceiver); // generate mail template items - uint32 mailId = objmgr.GenerateMailID(); + uint32 mailId = sObjectMgr.GenerateMailID(); time_t deliver_time = time(NULL) + deliver_delay; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 638b20ae9..aa38ed34b 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -323,7 +323,7 @@ void Map::DeleteFromWorld(T* obj) template<> void Map::DeleteFromWorld(Player* pl) { - objaccessor.RemoveObject(pl); + sObjectAccessor.RemoveObject(pl); delete pl; } @@ -411,7 +411,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) loader.LoadN(); // Add resurrectable corpses to world object list in grid - objaccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this); + sObjectAccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this); setGridObjectDataLoaded(true,cell.GridX(), cell.GridY()); return true; @@ -2059,7 +2059,7 @@ void Map::SendInitSelf( Player * player ) void Map::SendInitTransports( Player * player ) { // Hack to send out transports - MapManager::TransportMap& tmap = mapmgr.m_TransportsByMap; + MapManager::TransportMap& tmap = sMapMgr.m_TransportsByMap; // no transports at map if (tmap.find(player->GetMapId()) == tmap.end()) @@ -2086,7 +2086,7 @@ void Map::SendInitTransports( Player * player ) void Map::SendRemoveTransports( Player * player ) { // Hack to send out transports - MapManager::TransportMap& tmap = mapmgr.m_TransportsByMap; + MapManager::TransportMap& tmap = sMapMgr.m_TransportsByMap; // no transports at map if (tmap.find(player->GetMapId()) == tmap.end()) @@ -2359,11 +2359,11 @@ bool InstanceMap::Add(Player *player) if(IsDungeon()) { // get or create an instance save for the map - InstanceSave *mapSave = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); + InstanceSave *mapSave = sInstanceSaveMgr.GetInstanceSave(GetInstanceId()); if(!mapSave) { sLog.outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); - mapSave = sInstanceSaveManager.AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true); + mapSave = sInstanceSaveMgr.AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true); } // check for existing instance binds @@ -2493,7 +2493,7 @@ void InstanceMap::CreateInstanceData(bool load) const char* data = fields[0].GetString(); if(data) { - sLog.outDebug("Loading instance data for `%s` with id %u", objmgr.GetScriptName(i_script_id), i_InstanceId); + sLog.outDebug("Loading instance data for `%s` with id %u", sObjectMgr.GetScriptName(i_script_id), i_InstanceId); i_data->Load(data); } delete result; @@ -2501,7 +2501,7 @@ void InstanceMap::CreateInstanceData(bool load) } else { - sLog.outDebug("New instance data, \"%s\" ,initialized!", objmgr.GetScriptName(i_script_id)); + sLog.outDebug("New instance data, \"%s\" ,initialized!", sObjectMgr.GetScriptName(i_script_id)); i_data->Initialize(); } } @@ -2552,7 +2552,7 @@ void InstanceMap::PermBindAllPlayers(Player *player) if(!IsDungeon()) return; - InstanceSave *save = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); + InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(GetInstanceId()); if(!save) { sLog.outError("Cannot bind players, no instance save available for map!"); @@ -2594,7 +2594,7 @@ void InstanceMap::UnloadAll(bool pForce) } if(m_resetAfterUnload == true) - objmgr.DeleteRespawnTimeForInstance(GetInstanceId()); + sObjectMgr.DeleteRespawnTimeForInstance(GetInstanceId()); Map::UnloadAll(pForce); } @@ -2612,9 +2612,9 @@ void InstanceMap::SetResetSchedule(bool on) // it is assumed that the reset time will rarely (if ever) change while the reset is scheduled if(IsDungeon() && !HavePlayers() && !IsRaid() && !IsHeroic()) { - InstanceSave *save = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); + InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(GetInstanceId()); if(!save) sLog.outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, no save available for instance %d of %d", on ? "on" : "off", GetInstanceId(), GetId()); - else sInstanceSaveManager.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), GetInstanceId())); + else sInstanceSaveMgr.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), GetInstanceId())); } } diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 4d1246d1a..1b76f731c 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -166,7 +166,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player) { // if no instanceId via group members or instance saves is found // the instance will be created for the first time - NewInstanceId = mapmgr.GenerateInstanceId(); + NewInstanceId = sMapMgr.GenerateInstanceId(); Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid()); map = CreateInstance(NewInstanceId, NULL, diff); diff --git a/src/game/MapManager.h b/src/game/MapManager.h index ea17d4ae4..3586845d5 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -155,6 +155,6 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton::MapType& m = objaccessor.GetPlayers(); + HashMapHolder::MapType& m = sObjectAccessor.GetPlayers(); for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if (security == SEC_PLAYER) @@ -204,7 +204,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos)) continue; - std::string gname = objmgr.GetGuildNameById(itr->second->GetGuildId()); + std::string gname = sObjectMgr.GetGuildNameById(itr->second->GetGuildId()); std::wstring wgname; if(!Utf8toWStr(gname,wgname)) continue; @@ -754,10 +754,10 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if(Script->scriptAreaTrigger(GetPlayer(), atEntry)) return; - uint32 quest_id = objmgr.GetQuestForAreaTrigger( Trigger_ID ); + uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger( Trigger_ID ); if( quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id) ) { - Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); if( pQuest ) { if(GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE) @@ -765,7 +765,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } } - if(objmgr.IsTavernAreaTrigger(Trigger_ID)) + if(sObjectMgr.IsTavernAreaTrigger(Trigger_ID)) { // set resting flag we are in the inn GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); @@ -787,7 +787,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } // NULL if all values default (non teleport trigger) - AreaTrigger const* at = objmgr.GetAreaTrigger(Trigger_ID); + AreaTrigger const* at = sObjectMgr.GetAreaTrigger(Trigger_ID); if(!at) return; @@ -1129,7 +1129,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) _player->SetSelection(guid); - Player *plr = objmgr.GetPlayer(guid); + Player *plr = sObjectMgr.GetPlayer(guid); if(!plr) // wrong player return; @@ -1157,7 +1157,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) uint64 guid; recv_data >> guid; - Player *player = objmgr.GetPlayer(guid); + Player *player = sObjectMgr.GetPlayer(guid); if(!player) { @@ -1230,7 +1230,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) return; } - Player *plr = objmgr.GetPlayer(charname.c_str()); + Player *plr = sObjectMgr.GetPlayer(charname.c_str()); if(!plr) { @@ -1554,7 +1554,7 @@ void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) if(!recv_data.readPackGUID(guid)) return; - if(Player *player = objmgr.GetPlayer(guid)) + if(Player *player = sObjectMgr.GetPlayer(guid)) player->GetAchievementMgr().SendRespondInspectAchievements(_player); } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index b71ab4f04..74951decf 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -65,7 +65,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SetSemaphoreTeleportFar(false); // relocate the player to the teleport destination - GetPlayer()->SetMap(mapmgr.CreateMap(loc.mapid, GetPlayer())); + GetPlayer()->SetMap(sMapMgr.CreateMap(loc.mapid, GetPlayer())); GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation); GetPlayer()->SendInitialPacketsBeforeAddToMap(); @@ -141,14 +141,14 @@ void WorldSession::HandleMoveWorldportAckOpcode() { if(mEntry->IsRaid()) { - uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); + uint32 timeleft = sInstanceSaveMgr.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetRaidDifficulty(), timeleft); } else if(mEntry->IsNonRaidDungeon() && GetPlayer()->GetDungeonDifficulty() > DUNGEON_DIFFICULTY_NORMAL) { if(MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,GetPlayer()->GetDungeonDifficulty())) { - uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); + uint32 timeleft = sInstanceSaveMgr.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL); GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDungeonDifficulty(), timeleft); } } @@ -274,7 +274,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) if (plMover && !plMover->m_transport) { // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list - for (MapManager::TransportSet::const_iterator iter = mapmgr.m_Transports.begin(); iter != mapmgr.m_Transports.end(); ++iter) + for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter) { if ((*iter)->GetGUID() == movementInfo.t_guid) { diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 0d5aadf7f..dd41863ee 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -157,8 +157,8 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell)) continue; - bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); - SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(tSpell->learnedSpell); + bool primary_prof_first_rank = sSpellMgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); + SpellChainNode const* chain_node = sSpellMgr.GetSpellChainNode(tSpell->learnedSpell); TrainerSpellState state = _player->GetTrainerSpellState(tSpell); data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) @@ -356,7 +356,7 @@ void WorldSession::SendSpiritResurrect() WorldSafeLocsEntry const *corpseGrave = NULL; Corpse *corpse = _player->GetCorpse(); if(corpse) - corpseGrave = objmgr.GetClosestGraveYard( + corpseGrave = sObjectMgr.GetClosestGraveYard( corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam() ); // now can spawn bones @@ -365,7 +365,7 @@ void WorldSession::SendSpiritResurrect() // teleport to nearest from corpse graveyard, if different from nearest to player ghost if(corpseGrave) { - WorldSafeLocsEntry const *ghostGrave = objmgr.GetClosestGraveYard( + WorldSafeLocsEntry const *ghostGrave = sObjectMgr.GetClosestGraveYard( _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam() ); if(corpseGrave != ghostGrave) @@ -829,7 +829,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data ) uint32 GuildId = _player->GetGuildId(); if (!GuildId) return; - Guild *pGuild = objmgr.GetGuildById(GuildId); + Guild *pGuild = sObjectMgr.GetGuildById(GuildId); if (!pGuild) return; pGuild->LogBankEvent(GUILD_BANK_LOG_REPAIR_MONEY, 0, _player->GetGUIDLow(), TotalCost); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 9a5555ad3..c1e724804 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1457,7 +1457,7 @@ void WorldObject::MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsB void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper) { - Player *player = objmgr.GetPlayer(receiver); + Player *player = sObjectMgr.GetPlayer(receiver); if(!player || !player->GetSession()) return; @@ -1476,7 +1476,7 @@ namespace MaNGOS : i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_targetGUID(targetGUID) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); // TODO: i_object.GetName() also must be localized? i_object.BuildMonsterChat(&data,i_msgtype,text,i_language,i_object.GetNameForLocaleIdx(loc_idx),i_targetGUID); @@ -1554,12 +1554,12 @@ void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossE void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper) { - Player *player = objmgr.GetPlayer(receiver); + Player *player = sObjectMgr.GetPlayer(receiver); if(!player || !player->GetSession()) return; uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); - char const* text = objmgr.GetMangosString(textId,loc_idx); + char const* text = sObjectMgr.GetMangosString(textId,loc_idx); WorldPacket data(SMSG_MESSAGECHAT, 200); BuildMonsterChat(&data,IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER,text,LANG_UNIVERSAL,GetNameForLocaleIdx(loc_idx),receiver); @@ -1589,7 +1589,7 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) { //if object is in world, map for it already created! - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); if(_map) _map->MessageBroadcast(this, data); } @@ -1597,7 +1597,7 @@ void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/) { //if object is in world, map for it already created! - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); if(_map) _map->MessageDistBroadcast(this, data, dist); } @@ -1637,7 +1637,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa if (GetTypeId()==TYPEID_PLAYER) team = ((Player*)this)->GetTeam(); - if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMap(), GetPhaseMask(), id, team)) + if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), GetMap(), GetPhaseMask(), id, team)) { delete pCreature; return NULL; diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 40f5b3307..0599afb62 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -186,7 +186,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse) CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - objmgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID()); + sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID()); corpse->RemoveFromWorld(); i_player2corpse.erase(iter); @@ -205,7 +205,7 @@ ObjectAccessor::AddCorpse(Corpse *corpse) CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - objmgr.AddCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID(), corpse->GetInstanceId()); + sObjectMgr.AddCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID(), corpse->GetInstanceId()); } void @@ -249,7 +249,7 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia) // remove resurrectable corpse from grid object registry (loaded state checked into call) // do not load the map if it's not loaded - Map *map = mapmgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId()); + Map *map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId()); if(map) map->Remove(corpse, false); diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index f2aacd985..dc573c85a 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -168,6 +168,6 @@ inline Unit* ObjectAccessor::GetUnitInWorld(WorldObject const& obj, uint64 guid) return GetCreatureInWorld(guid); } -#define objaccessor ObjectAccessor::Instance() +#define sObjectAccessor ObjectAccessor::Instance() #endif diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 6b4918616..506cac16e 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -147,7 +147,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType uint32 player_guid = itr->first; - Corpse *obj = objaccessor.GetCorpseForPlayerGUID(player_guid); + Corpse *obj = sObjectAccessor.GetCorpseForPlayerGUID(player_guid); if(!obj) continue; @@ -171,7 +171,7 @@ ObjectGridLoader::Visit(GameObjectMapType &m) CellPair cell_pair(x,y); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - CellObjectGuids const& cell_guids = objmgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); + CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); LoadHelper(cell_guids.gameobjects, cell_pair, m, i_gameObjects, i_map); } @@ -184,7 +184,7 @@ ObjectGridLoader::Visit(CreatureMapType &m) CellPair cell_pair(x,y); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - CellObjectGuids const& cell_guids = objmgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); + CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); LoadHelper(cell_guids.creatures, cell_pair, m, i_creatures, i_map); } @@ -198,7 +198,7 @@ ObjectWorldLoader::Visit(CorpseMapType &m) uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; // corpses are always added to spawn mode 0 and they are spawned by their instance id - CellObjectGuids const& cell_guids = objmgr.GetCellObjectGuids(i_map->GetId(), 0, cell_id); + CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), 0, cell_id); LoadHelper(cell_guids.corpses, cell_pair, m, i_corpses, i_map); } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 49ca02192..20ec90844 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -461,7 +461,7 @@ struct SQLCreatureLoader : public SQLStorageLoaderBase template void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { - dst = D(objmgr.GetScriptId(src)); + dst = D(sObjectMgr.GetScriptId(src)); } }; @@ -1653,7 +1653,7 @@ struct SQLItemLoader : public SQLStorageLoaderBase template void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { - dst = D(objmgr.GetScriptId(src)); + dst = D(sObjectMgr.GetScriptId(src)); } }; @@ -2124,7 +2124,7 @@ void ObjectMgr::LoadItemRequiredTarget() if (pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE || pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) { - SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(pSpellInfo->Id); + SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(pSpellInfo->Id); if (bounds.first != bounds.second) break; @@ -3224,7 +3224,7 @@ void ObjectMgr::LoadGroups() diff = 0; // default for both difficaly types } - InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); + InstanceSave *save = sInstanceSaveMgr.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); group->BindToInstance(save, fields[3].GetBool(), true); }while( result->NextRow() ); delete result; @@ -4099,7 +4099,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) continue; } - // if(!objmgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading + // if(!sObjectMgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading break; } @@ -4564,7 +4564,7 @@ struct SQLInstanceLoader : public SQLStorageLoaderBase template void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { - dst = D(objmgr.GetScriptId(src)); + dst = D(sObjectMgr.GetScriptId(src)); } }; @@ -5111,11 +5111,11 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al if (!mount_info) return 0; - uint16 mount_id = objmgr.ChooseDisplayId(team,mount_info); + uint16 mount_id = sObjectMgr.ChooseDisplayId(team,mount_info); if (!mount_id) return 0; - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(mount_id); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(mount_id); if (minfo) mount_id = minfo->modelid; @@ -5232,7 +5232,7 @@ void ObjectMgr::LoadGraveyardZones() WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team) { // search for zone associated closest graveyard - uint32 zoneId = mapmgr.GetZoneId(MapId,x,y,z); + uint32 zoneId = sMapMgr.GetZoneId(MapId,x,y,z); // Simulate std. algorithm: // found some graveyard associated to (ghost_zone,ghost_map) @@ -5834,7 +5834,7 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBase template void convert_from_str(uint32 /*field_pos*/, char *src, D &dst) { - dst = D(objmgr.GetScriptId(src)); + dst = D(sObjectMgr.GetScriptId(src)); } }; @@ -6225,7 +6225,7 @@ void ObjectMgr::LoadCorpses() continue; } - objaccessor.AddCorpse(corpse); + sObjectAccessor.AddCorpse(corpse); ++count; } @@ -7349,7 +7349,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val case CONDITION_QUESTREWARDED: case CONDITION_QUESTTAKEN: { - Quest const *Quest = objmgr.GetQuestTemplate(value1); + Quest const *Quest = sObjectMgr.GetQuestTemplate(value1); if (!Quest) { sLog.outErrorDb("Quest condition specifies non-existing quest (%u), skipped", value1); @@ -8086,7 +8086,7 @@ void ObjectMgr::LoadDbScriptStrings() CheckScripts(sGameObjectScripts,ids); CheckScripts(sEventScripts,ids); - WaypointMgr.CheckTextsExistance(ids); + sWaypointMgr.CheckTextsExistance(ids); for(std::set::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) sLog.outErrorDb( "Table `db_script_string` has unused string id %u", *itr); @@ -8095,7 +8095,7 @@ void ObjectMgr::LoadDbScriptStrings() // Functions for scripting access uint32 GetAreaTriggerScriptId(uint32 trigger_id) { - return objmgr.GetAreaTriggerScriptId(trigger_id); + return sObjectMgr.GetAreaTriggerScriptId(trigger_id); } bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value) @@ -8108,17 +8108,17 @@ bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, in return false; } - return objmgr.LoadMangosStrings(db,table,start_value,end_value); + return sObjectMgr.LoadMangosStrings(db,table,start_value,end_value); } uint32 MANGOS_DLL_SPEC GetScriptId(const char *name) { - return objmgr.GetScriptId(name); + return sObjectMgr.GetScriptId(name); } ObjectMgr::ScriptNameMap & GetScriptNames() { - return objmgr.GetScriptNames(); + return sObjectMgr.GetScriptNames(); } CreatureInfo const* GetCreatureTemplateStore(uint32 entry) @@ -8128,5 +8128,5 @@ CreatureInfo const* GetCreatureTemplateStore(uint32 entry) Quest const* GetQuestTemplateStore(uint32 entry) { - return objmgr.GetQuestTemplate(entry); + return sObjectMgr.GetQuestTemplate(entry); } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 1b34021c6..e4c90aadb 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -920,7 +920,7 @@ class ObjectMgr CacheTrainerSpellMap m_mCacheTrainerSpellMap; }; -#define objmgr MaNGOS::Singleton::Instance() +#define sObjectMgr MaNGOS::Singleton::Instance() // scripting access functions MANGOS_DLL_SPEC bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value = MAX_CREATURE_AI_TEXT_STRING_ID, int32 end_value = std::numeric_limits::min()); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 7c7a461da..db5f6eb36 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -627,7 +627,7 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid) if(IsPassiveSpell(spellid)) return true; - chainstartstore[0] = spellmgr.GetFirstSpellInChain(spellid); + chainstartstore[0] = sSpellMgr.GetFirstSpellInChain(spellid); for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { @@ -637,7 +637,7 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid) if(IsPassiveSpell(itr->first)) continue; - uint32 chainstart = spellmgr.GetFirstSpellInChain(itr->first); + uint32 chainstart = sSpellMgr.GetFirstSpellInChain(itr->first); uint8 x; @@ -711,7 +711,7 @@ void Pet::GivePetXP(uint32 xp) newXP -= nextLvlXP; GivePetLevel(level+1); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(level+1)/4); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(level+1)/4); level = getLevel(); nextLvlXP = GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP); @@ -741,7 +741,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) uint32 guid = creature->GetMap()->GenerateLocalLowGuid(HIGHGUID_PET); sLog.outBasic("Create pet"); - uint32 pet_number = objmgr.GeneratePetNumber(); + uint32 pet_number = sObjectMgr.GeneratePetNumber(); if(!Create(guid, creature->GetMap(), creature->GetPhaseMask(), creature->GetEntry(), pet_number)) return false; @@ -773,13 +773,13 @@ bool Pet::CreateBaseAtCreature(Creature* creature) setPowerType(POWER_FOCUS); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(creature->getLevel())/4); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(creature->getLevel())/4); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if(CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family)) SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]); else - SetName(creature->GetNameForLocaleIdx(objmgr.GetDBCLocaleIndex())); + SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex())); if(cinfo->type == CREATURE_TYPE_BEAST) { @@ -886,7 +886,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) //SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower)); - PetLevelInfo const* pInfo = objmgr.GetPetLevelInfo(creature_ID, petlevel); + PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(creature_ID, petlevel); if(pInfo) // exist in DB { SetCreateHealth(pInfo->health); @@ -918,7 +918,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) } case HUNTER_PET: { - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(petlevel)/4); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(petlevel)/4); //these formula may not be correct; however, it is designed to be close to what it should be //this makes dps 0.5 of pets level SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) ); @@ -927,7 +927,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) //damage is increased afterwards as strength and pet scaling modify attack power //stored standard pet stats are entry 1 in pet_levelinfo - PetLevelInfo const* pInfo = objmgr.GetPetLevelInfo(creature_ID, petlevel); + PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(creature_ID, petlevel); if(pInfo) // exist in DB { SetCreateHealth(pInfo->health); @@ -1337,16 +1337,16 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel } } } - else if(spellmgr.GetSpellRank(spell_id)!=0) + else if(sSpellMgr.GetSpellRank(spell_id)!=0) { for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { if(itr2->second.state == PETSPELL_REMOVED) continue; - if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) + if( sSpellMgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) { // replace by new high rank - if(spellmgr.IsHighRankOfSpell(spell_id,itr2->first)) + if(sSpellMgr.IsHighRankOfSpell(spell_id,itr2->first)) { newspell.active = itr2->second.active; @@ -1358,7 +1358,7 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel break; } // ignore new lesser rank - else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id)) + else if(sSpellMgr.IsHighRankOfSpell(itr2->first,spell_id)) return false; } } @@ -1411,7 +1411,7 @@ void Pet::InitLevelupSpellsForLevel() { uint32 level = getLevel(); - if(PetLevelupSpellSet const *levelupSpells = GetCreatureInfo()->family ? spellmgr.GetPetLevelupSpellList(GetCreatureInfo()->family) : NULL) + if(PetLevelupSpellSet const *levelupSpells = GetCreatureInfo()->family ? sSpellMgr.GetPetLevelupSpellList(GetCreatureInfo()->family) : NULL) { // PetLevelupSpellSet ordered by levels, process in reversed order for(PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr) @@ -1428,7 +1428,7 @@ void Pet::InitLevelupSpellsForLevel() int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry(); // default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game) - if(PetDefaultSpellsEntry const *defSpells = spellmgr.GetPetDefaultSpellsEntry(petSpellsId)) + if(PetDefaultSpellsEntry const *defSpells = sSpellMgr.GetPetDefaultSpellsEntry(petSpellsId)) { for(int i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i) { @@ -1497,7 +1497,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab) if (learn_prev) { - if (uint32 prev_id = spellmgr.GetPrevSpellInChain (spell_id)) + if (uint32 prev_id = sSpellMgr.GetPrevSpellInChain (spell_id)) learnSpell(prev_id); else learn_prev = false; @@ -1605,10 +1605,10 @@ bool Pet::resetTalents(bool no_cost) continue; } // remove learned spells (all ranks) - uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first); + uint32 itrFirstId = sSpellMgr.GetFirstSpellInChain(itr->first); // unlearn if first rank is talent or learned by talent - if (itrFirstId == talentInfo->RankID[j] || spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId)) + if (itrFirstId == talentInfo->RankID[j] || sSpellMgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId)) { removeSpell(itr->first,false); itr = m_spells.begin(); @@ -1924,7 +1924,7 @@ void Pet::learnSpellHighRank(uint32 spellid) learnSpell(spellid); DoPetLearnSpell worker(*this); - spellmgr.doForHighRanks(spellid,worker); + sSpellMgr.doForHighRanks(spellid,worker); } void Pet::SynchronizeLevelWithOwner() @@ -1944,7 +1944,7 @@ void Pet::SynchronizeLevelWithOwner() if(getLevel() > owner->getLevel()) { GivePetLevel(owner->getLevel()); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(owner->getLevel())/4); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(owner->getLevel())/4); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP)-1); } break; diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 057dbc077..57b048964 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -394,7 +394,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data ) return; } - if(objmgr.IsReservedName(name)) + if(sObjectMgr.IsReservedName(name)) { SendPetNameInvalid(PET_NAME_RESERVED, name, NULL); return; diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 2859af20a..b6b6e2476 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -145,12 +145,12 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) if(type == 9) { - if(objmgr.GetGuildByName(name)) + if(sObjectMgr.GetGuildByName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS); return; } - if(objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) + if(sObjectMgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_INVALID); return; @@ -158,12 +158,12 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } else { - if(objmgr.GetArenaTeamByName(name)) + if(sObjectMgr.GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } - if(objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) + if(sObjectMgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID); return; @@ -401,12 +401,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) if(type == 9) { - if(objmgr.GetGuildByName(newname)) + if(sObjectMgr.GetGuildByName(newname)) { SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_EXISTS); return; } - if(objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) + if(sObjectMgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) { SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_INVALID); return; @@ -414,12 +414,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) } else { - if(objmgr.GetArenaTeamByName(newname)) + if(sObjectMgr.GetArenaTeamByName(newname)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } - if(objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) + if(sObjectMgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_INVALID); return; @@ -473,7 +473,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) return; // not let enemies sign guild charter - if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != objmgr.GetPlayerTeamByGUID(ownerguid)) + if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(ownerguid)) { if(type != 9) SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); @@ -539,7 +539,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) SendPacket(&data); // update for owner if online - if(Player *owner = objmgr.GetPlayer(ownerguid)) + if(Player *owner = sObjectMgr.GetPlayer(ownerguid)) owner->GetSession()->SendPacket(&data); return; } @@ -562,7 +562,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) // item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs); // update for owner if online - if(Player *owner = objmgr.GetPlayer(ownerguid)) + if(Player *owner = sObjectMgr.GetPlayer(ownerguid)) owner->GetSession()->SendPacket(&data); } @@ -584,7 +584,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); delete result; - Player *owner = objmgr.GetPlayer(ownerguid); + Player *owner = sObjectMgr.GetPlayer(ownerguid); if(owner) // petition owner online { WorldPacket data(MSG_PETITION_DECLINE, 8); @@ -782,7 +782,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) if(type == 9) { - if(objmgr.GetGuildByName(name)) + if(sObjectMgr.GetGuildByName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS); delete result; @@ -791,7 +791,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } else { - if(objmgr.GetArenaTeamByName(name)) + if(sObjectMgr.GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); delete result; @@ -823,7 +823,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } // register guild and add guildmaster - objmgr.AddGuild(guild); + sObjectMgr.AddGuild(guild); // add members for(uint8 i = 0; i < signs; ++i) @@ -850,7 +850,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor); // register team and add captain - objmgr.AddArenaTeam(at); + sObjectMgr.AddArenaTeam(at); sLog.outDebug("PetitonsHandler: arena team added to objmrg"); // add members diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 786d52fcc..6de25fcdf 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -226,13 +226,13 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint { uint32 cost; uint32 path; - objmgr.GetTaxiPath(m_TaxiDestinations[i-1],m_TaxiDestinations[i],path,cost); + sObjectMgr.GetTaxiPath(m_TaxiDestinations[i-1],m_TaxiDestinations[i],path,cost); if(!path) return false; } // can't load taxi path without mount set (quest taxi path?) - if(!objmgr.GetTaxiMountDisplayId(GetTaxiSource(),team,true)) + if(!sObjectMgr.GetTaxiMountDisplayId(GetTaxiSource(),team,true)) return false; return true; @@ -259,7 +259,7 @@ uint32 PlayerTaxi::GetCurrentTaxiPath() const uint32 path; uint32 cost; - objmgr.GetTaxiPath(m_TaxiDestinations[0],m_TaxiDestinations[1],path,cost); + sObjectMgr.GetTaxiPath(m_TaxiDestinations[0],m_TaxiDestinations[1],path,cost); return path; } @@ -536,7 +536,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 m_name = name; - PlayerInfo const* info = objmgr.GetPlayerInfo(race, class_); + PlayerInfo const* info = sObjectMgr.GetPlayerInfo(race, class_); if(!info) { sLog.outError("Player have incorrect race/class pair. Can't be loaded."); @@ -556,7 +556,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 return false; } - SetMap(mapmgr.CreateMap(info->mapId, this)); + SetMap(sMapMgr.CreateMap(info->mapId, this)); uint8 powertype = cEntry->powerType; @@ -1411,7 +1411,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) uint8 pRace = fields[2].GetUInt8(); uint8 pClass = fields[3].GetUInt8(); - PlayerInfo const *info = objmgr.GetPlayerInfo(pRace, pClass); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(pRace, pClass); if(!info) { sLog.outError("Player %u has incorrect race/class pair. Don't build enum.", guid); @@ -1680,12 +1680,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // Check enter rights before map getting to avoid creating instance copy for player // this check not dependent from map instance copy and same for all instance copies of selected map - if (!mapmgr.CanPlayerEnter(mapid, this)) + if (!sMapMgr.CanPlayerEnter(mapid, this)) return false; // If the map is not created, assume it is possible to enter it. // It will be created in the WorldPortAck. - Map *map = mapmgr.FindMap(mapid); + Map *map = sMapMgr.FindMap(mapid); if (!map || map->CanEnter(this)) { //lets reset near teleport flag if it wasn't reset during chained teleports @@ -2291,7 +2291,7 @@ void Player::UninviteFromGroup() if(group->IsCreated()) { group->Disband(true); - objmgr.RemoveGroup(group); + sObjectMgr.RemoveGroup(group); } else group->RemoveAllInvites(); @@ -2307,7 +2307,7 @@ void Player::RemoveFromGroup(Group* group, uint64 guid) if (group->RemoveMember(guid, 0) <= 1) { // group->Disband(); already disbanded in RemoveMember - objmgr.RemoveGroup(group); + sObjectMgr.RemoveGroup(group); delete group; // removemember sets the player's group pointer to NULL } @@ -2390,10 +2390,10 @@ void Player::GiveLevel(uint32 level) return; PlayerLevelInfo info; - objmgr.GetPlayerLevelInfo(getRace(),getClass(),level,&info); + sObjectMgr.GetPlayerLevelInfo(getRace(),getClass(),level,&info); PlayerClassLevelInfo classInfo; - objmgr.GetPlayerClassLevelInfo(getClass(),level,&classInfo); + sObjectMgr.GetPlayerClassLevelInfo(getClass(),level,&classInfo); // send levelup info to client WorldPacket data(SMSG_LEVELUP_INFO, (4+4+MAX_POWERS*4+MAX_STATS*4)); @@ -2413,7 +2413,7 @@ void Player::GiveLevel(uint32 level) GetSession()->SendPacket(&data); - SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(level)); + SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(level)); //update level, max level of skills m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset @@ -2452,7 +2452,7 @@ void Player::GiveLevel(uint32 level) if (Pet* pet = GetPet()) pet->SynchronizeLevelWithOwner(); - if (MailLevelReward const* mailReward = objmgr.GetMailLevelReward(level,getRaceMask())) + if (MailLevelReward const* mailReward = sObjectMgr.GetMailLevelReward(level,getRaceMask())) MailDraft(mailReward->mailTemplateId).SendMailTo(this,MailSender(MAIL_CREATURE,mailReward->senderEntry)); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL); @@ -2498,13 +2498,13 @@ void Player::InitStatsForLevel(bool reapplyMods) _RemoveAllStatBonuses(); PlayerClassLevelInfo classInfo; - objmgr.GetPlayerClassLevelInfo(getClass(),getLevel(),&classInfo); + sObjectMgr.GetPlayerClassLevelInfo(getClass(),getLevel(),&classInfo); PlayerLevelInfo info; - objmgr.GetPlayerLevelInfo(getRace(),getClass(),getLevel(),&info); + sObjectMgr.GetPlayerLevelInfo(getRace(),getClass(),getLevel(),&info); SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ); - SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(getLevel())); + SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(getLevel())); UpdateSkillsForLevel (); @@ -2830,9 +2830,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { uint32 next_active_spell_id = 0; // fix activate state for non-stackable low rank (and find next spell for !active case) - if(!SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) + if(!SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr.GetSpellRank(spellInfo->Id) != 0) { - SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); + SpellChainMapNext const& nextMap = sSpellMgr.GetSpellChainNext(); for(SpellChainMapNext::const_iterator next_itr = nextMap.lower_bound(spell_id); next_itr != nextMap.upper_bound(spell_id); ++next_itr) { if(HasSpell(next_itr->second)) @@ -2952,7 +2952,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen } } // non talent spell: learn low ranks (recursive call) - else if(uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id)) + else if(uint32 prev_spell = sSpellMgr.GetPrevSpellInChain(spell_id)) { if(!IsInWorld() || disabled) // at spells loading, no output, but allow save addSpell(prev_spell,active,true,true,disabled); @@ -2967,7 +2967,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen newspell->disabled = disabled; // replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible - if(newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) + if(newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr.GetSpellRank(spellInfo->Id) != 0) { for( PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2 ) { @@ -2975,11 +2975,11 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first); if(!i_spellInfo) continue; - if( spellmgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) + if( sSpellMgr.IsRankSpellDueToSpell(spellInfo,itr2->first) ) { if(itr2->second->active) { - if(spellmgr.IsHighRankOfSpell(spell_id,itr2->first)) + if(sSpellMgr.IsHighRankOfSpell(spell_id,itr2->first)) { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { @@ -2995,7 +2995,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen itr2->second->state = PLAYERSPELL_CHANGED; superceded_old = true; // new spell replace old in action bars and spell book. } - else if(spellmgr.IsHighRankOfSpell(itr2->first,spell_id)) + else if(sSpellMgr.IsHighRankOfSpell(itr2->first,spell_id)) { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { @@ -3049,16 +3049,16 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // update free primary prof.points (if any, can be none in case GM .learn prof. learning) if (uint32 freeProfs = GetFreePrimaryProfessionPoints()) { - if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell_id)) + if(sSpellMgr.IsPrimaryProfessionFirstRankSpell(spell_id)) SetFreePrimaryProfessions(freeProfs-1); } // add dependent skills uint16 maxskill = GetMaxSkillValueForLevel(); - SpellLearnSkillNode const* spellLearnSkill = spellmgr.GetSpellLearnSkill(spell_id); + SpellLearnSkillNode const* spellLearnSkill = sSpellMgr.GetSpellLearnSkill(spell_id); - SkillLineAbilityMapBounds skill_bounds = spellmgr.GetSkillLineAbilityMapBounds(spell_id); + SkillLineAbilityMapBounds skill_bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spell_id); if (spellLearnSkill) { @@ -3110,7 +3110,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen } // learn dependent spells - SpellLearnSpellMapBounds spell_bounds = spellmgr.GetSpellLearnSpellMapBounds(spell_id); + SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id); for(SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2) { @@ -3161,7 +3161,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent) // learn all disabled higher ranks (recursive) if(disabled) { - SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); + SpellChainMapNext const& nextMap = sSpellMgr.GetSpellChainNext(); for(SpellChainMapNext::const_iterator i = nextMap.lower_bound(spell_id); i != nextMap.upper_bound(spell_id); ++i) { PlayerSpellMap::iterator iter = m_spells.find(i->second); @@ -3189,7 +3189,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) return; // unlearn non talent higher ranks (recursive) - SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); + SpellChainMapNext const& nextMap = sSpellMgr.GetSpellChainNext(); for(SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2) if(HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second)) removeSpell(itr2->second,disabled,false); @@ -3223,7 +3223,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // remove pet auras for(int i = 0; i < 3; ++i) - if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id, i)) + if(PetAura const* petSpell = sSpellMgr.GetPetAura(spell_id, i)) RemovePetAura(petSpell); // free talent points @@ -3237,7 +3237,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) } // update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning) - if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell_id)) + if(sSpellMgr.IsPrimaryProfessionFirstRankSpell(spell_id)) { uint32 freeProfs = GetFreePrimaryProfessionPoints()+1; if(freeProfs <= sWorld.getConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL)) @@ -3245,20 +3245,20 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) } // remove dependent skill - SpellLearnSkillNode const* spellLearnSkill = spellmgr.GetSpellLearnSkill(spell_id); + SpellLearnSkillNode const* spellLearnSkill = sSpellMgr.GetSpellLearnSkill(spell_id); if(spellLearnSkill) { - uint32 prev_spell = spellmgr.GetPrevSpellInChain(spell_id); + uint32 prev_spell = sSpellMgr.GetPrevSpellInChain(spell_id); if(!prev_spell) // first rank, remove skill SetSkill(spellLearnSkill->skill,0,0); else { // search prev. skill setting by spell ranks chain - SpellLearnSkillNode const* prevSkill = spellmgr.GetSpellLearnSkill(prev_spell); + SpellLearnSkillNode const* prevSkill = sSpellMgr.GetSpellLearnSkill(prev_spell); while(!prevSkill && prev_spell) { - prev_spell = spellmgr.GetPrevSpellInChain(prev_spell); - prevSkill = spellmgr.GetSpellLearnSkill(spellmgr.GetFirstSpellInChain(prev_spell)); + prev_spell = sSpellMgr.GetPrevSpellInChain(prev_spell); + prevSkill = sSpellMgr.GetSpellLearnSkill(sSpellMgr.GetFirstSpellInChain(prev_spell)); } if (!prevSkill) // not found prev skill setting, remove skill @@ -3284,7 +3284,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) else { // not ranked skills - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spell_id); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spell_id); for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) { @@ -3308,7 +3308,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) } // remove dependent spells - SpellLearnSpellMapBounds spell_bounds = spellmgr.GetSpellLearnSpellMapBounds(spell_id); + SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id); for(SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2) removeSpell(itr2->second.spell, disabled); @@ -3316,7 +3316,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // activate lesser rank in spellbook/action bar, and cast it if need bool prev_activate = false; - if (uint32 prev_id = spellmgr.GetPrevSpellInChain (spell_id)) + if (uint32 prev_id = sSpellMgr.GetPrevSpellInChain (spell_id)) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); @@ -3327,7 +3327,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) learnSpell (prev_id,false); } // if ranked non-stackable spell: need activate lesser rank and update dendence state - else if (cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) + else if (cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr.GetSpellRank(spellInfo->Id) != 0) { // need manually update dependence state (learn spell ignore like attempts) PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id); @@ -3570,7 +3570,7 @@ bool Player::resetTalents(bool no_cost) } // remove learned spells (all ranks) - uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first); + uint32 itrFirstId = sSpellMgr.GetFirstSpellInChain(itr->first); // unlearn if first rank is talent or learned by talent if (itrFirstId == talentInfo->RankID[j]) @@ -3579,7 +3579,7 @@ bool Player::resetTalents(bool no_cost) itr = GetSpellMap().begin(); continue; } - else if (spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId)) + else if (sSpellMgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId)) { removeSpell(itr->first,!IsPassiveSpell(itr->first)); itr = GetSpellMap().begin(); @@ -3850,7 +3850,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell if(getLevel() < trainer_spell->reqLevel) return TRAINER_SPELL_RED; - if(SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->learnedSpell)) + if(SpellChainNode const* spell_chain = sSpellMgr.GetSpellChainNode(trainer_spell->learnedSpell)) { // check prev.rank requirement if(spell_chain->prev && !HasSpell(spell_chain->prev)) @@ -3875,7 +3875,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell return TRAINER_SPELL_GREEN; // check primary prof. limit - if(spellmgr.IsPrimaryProfessionFirstRankSpell(spell->Id) && GetFreePrimaryProfessionPoints() == 0) + if(sSpellMgr.IsPrimaryProfessionFirstRankSpell(spell->Id) && GetFreePrimaryProfessionPoints() == 0) return TRAINER_SPELL_GREEN_DISABLED; return TRAINER_SPELL_GREEN; @@ -3887,13 +3887,13 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry) // bones will be deleted by corpse/bones deleting thread shortly - objaccessor.ConvertCorpseForPlayer(playerguid); + sObjectAccessor.ConvertCorpseForPlayer(playerguid); // remove from guild uint32 guildId = GetGuildIdFromDB(playerguid); if(guildId != 0) { - Guild* guild = objmgr.GetGuildById(guildId); + Guild* guild = sObjectMgr.GetGuildById(guildId); if(guild) guild->DelMember(guid); } @@ -3907,7 +3907,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC { uint64 leaderGuid = MAKE_NEW_GUID((*resultGroup)[0].GetUInt32(), 0, HIGHGUID_PLAYER); delete resultGroup; - Group* group = objmgr.GetGroupByLeader(leaderGuid); + Group* group = sObjectMgr.GetGroupByLeader(leaderGuid); if(group) { RemoveFromGroup(group, playerguid); @@ -3988,7 +3988,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id); - uint32 pl_account = objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); + uint32 pl_account = sObjectMgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); draft.AddMoney(money).SendReturnToSender(pl_account, guid, sender); } @@ -4237,7 +4237,7 @@ void Player::CreateCorpse() Corpse *corpse = new Corpse( (m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE ); SetPvPDeath(false); - if(!corpse->Create(objmgr.GenerateLowGuid(HIGHGUID_CORPSE), this)) + if(!corpse->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_CORPSE), this)) { delete corpse; return; @@ -4295,18 +4295,18 @@ void Player::CreateCorpse() corpse->SaveToDB(); // register for player, but not show - objaccessor.AddCorpse(corpse); + sObjectAccessor.AddCorpse(corpse); } void Player::SpawnCorpseBones() { - if(objaccessor.ConvertCorpseForPlayer(GetGUID())) + if(sObjectAccessor.ConvertCorpseForPlayer(GetGUID())) SaveToDB(); // prevent loading as ghost without corpse } Corpse* Player::GetCorpse() const { - return objaccessor.GetCorpseForPlayerGUID(GetGUID()); + return sObjectAccessor.GetCorpseForPlayerGUID(GetGUID()); } void Player::DurabilityLossAll(double percent, bool inventory) @@ -4480,7 +4480,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g return TotalCost; } - Guild *pGuild = objmgr.GetGuildById(GetGuildId()); + Guild *pGuild = sObjectMgr.GetGuildById(GetGuildId()); if (!pGuild) return TotalCost; @@ -4544,7 +4544,7 @@ void Player::RepopAtGraveyard() if( BattleGround *bg = GetBattleGround() ) ClosestGrave = bg->GetClosestGraveYard(this); else - ClosestGrave = objmgr.GetClosestGraveYard( GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam() ); + ClosestGrave = sObjectMgr.GetClosestGraveYard( GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam() ); // stop countdown until repop m_deathTimer = 0; @@ -5050,7 +5050,7 @@ bool Player::UpdateCraftSkill(uint32 spellid) { sLog.outDebug("UpdateCraftSkill spellid %d", spellid); - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellid); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spellid); for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) { @@ -5357,7 +5357,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) for (uint32 j=0; jskillId==id) - removeSpell(spellmgr.GetFirstSpellInChain(pAbility->spellId)); + removeSpell(sSpellMgr.GetFirstSpellInChain(pAbility->spellId)); } } else if(currVal) //add @@ -5666,7 +5666,7 @@ void Player::SaveRecallPosition() void Player::SendMessageToSet(WorldPacket *data, bool self) { - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); if(_map) { _map->MessageBroadcast(this, data, self); @@ -5681,7 +5681,7 @@ void Player::SendMessageToSet(WorldPacket *data, bool self) void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) { - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); if(_map) { _map->MessageDistBroadcast(this, data, dist, self); @@ -5694,7 +5694,7 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only) { - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); if(_map) { _map->MessageDistBroadcast(this, data, dist, self, own_team_only); @@ -5770,7 +5770,7 @@ void Player::CheckExploreSystem() uint32 XP = 0; if (diff < -5) { - XP = uint32(objmgr.GetBaseXP(getLevel()+5)*sWorld.getRate(RATE_XP_EXPLORE)); + XP = uint32(sObjectMgr.GetBaseXP(getLevel()+5)*sWorld.getRate(RATE_XP_EXPLORE)); } else if (diff > 5) { @@ -5780,11 +5780,11 @@ void Player::CheckExploreSystem() else if (exploration_percent < 0) exploration_percent = 0; - XP = uint32(objmgr.GetBaseXP(p->area_level)*exploration_percent/100*sWorld.getRate(RATE_XP_EXPLORE)); + XP = uint32(sObjectMgr.GetBaseXP(p->area_level)*exploration_percent/100*sWorld.getRate(RATE_XP_EXPLORE)); } else { - XP = uint32(objmgr.GetBaseXP(p->area_level)*sWorld.getRate(RATE_XP_EXPLORE)); + XP = uint32(sObjectMgr.GetBaseXP(p->area_level)*sWorld.getRate(RATE_XP_EXPLORE)); } GiveXP( XP, NULL ); @@ -5867,7 +5867,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER) return; - ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry); + ReputationOnKillEntry const* Rep = sObjectMgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry); if(!Rep) return; @@ -6179,7 +6179,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) float posz = fields[3].GetFloat(); delete result; - zone = mapmgr.GetZoneId(map,posx,posy,posz); + zone = sMapMgr.GetZoneId(map,posx,posy,posz); if (zone > 0) CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow); @@ -7047,7 +7047,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType) } // Use first rank to access spell item enchant procs - float ppmRate = spellmgr.GetItemEnchantProcChance(spellInfo->Id); + float ppmRate = sSpellMgr.GetItemEnchantProcChance(spellInfo->Id); float chance = ppmRate ? GetPPMProcChance(proto->Delay, ppmRate) @@ -7347,7 +7347,7 @@ void Player::RemovedInsignia(Player* looterPlr) // We have to convert player corpse to bones, not to be able to resurrect there // SpawnCorpseBones isn't handy, 'cos it saves player while he in BG - Corpse *bones = objaccessor.ConvertCorpseForPlayer(GetGUID(),true); + Corpse *bones = sObjectAccessor.ConvertCorpseForPlayer(GetGUID(),true); if (!bones) return; @@ -12128,21 +12128,21 @@ void Player::PrepareQuestMenu( uint64 guid ) if (Creature *pCreature = GetMap()->GetCreatureOrPetOrVehicle(guid)) { pObject = (Object*)pCreature; - pObjectQR = &objmgr.mCreatureQuestRelations; - pObjectQIR = &objmgr.mCreatureQuestInvolvedRelations; + pObjectQR = &sObjectMgr.mCreatureQuestRelations; + pObjectQIR = &sObjectMgr.mCreatureQuestInvolvedRelations; } else { //we should obtain map pointer from GetMap() in 99% of cases. Special case //only for quests which cast teleport spells on player - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); GameObject *pGameObject = _map->GetGameObject(guid); if( pGameObject ) { pObject = (Object*)pGameObject; - pObjectQR = &objmgr.mGOQuestRelations; - pObjectQIR = &objmgr.mGOQuestInvolvedRelations; + pObjectQR = &sObjectMgr.mGOQuestRelations; + pObjectQIR = &sObjectMgr.mGOQuestInvolvedRelations; } else return; @@ -12166,7 +12166,7 @@ void Player::PrepareQuestMenu( uint64 guid ) for(QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i) { uint32 quest_id = i->second; - Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); if(!pQuest) continue; QuestStatus status = GetQuestStatus( quest_id ); @@ -12194,7 +12194,7 @@ void Player::SendPreparedQuest(uint64 guid) { // Auto open -- maybe also should verify there is no greeting uint32 quest_id = qmi0.m_qId; - Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); if (pQuest) { @@ -12222,7 +12222,7 @@ void Player::SendPreparedQuest(uint64 guid) if (Creature *pCreature = GetMap()->GetCreatureOrPetOrVehicle(guid)) { uint32 textid = pCreature->GetNpcTextId(); - GossipText const* gossiptext = objmgr.GetGossipText(textid); + GossipText const* gossiptext = sObjectMgr.GetGossipText(textid); if (!gossiptext) { qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote @@ -12240,7 +12240,7 @@ void Player::SendPreparedQuest(uint64 guid) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textid); + NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid); if (nl) { if (nl->Text_0[0].size() > loc_idx && !nl->Text_0[0][loc_idx].empty()) @@ -12255,7 +12255,7 @@ void Player::SendPreparedQuest(uint64 guid) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textid); + NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid); if (nl) { if (nl->Text_1[0].size() > loc_idx && !nl->Text_1[0][loc_idx].empty()) @@ -12285,21 +12285,21 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) if (Creature *pCreature = GetMap()->GetCreatureOrPetOrVehicle(guid)) { pObject = (Object*)pCreature; - pObjectQR = &objmgr.mCreatureQuestRelations; - pObjectQIR = &objmgr.mCreatureQuestInvolvedRelations; + pObjectQR = &sObjectMgr.mCreatureQuestRelations; + pObjectQIR = &sObjectMgr.mCreatureQuestInvolvedRelations; } else { //we should obtain map pointer from GetMap() in 99% of cases. Special case //only for quests which cast teleport spells on player - Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId()); + Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); GameObject *pGameObject = _map->GetGameObject(guid); if( pGameObject ) { pObject = (Object*)pGameObject; - pObjectQR = &objmgr.mGOQuestRelations; - pObjectQIR = &objmgr.mGOQuestInvolvedRelations; + pObjectQR = &sObjectMgr.mGOQuestRelations; + pObjectQIR = &sObjectMgr.mGOQuestInvolvedRelations; } else return NULL; @@ -12309,7 +12309,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) for(QuestRelations::const_iterator itr = pObjectQR->lower_bound(pObject->GetEntry()); itr != pObjectQR->upper_bound(pObject->GetEntry()); ++itr) { if (itr->second == nextQuestID) - return objmgr.GetQuestTemplate(nextQuestID); + return sObjectMgr.GetQuestTemplate(nextQuestID); } return NULL; @@ -12370,7 +12370,7 @@ bool Player::CanCompleteQuest( uint32 quest_id ) if( q_status.m_status == QUEST_STATUS_COMPLETE ) return false; // not allow re-complete quest - Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); if(!qInfo) return false; @@ -12586,7 +12586,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) GetMap()->ScriptsStart(sQuestStartScripts, pQuest->GetQuestStartScript(), questGiver, this); // Some spells applied at quest activation - SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,true); + SpellAreaForQuestMapBounds saBounds = sSpellMgr.GetSpellAreaForQuestMapBounds(quest_id,true); if(saBounds.first != saBounds.second) { uint32 zone, area; @@ -12611,7 +12611,7 @@ void Player::CompleteQuest( uint32 quest_id ) if( log_slot < MAX_QUEST_LOG_SIZE) SetQuestSlotState(log_slot,QUEST_STATE_COMPLETE); - if(Quest const* qInfo = objmgr.GetQuestTemplate(quest_id)) + if(Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id)) { if( qInfo->HasFlag(QUEST_FLAGS_AUTO_REWARDED) ) RewardQuest(qInfo,0,this,false); @@ -12765,7 +12765,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver uint32 area = 0; // remove auras from spells with quest reward state limitations - SpellAreaForQuestMapBounds saEndBounds = spellmgr.GetSpellAreaForQuestEndMapBounds(quest_id); + SpellAreaForQuestMapBounds saEndBounds = sSpellMgr.GetSpellAreaForQuestEndMapBounds(quest_id); if(saEndBounds.first != saEndBounds.second) { GetZoneAndAreaId(zone,area); @@ -12776,7 +12776,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver } // Some spells applied at quest reward - SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,false); + SpellAreaForQuestMapBounds saBounds = sSpellMgr.GetSpellAreaForQuestMapBounds(quest_id,false); if(saBounds.first != saBounds.second) { if(!zone || !area) @@ -12794,7 +12794,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver void Player::FailQuest(uint32 questId) { - if (Quest const* pQuest = objmgr.GetQuestTemplate(questId)) + if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(questId)) { SetQuestStatus(questId, QUEST_STATUS_FAILED); @@ -12903,7 +12903,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) uint32 prevId = abs(*iter); QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); - Quest const* qPrevInfo = objmgr.GetQuestTemplate(prevId); + Quest const* qPrevInfo = sObjectMgr.GetQuestTemplate(prevId); if( qPrevInfo && i_prevstatus != mQuestStatus.end() ) { @@ -12916,8 +12916,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group completed and rewarded - ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); - ObjectMgr::ExclusiveQuestGroups::const_iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 @@ -12951,8 +12951,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group active - ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); - ObjectMgr::ExclusiveQuestGroups::const_iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 @@ -13054,8 +13054,8 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) if(qInfo->GetExclusiveGroup() <= 0) return true; - ObjectMgr::ExclusiveQuestGroups::const_iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup()); - ObjectMgr::ExclusiveQuestGroups::const_iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator iter = sObjectMgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup()); assert(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0 @@ -13068,7 +13068,7 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) continue; // not allow have daily quest if daily quest from exclusive group already recently completed - Quest const* Nquest = objmgr.GetQuestTemplate(exclude_Id); + Quest const* Nquest = sObjectMgr.GetQuestTemplate(exclude_Id); if( !SatisfyQuestDay(Nquest, false) ) { if( msg ) @@ -13201,7 +13201,7 @@ bool Player::GiveQuestSourceItem( Quest const *pQuest ) bool Player::TakeQuestSourceItem( uint32 quest_id, bool msg ) { - Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); if( qInfo ) { uint32 srcitem = qInfo->GetSrcItemId(); @@ -13229,7 +13229,7 @@ bool Player::TakeQuestSourceItem( uint32 quest_id, bool msg ) bool Player::GetQuestRewardStatus( uint32 quest_id ) const { - Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); if( qInfo ) { // for repeatable quests: rewarded field is set after first reward only to prevent getting XP more than once @@ -13256,7 +13256,7 @@ QuestStatus Player::GetQuestStatus( uint32 quest_id ) const bool Player::CanShareQuest(uint32 quest_id) const { - Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); if( qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE) ) { QuestStatusMap::const_iterator itr = mQuestStatus.find( quest_id ); @@ -13268,7 +13268,7 @@ bool Player::CanShareQuest(uint32 quest_id) const void Player::SetQuestStatus(uint32 quest_id, QuestStatus status) { - if (Quest const* qInfo = objmgr.GetQuestTemplate(quest_id)) + if (Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id)) { QuestStatusData& q_status = mQuestStatus[quest_id]; @@ -13284,7 +13284,7 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status) // not used in MaNGOS, but used in scripting code uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) { - Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); if( !qInfo ) return 0; @@ -13374,7 +13374,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count ) if ( q_status.m_status != QUEST_STATUS_INCOMPLETE ) continue; - Quest const* qInfo = objmgr.GetQuestTemplate(questid); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); if( !qInfo || !qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) continue; @@ -13409,7 +13409,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count ) uint32 questid = GetQuestSlotQuestId(i); if(!questid) continue; - Quest const* qInfo = objmgr.GetQuestTemplate(questid); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); if ( !qInfo ) continue; if( !qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) @@ -13463,7 +13463,7 @@ void Player::KilledMonsterCredit( uint32 entry, uint64 guid ) if(!questid) continue; - Quest const* qInfo = objmgr.GetQuestTemplate(questid); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); if( !qInfo ) continue; // just if !ingroup || !noraidgroup || raidgroup @@ -13518,7 +13518,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id ) if(!questid) continue; - Quest const* qInfo = objmgr.GetQuestTemplate(questid); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); if ( !qInfo ) continue; @@ -13585,7 +13585,7 @@ void Player::TalkedToCreature( uint32 entry, uint64 guid ) if(!questid) continue; - Quest const* qInfo = objmgr.GetQuestTemplate(questid); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); if ( !qInfo ) continue; @@ -13640,7 +13640,7 @@ void Player::MoneyChanged( uint32 count ) if (!questid) continue; - Quest const* qInfo = objmgr.GetQuestTemplate(questid); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid); if( qInfo && qInfo->GetRewOrReqMoney() < 0 ) { QuestStatusData& q_status = mQuestStatus[questid]; @@ -13668,7 +13668,7 @@ void Player::ReputationChanged(FactionEntry const* factionEntry ) { if(uint32 questid = GetQuestSlotQuestId(i)) { - if(Quest const* qInfo = objmgr.GetQuestTemplate(questid)) + if(Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid)) { if(qInfo->GetRepObjectiveFaction() == factionEntry->ID ) { @@ -13706,7 +13706,7 @@ bool Player::HasQuestForItem( uint32 itemid ) const if (q_status.m_status == QUEST_STATUS_INCOMPLETE) { - Quest const* qinfo = objmgr.GetQuestTemplate(questid); + Quest const* qinfo = sObjectMgr.GetQuestTemplate(questid); if(!qinfo) continue; @@ -13826,7 +13826,7 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver) if (loc_idx >= 0) { - if (const QuestLocale* pLocale = objmgr.GetQuestLocale(pQuest->GetQuestId())) + if (const QuestLocale* pLocale = sObjectMgr.GetQuestLocale(pQuest->GetQuestId())) { if (pLocale->Title.size() > loc_idx && !pLocale->Title[loc_idx].empty()) strTitle = pLocale->Title[loc_idx]; @@ -13924,7 +13924,7 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) uint32 wons_season = fields[3].GetUInt32(); uint32 personal_rating = fields[4].GetUInt32(); - ArenaTeam* aTeam = objmgr.GetArenaTeamById(arenateamid); + ArenaTeam* aTeam = sObjectMgr.GetArenaTeamById(arenateamid); if(!aTeam) { sLog.outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenateamid); @@ -14098,7 +14098,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // check name limitations if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS || - (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))) + (GetSession()->GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(m_name))) { delete result; CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid); @@ -14193,7 +14193,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if(!arena_team_id) continue; - if(ArenaTeam * at = objmgr.GetArenaTeamById(arena_team_id)) + if(ArenaTeam * at = sObjectMgr.GetArenaTeamById(arena_team_id)) if(at->HaveMember(GetGUID())) continue; @@ -14293,7 +14293,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if (transGUID != 0) { - for (MapManager::TransportSet::const_iterator iter = mapmgr.m_Transports.begin(); iter != mapmgr.m_Transports.end(); ++iter) + for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter) { if( (*iter)->GetGUIDLow() == transGUID) { @@ -14342,12 +14342,12 @@ 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 - SetMap(mapmgr.CreateMap(GetMapId(), this)); + SetMap(sMapMgr.CreateMap(GetMapId(), this)); // if the player is in an instance and it has been reset in the meantime teleport him to the entrance - if(GetInstanceId() && !sInstanceSaveManager.GetInstanceSave(GetInstanceId())) + if(GetInstanceId() && !sInstanceSaveMgr.GetInstanceSave(GetInstanceId())) { - AreaTrigger const* at = objmgr.GetMapEntranceTrigger(GetMapId()); + AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(GetMapId()); if(at) Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); else @@ -14536,7 +14536,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) //we can be relocated from taxi and still have an outdated Map pointer! //so we need to get a new Map pointer! - SetMap(mapmgr.CreateMap(GetMapId(), this)); + SetMap(sMapMgr.CreateMap(GetMapId(), this)); SaveRecallPosition(); // save as recall also to prevent recall and fall from sky m_taxi.ClearTaxiDestinations(); @@ -14808,7 +14808,7 @@ void Player::LoadCorpse() { if( isAlive() ) { - objaccessor.ConvertCorpseForPlayer(GetGUID()); + sObjectAccessor.ConvertCorpseForPlayer(GetGUID()); } else { @@ -15113,7 +15113,7 @@ void Player::_LoadQuestStatus(QueryResult *result) uint32 quest_id = fields[0].GetUInt32(); // used to be new, no delete? - Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); if( pQuest ) { // find or create @@ -15233,7 +15233,7 @@ void Player::_LoadDailyQuestStatus(QueryResult *result) // save _any_ from daily quest times (it must be after last reset anyway) m_lastDailyQuestTime = (time_t)fields[1].GetUInt64(); - Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); if( !pQuest ) continue; @@ -15276,7 +15276,7 @@ void Player::_LoadGroup(QueryResult *result) uint64 leaderGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); delete result; - if (Group* group = objmgr.GetGroupByLeader(leaderGuid)) + if (Group* group = sObjectMgr.GetGroupByLeader(leaderGuid)) { uint8 subgroup = group->GetMemberGroup(GetGUID()); SetGroup(group, subgroup); @@ -15344,7 +15344,7 @@ void Player::_LoadBoundInstances(QueryResult *result) } // since non permanent binds are always solo bind, they can always be reset - InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true); + InstanceSave *save = sInstanceSaveMgr.AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true); if(save) BindToInstance(save, perm, true); } while(result->NextRow()); delete result; @@ -15527,7 +15527,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player bool Player::_LoadHomeBind(QueryResult *result) { - PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(getRace(), getClass()); if(!info) { sLog.outError("Player have incorrect race/class pair. Can't be loaded."); @@ -16246,7 +16246,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) } // if the map is loaded, reset it - Map *map = mapmgr.FindMap(p->GetMapId(), p->GetInstanceId()); + Map *map = sMapMgr.FindMap(p->GetMapId(), p->GetInstanceId()); if(map && map->IsDungeon()) ((InstanceMap*)map)->Reset(method); @@ -16471,7 +16471,7 @@ void Player::Whisper(const std::string& text, uint32 language,uint64 receiver) if (language != LANG_ADDON) // if not addon data language = LANG_UNIVERSAL; // whispers should always be readable - Player *rPlayer = objmgr.GetPlayer(receiver); + Player *rPlayer = sObjectMgr.GetPlayer(receiver); // when player you are whispering to is dnd, he cannot receive your message, unless you are in gm mode if(!rPlayer->isDND() || isGameMaster()) @@ -16690,7 +16690,7 @@ bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mo return false; } - return spellmgr.IsAffectedByMod(spellInfo, mod); + return sSpellMgr.IsAffectedByMod(spellInfo, mod); } void Player::AddSpellMod(SpellModifier* mod, bool apply) @@ -16779,7 +16779,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) uint64 petitionguid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_ITEM); // send update if charter owner in game - Player* owner = objmgr.GetPlayer(ownerguid); + Player* owner = sObjectMgr.GetPlayer(ownerguid); if(owner) owner->GetSession()->SendPetitionQueryOpcode(petitionguid); @@ -16819,7 +16819,7 @@ void Player::LeaveAllArenaTeams(uint64 guid) uint32 at_id = fields[0].GetUInt32(); if(at_id != 0) { - ArenaTeam * at = objmgr.GetArenaTeamById(at_id); + ArenaTeam * at = sObjectMgr.GetArenaTeamById(at_id); if(at) at->DelMember(guid); } @@ -17039,7 +17039,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc uint32 path, cost; lastnode = nodes[i]; - objmgr.GetTaxiPath(prevnode, lastnode, path, cost); + sObjectMgr.GetTaxiPath(prevnode, lastnode, path, cost); if(!path) { @@ -17058,7 +17058,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc } // get mount model (in case non taximaster (npc==NULL) allow more wide lookup) - uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); + uint32 mount_display_id = sObjectMgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); // in spell case allow 0 model if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) @@ -17126,7 +17126,7 @@ void Player::ContinueTaxiFlight() sLog.outDebug( "WORLD: Restart character %u taxi flight", GetGUIDLow() ); - uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, GetTeam(),true); + uint32 mountDisplayId = sObjectMgr.GetTaxiMountDisplayId(sourceNode, GetTeam(),true); uint32 path = m_taxi.GetCurrentTaxiPath(); // search appropriate start path node @@ -17250,7 +17250,7 @@ void Player::InitDataForForm(bool reapplyMods) void Player::InitDisplayIds() { - PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(getRace(), getClass()); if(!info) { sLog.outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); @@ -17486,7 +17486,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement() uint32 max_personal_rating = 0; for(int i = 0; i < MAX_ARENA_SLOT; ++i) { - if(ArenaTeam * at = objmgr.GetArenaTeamById(GetArenaTeamId(i))) + if(ArenaTeam * at = sObjectMgr.GetArenaTeamById(GetArenaTeamId(i))) { uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); uint32 t_rating = at->GetRating(); @@ -17882,7 +17882,7 @@ void Player::SetBattleGroundEntryPoint() // If map is dungeon find linked graveyard if(GetMap()->IsDungeon()) { - if (const WorldSafeLocsEntry* entry = objmgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam())) + if (const WorldSafeLocsEntry* entry = sObjectMgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam())) { m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f); return; @@ -18406,7 +18406,7 @@ void Player::resetSpells() void Player::learnDefaultSpells() { // learn default race/class spells - PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(),getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(getRace(),getClass()); for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr!=info->spell.end(); ++itr) { uint32 tspell = *itr; @@ -18447,10 +18447,10 @@ void Player::learnQuestRewardedSpells(Quest const* quest) // prevent learn non first rank unknown profession and second specialization for same profession) uint32 learned_0 = spellInfo->EffectTriggerSpell[0]; - if( spellmgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) ) + if( sSpellMgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) ) { // not have first rank learned (unlearned prof?) - uint32 first_spell = spellmgr.GetFirstSpellInChain(learned_0); + uint32 first_spell = sSpellMgr.GetFirstSpellInChain(learned_0); if( !HasSpell(first_spell) ) return; @@ -18476,11 +18476,11 @@ void Player::learnQuestRewardedSpells(Quest const* quest) continue; // compare same chain spells - if(spellmgr.GetFirstSpellInChain(itr->first) != first_spell) + if(sSpellMgr.GetFirstSpellInChain(itr->first) != first_spell) continue; // now we have 2 specialization, learn possible only if found is lesser specialization rank - if(!spellmgr.IsHighRankOfSpell(learned_0,itr->first)) + if(!sSpellMgr.IsHighRankOfSpell(learned_0,itr->first)) return; } } @@ -18498,7 +18498,7 @@ void Player::learnQuestRewardedSpells() if(!itr->second.m_rewarded) continue; - Quest const* quest = objmgr.GetQuestTemplate(itr->first); + Quest const* quest = sObjectMgr.GetQuestTemplate(itr->first); if( !quest ) continue; @@ -18670,7 +18670,7 @@ bool Player::IsSpellFitByClassAndRace( uint32 spell_id ) const uint32 racemask = getRaceMask(); uint32 classmask = getClassMask(); - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spell_id); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spell_id); if (bounds.first==bounds.second) return true; @@ -18706,7 +18706,7 @@ bool Player::HasQuestForGO(int32 GOId) const if (qs.m_status == QUEST_STATUS_INCOMPLETE) { - Quest const* qinfo = objmgr.GetQuestTemplate(questid); + Quest const* qinfo = sObjectMgr.GetQuestTemplate(questid); if(!qinfo) continue; @@ -18751,7 +18751,7 @@ void Player::UpdateForQuestWorldObjects() if(!obj->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK)) continue; - SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(obj->GetEntry()); + SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(obj->GetEntry()); for(SpellClickInfoMap::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr) { if(_itr->second.questStart || _itr->second.questEnd) @@ -19199,7 +19199,7 @@ void Player::SetClientControl(Unit* target, uint8 allowMove) void Player::UpdateZoneDependentAuras( uint32 newZone ) { // Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update - SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newZone); + SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(newZone); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if(itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0)) if( !HasAura(itr->second->spellId,0) ) @@ -19212,14 +19212,14 @@ void Player::UpdateAreaDependentAuras( uint32 newArea ) for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();) { // use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date - if(spellmgr.GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,this) != SPELL_CAST_OK) + if(sSpellMgr.GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,this) != SPELL_CAST_OK) RemoveAura(iter); else ++iter; } // some auras applied at subzone enter - SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newArea); + SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(newArea); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if(itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea)) if( !HasAura(itr->second->spellId,0) ) @@ -19808,7 +19808,7 @@ void Player::learnSpellHighRank(uint32 spellid) learnSpell(spellid,false); DoPlayerLearnSpell worker(*this); - spellmgr.doForHighRanks(spellid,worker); + sSpellMgr.doForHighRanks(spellid,worker); } void Player::_LoadSkills() @@ -20317,7 +20317,7 @@ bool Player::canSeeSpellClickOn(Creature const *c) const if(!c->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK)) return false; - SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(c->GetEntry()); + SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(c->GetEntry()); for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) if(itr->second.IsFitToRequirements(this)) return true; @@ -20568,7 +20568,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) if(eqset.Guid == 0) { - eqslot.Guid = objmgr.GenerateEquipmentSetGuid(); + eqslot.Guid = sObjectMgr.GenerateEquipmentSetGuid(); WorldPacket data(SMSG_EQUIPMENT_SET_SAVED, 4 + 1); data << uint32(index); diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 27ff17502..27172f625 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -413,18 +413,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s // make sure the same guid doesn't already exist and is safe to use bool incHighest = true; - if (guid != 0 && guid < objmgr.m_hiCharGuid) + if (guid != 0 && guid < sObjectMgr.m_hiCharGuid) { result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE guid = '%d'", guid); if (result) { - guid = objmgr.m_hiCharGuid; // use first free if exists + guid = sObjectMgr.m_hiCharGuid; // use first free if exists delete result; } else incHighest = false; } else - guid = objmgr.m_hiCharGuid; + guid = sObjectMgr.m_hiCharGuid; // normalize the name if specified and check if it exists if (!normalizePlayerName(name)) @@ -447,7 +447,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s snprintf(newguid, 20, "%d", guid); snprintf(chraccount, 20, "%d", account); - snprintf(newpetid, 20, "%d", objmgr.GeneratePetNumber()); + snprintf(newpetid, 20, "%d", sObjectMgr.GeneratePetNumber()); snprintf(lastpetid, 20, "%s", ""); std::map items; @@ -533,7 +533,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if(!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid)) ROLLBACK(DUMP_FILE_BROKEN); for(uint16 field = PLAYER_FIELD_INV_SLOT_HEAD; field < PLAYER_FARSIGHT; field++) - if(!changetokGuid(vals, field+1, items, objmgr.m_hiItemGuid, true)) + if(!changetokGuid(vals, field+1, items, sObjectMgr.m_hiItemGuid, true)) ROLLBACK(DUMP_FILE_BROKEN); if(!changenth(line, 3, vals.c_str())) ROLLBACK(DUMP_FILE_BROKEN); @@ -563,25 +563,25 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s ROLLBACK(DUMP_FILE_BROKEN); // bag, item - if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true)) + if(!changeGuid(line, 2, items, sObjectMgr.m_hiItemGuid, true)) ROLLBACK(DUMP_FILE_BROKEN); - if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) + if(!changeGuid(line, 4, items, sObjectMgr.m_hiItemGuid)) ROLLBACK(DUMP_FILE_BROKEN); break; } case DTT_ITEM: // item_instance t. { // item, owner, data field:item, owner guid - if(!changeGuid(line, 1, items, objmgr.m_hiItemGuid)) + if(!changeGuid(line, 1, items, sObjectMgr.m_hiItemGuid)) ROLLBACK(DUMP_FILE_BROKEN); if(!changenth(line, 2, newguid)) ROLLBACK(DUMP_FILE_BROKEN); std::string vals = getnth(line,3); - if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid)) + if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, sObjectMgr.m_hiItemGuid)) ROLLBACK(DUMP_FILE_BROKEN); if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) ROLLBACK(DUMP_FILE_BROKEN); - if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, objmgr.m_ItemTextId,true)) + if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, sObjectMgr.m_ItemTextId,true)) ROLLBACK(DUMP_FILE_BROKEN); if(!changenth(line, 3, vals.c_str())) ROLLBACK(DUMP_FILE_BROKEN); @@ -592,7 +592,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s // guid,item_guid, if(!changenth(line, 1, newguid)) ROLLBACK(DUMP_FILE_BROKEN); - if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) + if(!changeGuid(line, 2, items, sObjectMgr.m_hiItemGuid)) ROLLBACK(DUMP_FILE_BROKEN); break; } @@ -603,7 +603,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if(strlen(lastpetid)==0) snprintf(lastpetid, 20, "%s", currpetid); if(strcmp(lastpetid,currpetid)!=0) { - snprintf(newpetid, 20, "%d", objmgr.GeneratePetNumber()); + snprintf(newpetid, 20, "%d", sObjectMgr.GeneratePetNumber()); snprintf(lastpetid, 20, "%s", currpetid); } @@ -641,20 +641,20 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s case DTT_MAIL: // mail { // id,messageType,stationery,mailtemplate,sender,receiver,subject,itemText - if(!changeGuid(line, 1, mails, objmgr.m_mailid)) + if(!changeGuid(line, 1, mails, sObjectMgr.m_mailid)) ROLLBACK(DUMP_FILE_BROKEN); if(!changenth(line, 6, newguid)) ROLLBACK(DUMP_FILE_BROKEN); - if(!changeGuid(line, 8, itemTexts, objmgr.m_ItemTextId)) + if(!changeGuid(line, 8, itemTexts, sObjectMgr.m_ItemTextId)) ROLLBACK(DUMP_FILE_BROKEN); break; } case DTT_MAIL_ITEM: // mail_items { // mail_id,item_guid,item_template,receiver - if(!changeGuid(line, 1, mails, objmgr.m_mailid)) + if(!changeGuid(line, 1, mails, sObjectMgr.m_mailid)) ROLLBACK(DUMP_FILE_BROKEN); - if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) + if(!changeGuid(line, 2, items, sObjectMgr.m_hiItemGuid)) ROLLBACK(DUMP_FILE_BROKEN); if(!changenth(line, 4, newguid)) ROLLBACK(DUMP_FILE_BROKEN); @@ -663,13 +663,13 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s case DTT_ITEM_TEXT: // item_text { // id - if(!changeGuid(line, 1, itemTexts, objmgr.m_ItemTextId)) + if(!changeGuid(line, 1, itemTexts, sObjectMgr.m_ItemTextId)) ROLLBACK(DUMP_FILE_BROKEN); // add it to cache uint32 id= atoi(getnth(line,1).c_str()); std::string text = getnth(line,2); - objmgr.AddItemText(id,text); + sObjectMgr.AddItemText(id,text); break; } default: @@ -683,12 +683,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s CharacterDatabase.CommitTransaction(); - objmgr.m_hiItemGuid += items.size(); - objmgr.m_mailid += mails.size(); - objmgr.m_ItemTextId += itemTexts.size(); + sObjectMgr.m_hiItemGuid += items.size(); + sObjectMgr.m_mailid += mails.size(); + sObjectMgr.m_ItemTextId += itemTexts.size(); if(incHighest) - ++objmgr.m_hiCharGuid; + ++sObjectMgr.m_hiCharGuid; fclose(fin); diff --git a/src/game/PoolManager.cpp b/src/game/PoolManager.cpp index 5090735b5..7ea09abd8 100644 --- a/src/game/PoolManager.cpp +++ b/src/game/PoolManager.cpp @@ -143,9 +143,9 @@ void PoolGroup::DespawnObject(uint32 guid) template<> void PoolGroup::Despawn1Object(uint32 guid) { - if (CreatureData const* data = objmgr.GetCreatureData(guid)) + if (CreatureData const* data = sObjectMgr.GetCreatureData(guid)) { - objmgr.RemoveCreatureFromGrid(guid, data); + sObjectMgr.RemoveCreatureFromGrid(guid, data); if (Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT))) pCreature->AddObjectToRemoveList(); @@ -156,9 +156,9 @@ void PoolGroup::Despawn1Object(uint32 guid) template<> void PoolGroup::Despawn1Object(uint32 guid) { - if (GameObjectData const* data = objmgr.GetGOData(guid)) + if (GameObjectData const* data = sObjectMgr.GetGOData(guid)) { - objmgr.RemoveGameobjectFromGrid(guid, data); + sObjectMgr.RemoveGameobjectFromGrid(guid, data); if (GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT))) pGameobject->AddObjectToRemoveList(); @@ -169,7 +169,7 @@ void PoolGroup::Despawn1Object(uint32 guid) template<> void PoolGroup::Despawn1Object(uint32 child_pool_id) { - poolhandler.DespawnPool(child_pool_id); + sPoolMgr.DespawnPool(child_pool_id); } // Method for a pool only to remove any found record causing a circular dependency loop @@ -243,12 +243,12 @@ void PoolGroup::SpawnObject(uint32 limit, uint32 triggerFrom) template <> bool PoolGroup::Spawn1Object(uint32 guid) { - if (CreatureData const* data = objmgr.GetCreatureData(guid)) + if (CreatureData const* data = sObjectMgr.GetCreatureData(guid)) { - objmgr.AddCreatureToGrid(guid, data); + sObjectMgr.AddCreatureToGrid(guid, data); // Spawn if necessary (loaded grids only) - Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); + Map* map = const_cast(sMapMgr.CreateBaseMap(data->mapid)); // We use spawn coords to spawn if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { @@ -271,12 +271,12 @@ bool PoolGroup::Spawn1Object(uint32 guid) template <> bool PoolGroup::Spawn1Object(uint32 guid) { - if (GameObjectData const* data = objmgr.GetGOData(guid)) + if (GameObjectData const* data = sObjectMgr.GetGOData(guid)) { - objmgr.AddGameobjectToGrid(guid, data); + sObjectMgr.AddGameobjectToGrid(guid, data); // Spawn if necessary (loaded grids only) // this base map checked as non-instanced and then only existed - Map* map = const_cast(mapmgr.CreateBaseMap(data->mapid)); + Map* map = const_cast(sMapMgr.CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { @@ -302,9 +302,9 @@ bool PoolGroup::Spawn1Object(uint32 guid) template <> bool PoolGroup::Spawn1Object(uint32 child_pool_id) { - poolhandler.SpawnPool(child_pool_id, 0, 0); - poolhandler.SpawnPool(child_pool_id, 0, TYPEID_GAMEOBJECT); - poolhandler.SpawnPool(child_pool_id, 0, TYPEID_UNIT); + sPoolMgr.SpawnPool(child_pool_id, 0, 0); + sPoolMgr.SpawnPool(child_pool_id, 0, TYPEID_GAMEOBJECT); + sPoolMgr.SpawnPool(child_pool_id, 0, TYPEID_UNIT); return true; } @@ -312,7 +312,7 @@ bool PoolGroup::Spawn1Object(uint32 child_pool_id) template <> bool PoolGroup::ReSpawn1Object(uint32 guid) { - if (CreatureData const* data = objmgr.GetCreatureData(guid)) + if (CreatureData const* data = sObjectMgr.GetCreatureData(guid)) { if (Creature* pCreature = ObjectAccessor::GetCreatureInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT))) pCreature->GetMap()->Add(pCreature); @@ -325,7 +325,7 @@ bool PoolGroup::ReSpawn1Object(uint32 guid) template <> bool PoolGroup::ReSpawn1Object(uint32 guid) { - if (GameObjectData const* data = objmgr.GetGOData(guid)) + if (GameObjectData const* data = sObjectMgr.GetGOData(guid)) { if (GameObject* pGameobject = ObjectAccessor::GetGameObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_GAMEOBJECT))) pGameobject->GetMap()->Add(pGameobject); @@ -428,7 +428,7 @@ void PoolManager::LoadFromDB() uint16 pool_id = fields[1].GetUInt16(); float chance = fields[2].GetFloat(); - CreatureData const* data = objmgr.GetCreatureData(guid); + CreatureData const* data = sObjectMgr.GetCreatureData(guid); if (!data) { sLog.outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id ); @@ -489,7 +489,7 @@ void PoolManager::LoadFromDB() uint16 pool_id = fields[1].GetUInt16(); float chance = fields[2].GetFloat(); - GameObjectData const* data = objmgr.GetGOData(guid); + GameObjectData const* data = sObjectMgr.GetGOData(guid); if (!data) { sLog.outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id ); diff --git a/src/game/PoolManager.h b/src/game/PoolManager.h index 6d2b83a16..6eb7369d9 100644 --- a/src/game/PoolManager.h +++ b/src/game/PoolManager.h @@ -99,5 +99,5 @@ class PoolManager }; -#define poolhandler MaNGOS::Singleton::Instance() +#define sPoolMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 52c656cec..657ab2e27 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -129,7 +129,7 @@ void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data ) recv_data >> guid; - Player *pChar = objmgr.GetPlayer(guid); + Player *pChar = sObjectMgr.GetPlayer(guid); if (pChar) SendNameQueryOpcode(pChar); @@ -164,7 +164,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - CreatureLocale const *cl = objmgr.GetCreatureLocale(entry); + CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(entry); if (cl) { if (cl->Name.size() > size_t(loc_idx) && !cl->Name[loc_idx].empty()) @@ -233,7 +233,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - GameObjectLocale const *gl = objmgr.GetGameObjectLocale(entryID); + GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(entryID); if (gl) { if (gl->Name.size() > size_t(loc_idx) && !gl->Name[loc_idx].empty()) @@ -299,7 +299,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0) { // if corpse map have entrance - if(Map const* entranceMap = mapmgr.CreateBaseMap(corpseMapEntry->entrance_map)) + if(Map const* entranceMap = sMapMgr.CreateBaseMap(corpseMapEntry->entrance_map)) { mapid = corpseMapEntry->entrance_map; x = corpseMapEntry->entrance_x; @@ -332,7 +332,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) recv_data >> guid; _player->SetTargetGUID(guid); - GossipText const* pGossip = objmgr.GetGossipText(textID); + GossipText const* pGossip = sObjectMgr.GetGossipText(textID); WorldPacket data( SMSG_NPC_TEXT_UPDATE, 100 ); // guess size data << textID; @@ -365,7 +365,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); + NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textID); if (nl) { for (int i = 0; i < 8; ++i) @@ -436,7 +436,7 @@ void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - PageTextLocale const *pl = objmgr.GetPageTextLocale(pageID); + PageTextLocale const *pl = sObjectMgr.GetPageTextLocale(pageID); if (pl) { if (pl->Text.size() > size_t(loc_idx) && !pl->Text[loc_idx].empty()) diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 6c6c4cb76..5409b65d2 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -129,7 +129,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) return; } - Quest const* qInfo = objmgr.GetQuestTemplate(quest); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest); if ( qInfo ) { // prevent cheating @@ -239,7 +239,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data ) return; } - Quest const* pQuest = objmgr.GetQuestTemplate(quest); + Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest); if ( pQuest ) { _player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, pObject->GetGUID(), true); @@ -252,7 +252,7 @@ void WorldSession::HandleQuestQueryOpcode( WorldPacket & recv_data ) recv_data >> quest; sLog.outDebug( "WORLD: Received CMSG_QUEST_QUERY quest = %u",quest ); - Quest const *pQuest = objmgr.GetQuestTemplate(quest); + Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest); if ( pQuest ) { _player->PlayerTalkClass->SendQuestQueryResponse( pQuest ); @@ -283,7 +283,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data ) if(!pObject->hasInvolvedQuest(quest)) return; - Quest const *pQuest = objmgr.GetQuestTemplate(quest); + Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest); if( pQuest ) { if( _player->CanRewardQuest( pQuest, reward, true ) ) @@ -336,7 +336,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE ) return; - if(Quest const *pQuest = objmgr.GetQuestTemplate(quest)) + if(Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest)) _player->PlayerTalkClass->SendQuestGiverOfferReward( pQuest, guid, true ); } @@ -374,7 +374,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data) if(!_player->TakeQuestSourceItem( quest, true )) return; // can't un-equip some items, reject quest cancel - if (const Quest *pQuest = objmgr.GetQuestTemplate(quest)) + if (const Quest *pQuest = sObjectMgr.GetQuestTemplate(quest)) { if (pQuest->HasFlag(QUEST_MANGOS_FLAGS_TIMED)) _player->RemoveTimedQuest(quest); @@ -396,7 +396,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data) sLog.outDebug("WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", quest); - if (const Quest* pQuest = objmgr.GetQuestTemplate(quest)) + if (const Quest* pQuest = sObjectMgr.GetQuestTemplate(quest)) { if (!pQuest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT)) return; @@ -435,7 +435,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest ); - Quest const *pQuest = objmgr.GetQuestTemplate(quest); + Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest); if( pQuest ) { if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE ) @@ -467,7 +467,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) sLog.outDebug("WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId); - if (Quest const *pQuest = objmgr.GetQuestTemplate(questId)) + if (Quest const *pQuest = sObjectMgr.GetQuestTemplate(questId)) { if (Group* pGroup = _player->GetGroup()) { @@ -550,14 +550,14 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 { case TYPEID_GAMEOBJECT: { - qir = &objmgr.mGOQuestInvolvedRelations; - qr = &objmgr.mGOQuestRelations; + qir = &sObjectMgr.mGOQuestInvolvedRelations; + qr = &sObjectMgr.mGOQuestRelations; break; } case TYPEID_UNIT: { - qir = &objmgr.mCreatureQuestInvolvedRelations; - qr = &objmgr.mCreatureQuestRelations; + qir = &sObjectMgr.mCreatureQuestInvolvedRelations; + qr = &sObjectMgr.mCreatureQuestRelations; break; } default: @@ -570,7 +570,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 { uint32 result2 = 0; uint32 quest_id = i->second; - Quest const *pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id); if ( !pQuest ) continue; QuestStatus status = pPlayer->GetQuestStatus( quest_id ); @@ -593,7 +593,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 { uint32 result2 = 0; uint32 quest_id = i->second; - Quest const *pQuest = objmgr.GetQuestTemplate(quest_id); + Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id); if ( !pQuest ) continue; diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp index adbdcb1f1..99435b34e 100644 --- a/src/game/ScriptCalls.cpp +++ b/src/game/ScriptCalls.cpp @@ -94,7 +94,7 @@ bool LoadScriptingModule(char const* libName) UnloadScriptingModule(); Script=testScript; - Script->ScriptsInit(objmgr.GetScriptNames()); + Script->ScriptsInit(sObjectMgr.GetScriptNames()); sWorld.SetScriptsVersion(Script->ScriptsVersion()); diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index 91c915ff6..e3e1672fb 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -116,7 +116,7 @@ void LoadSkillDiscoveryTable() } else if (reqSkillOrSpell == 0) // skill case { - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellId); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spellId); if (bounds.first==bounds.second) { @@ -167,7 +167,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) if (tab == SkillDiscoveryStore.end()) return 0; - SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellId); + SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(spellId); uint32 skillvalue = bounds.first != bounds.second ? player->GetSkillValue(bounds.first->second->skillId) : 0; float full_chance = 0; diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index ba2bd7762..e4811f1df 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -120,7 +120,7 @@ void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note) void PlayerSocial::SendSocialList() { - Player *plr = objmgr.GetPlayer(GetPlayerGUID()); + Player *plr = sObjectMgr.GetPlayer(GetPlayerGUID()); if(!plr) return; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 91243bc18..954fffb19 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1991,7 +1991,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) } case TARGET_TABLE_X_Y_Z_COORDINATES: { - SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id); + SpellTargetPosition const* st = sSpellMgr.GetSpellTargetPosition(m_spellInfo->Id); if(st) { if (st->target_mapId == m_caster->GetMapId()) @@ -2187,7 +2187,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap) case SPELL_EFFECT_SUMMON_PLAYER: if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection()) { - Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection()); + Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection()); if(target) TagUnitMap.push_back(target); } @@ -3765,14 +3765,14 @@ void Spell::HandleThreatSpells(uint32 spellId) if(!m_targets.getUnitTarget()->CanHaveThreatList()) return; - uint16 threat = spellmgr.GetSpellThreat(spellId); + uint16 threat = sSpellMgr.GetSpellThreat(spellId); if(!threat) return; m_targets.getUnitTarget()->AddThreat(m_caster, float(threat), false, GetSpellSchoolMask(m_spellInfo), m_spellInfo); - DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threat); + DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, sSpellMgr.GetSpellRank(spellId), threat); } void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i, float DamageMultiplier) @@ -4093,7 +4093,7 @@ SpellCastResult Spell::CheckCast(bool strict) uint32 zone, area; m_caster->GetZoneAndAreaId(zone, area); - SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area, + SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area, m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()); if (locRes != SPELL_CAST_OK) return locRes; @@ -4128,7 +4128,7 @@ SpellCastResult Spell::CheckCast(bool strict) m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT) { - SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id); + SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id); if(bounds.first==bounds.second) sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id); @@ -4609,7 +4609,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(!((Player*)m_caster)->GetSelection()) return SPELL_FAILED_BAD_TARGETS; - Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection()); + Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection()); if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) ) return SPELL_FAILED_BAD_TARGETS; @@ -5690,7 +5690,7 @@ void Spell::UpdatePointers() bool Spell::IsAffectedByAura(Aura *aura) { - return spellmgr.IsAffectedByMod(m_spellInfo, aura->getAuraSpellMod()); + return sSpellMgr.IsAffectedByMod(m_spellInfo, aura->getAuraSpellMod()); } bool Spell::CheckTargetCreatureType(Unit* target) const diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 2fb4800a8..7f83e7e26 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -828,7 +828,7 @@ void AreaAura::Update(uint32 diff) if(!apply) continue; - if(SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter)->getLevel())) + if(SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter)->getLevel())) { int32 actualBasePoints = m_currentBasePoints; // recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?) @@ -2682,7 +2682,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } // pet auras - if(PetAura const* petSpell = spellmgr.GetPetAura(GetId(), m_effIndex)) + if(PetAura const* petSpell = sSpellMgr.GetPetAura(GetId(), m_effIndex)) { if(apply) m_target->AddPetAura(petSpell); @@ -2693,7 +2693,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER) { - SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId()); + SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); if(saBounds.first != saBounds.second) { uint32 zone, area; @@ -2734,8 +2734,8 @@ void Aura::HandleAuraMounted(bool apply, bool Real) if (m_target->GetTypeId()==TYPEID_PLAYER) team = ((Player*)m_target)->GetTeam(); - uint32 display_id = objmgr.ChooseDisplayId(team,ci); - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); + uint32 display_id = sObjectMgr.ChooseDisplayId(team,ci); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; @@ -3206,8 +3206,8 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (m_target->GetTypeId() == TYPEID_PLAYER) team = ((Player*)m_target)->GetTeam(); - uint32 display_id = objmgr.ChooseDisplayId(team, ci); - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); + uint32 display_id = sObjectMgr.ChooseDisplayId(team, ci); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; @@ -3522,7 +3522,7 @@ void Aura::HandleModCharm(bool apply, bool Real) } //just to enable stat window - charmInfo->SetPetNumber(objmgr.GeneratePetNumber(), true); + charmInfo->SetPetNumber(sObjectMgr.GeneratePetNumber(), true); //if charmed two demons the same session, the 2nd gets the 1st one's name m_target->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); } @@ -3669,7 +3669,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(GetId() == 39837) { GameObject* pObj = new GameObject; - if(pObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, m_target->GetMap(), m_target->GetPhaseMask(), + if(pObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, m_target->GetMap(), m_target->GetPhaseMask(), m_target->GetPositionX(), m_target->GetPositionY(), m_target->GetPositionZ(), m_target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { pObj->SetRespawnTime(GetAuraDuration()/IN_MILISECONDS); @@ -6231,7 +6231,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) case 0: { // energize caster - int32 manapct1000 = 5 * ((*itr)->GetModifier()->m_amount + spellmgr.GetSpellRank(vSpell->Id)); + int32 manapct1000 = 5 * ((*itr)->GetModifier()->m_amount + sSpellMgr.GetSpellRank(vSpell->Id)); int32 basepoints0 = caster->GetMaxPower(POWER_MANA) * manapct1000 / 1000; caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true); break; @@ -7355,7 +7355,7 @@ void Aura::HandlePhase(bool apply, bool Real) if(GetEffIndex()==0) { - SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId()); + SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); if(saBounds.first != saBounds.second) { uint32 zone, area; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 24ec8903a..16170daa5 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -889,7 +889,7 @@ void Spell::EffectDummy(uint32 i) Map *map = creatureTarget->GetMap(); // create before death for get proper coordinates - if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), + if (!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY) ) { @@ -1934,7 +1934,7 @@ void Spell::EffectDummy(uint32 i) } // pet auras - if (PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id, i)) + if (PetAura const* petSpell = sSpellMgr.GetPetAura(m_spellInfo->Id, i)) { m_caster->AddPetAura(petSpell); return; @@ -2260,7 +2260,7 @@ void Spell::EffectTeleportUnits(uint32 i) case TARGET_AREAEFFECT_INSTANT: // in all cases first TARGET_TABLE_X_Y_Z_COORDINATES case TARGET_TABLE_X_Y_Z_COORDINATES: { - SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id); + SpellTargetPosition const* st = sSpellMgr.GetSpellTargetPosition(m_spellInfo->Id); if(!st) { sLog.outError( "Spell::EffectTeleportUnits - unknown Teleport coordinates for spell ID %u", m_spellInfo->Id ); @@ -2953,7 +2953,7 @@ void Spell::EffectEnergize(uint32 i) for(Unit::AuraMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr) { uint32 spell_id = itr->second->GetId(); - if(uint32 mask = spellmgr.GetSpellElixirMask(spell_id)) + if(uint32 mask = sSpellMgr.GetSpellElixirMask(spell_id)) elixir_mask |= mask; } @@ -2962,7 +2962,7 @@ void Spell::EffectEnergize(uint32 i) // get all available elixirs by mask and spell level std::vector elixirs; - SpellElixirMap const& m_spellElixirs = spellmgr.GetSpellElixirMap(); + SpellElixirMap const& m_spellElixirs = sSpellMgr.GetSpellElixirMap(); for(SpellElixirMap::const_iterator itr = m_spellElixirs.begin(); itr != m_spellElixirs.end(); ++itr) { if (itr->second & elixir_mask) @@ -3395,7 +3395,7 @@ void Spell::EffectSummon(uint32 i) } Map *map = m_caster->GetMap(); - uint32 pet_number = objmgr.GeneratePetNumber(); + uint32 pet_number = sObjectMgr.GeneratePetNumber(); if (!spawnCreature->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { @@ -3810,7 +3810,7 @@ void Spell::EffectSummonGuardian(uint32 i) Pet* spawnCreature = new Pet(GUARDIAN_PET); Map *map = m_caster->GetMap(); - uint32 pet_number = objmgr.GeneratePetNumber(); + uint32 pet_number = sObjectMgr.GeneratePetNumber(); if (!spawnCreature->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map,m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { @@ -4279,7 +4279,7 @@ void Spell::EffectSummonPet(uint32 i) } Map *map = m_caster->GetMap(); - uint32 pet_number = objmgr.GeneratePetNumber(); + uint32 pet_number = sObjectMgr.GeneratePetNumber(); if(!NewSummon->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), petentry, pet_number)) { @@ -4354,7 +4354,7 @@ void Spell::EffectSummonPet(uint32 i) } // generate new name for summon pet - std::string new_name=objmgr.GeneratePetName(petentry); + std::string new_name=sObjectMgr.GeneratePetName(petentry); if(!new_name.empty()) NewSummon->SetName(new_name); } @@ -4798,7 +4798,7 @@ void Spell::EffectSummonObjectWild(uint32 i) Map *map = target->GetMap(); - if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, + if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { delete pGameObj; @@ -4847,7 +4847,7 @@ void Spell::EffectSummonObjectWild(uint32 i) if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry()) { GameObject* linkedGO = new GameObject; - if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map, + if(linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); @@ -5613,7 +5613,7 @@ void Spell::EffectDuel(uint32 i) uint32 gameobject_id = m_spellInfo->EffectMiscValue[i]; Map *map = m_caster->GetMap(); - if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, + if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, m_caster->GetPhaseMask(), m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 , m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 , @@ -5798,7 +5798,7 @@ void Spell::EffectSummonTotem(uint32 i) Totem* pTotem = new Totem; - if(!pTotem->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), m_caster->GetMap(), m_caster->GetPhaseMask(), + if(!pTotem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), m_caster->GetMap(), m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], team )) { delete pTotem; @@ -6006,7 +6006,7 @@ void Spell::EffectSummonObject(uint32 i) m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map *map = m_caster->GetMap(); - if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, + if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete pGameObj; @@ -6300,7 +6300,7 @@ void Spell::EffectSummonCritter(uint32 i) Pet* critter = new Pet(MINI_PET); Map *map = m_caster->GetMap(); - uint32 pet_number = objmgr.GeneratePetNumber(); + uint32 pet_number = sObjectMgr.GeneratePetNumber(); if(!critter->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), pet_entry, pet_number)) { @@ -6569,7 +6569,7 @@ void Spell::EffectTransmitted(uint32 effIndex) GameObject* pGameObj = new GameObject; - if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, + if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { delete pGameObj; @@ -6630,7 +6630,7 @@ void Spell::EffectTransmitted(uint32 effIndex) if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry()) { GameObject* linkedGO = new GameObject; - if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap, + if(linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index f6b9e5efc..da998c78f 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -357,7 +357,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) // auto-selection buff level base at target level (in spellInfo) if(targets.getUnitTarget()) { - SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(spellInfo,targets.getUnitTarget()->getLevel()); + SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForPlayerLevel(spellInfo,targets.getUnitTarget()->getLevel()); // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message if(actualSpellInfo) @@ -554,7 +554,7 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data ) if (!unit || unit->isInCombat()) // client prevent click and set different icon at combat state return; - SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(unit->GetEntry()); + SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry()); for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) { if (itr->second.IsFitToRequirements(_player)) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 75e07ff40..8ac87a673 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -312,7 +312,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) } case SPELLFAMILY_POTION: - return spellmgr.GetSpellElixirSpecific(spellInfo->Id); + return sSpellMgr.GetSpellElixirSpecific(spellInfo->Id); case SPELLFAMILY_DEATHKNIGHT: if (spellInfo->Category == 47) @@ -321,7 +321,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) } // elixirs can have different families, but potion most ofc. - if(SpellSpecific sp = spellmgr.GetSpellElixirSpecific(spellInfo->Id)) + if(SpellSpecific sp = sSpellMgr.GetSpellElixirSpecific(spellInfo->Id)) return sp; return SPELL_NORMAL; @@ -845,7 +845,7 @@ bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) struct DoSpellProcEvent { DoSpellProcEvent(SpellProcEventEntry const& _spe) : spe(_spe) {} - void operator() (uint32 spell_id) { spellmgr.mSpellProcEventMap[spell_id] = spe; } + void operator() (uint32 spell_id) { sSpellMgr.mSpellProcEventMap[spell_id] = spe; } SpellProcEventEntry const& spe; }; @@ -934,7 +934,7 @@ void SpellMgr::LoadSpellProcEvents() struct DoSpellProcItemEnchant { DoSpellProcItemEnchant(float _ppm) : ppm(_ppm) {} - void operator() (uint32 spell_id) { spellmgr.mSpellProcItemEnchantMap[spell_id] = ppm; } + void operator() (uint32 spell_id) { sSpellMgr.mSpellProcItemEnchantMap[spell_id] = ppm; } float ppm; }; @@ -1004,7 +1004,7 @@ void SpellMgr::LoadSpellProcItemEnchant() struct DoSpellBonusess { DoSpellBonusess(SpellBonusEntry const& _spellBonus) : spellBonus(_spellBonus) {} - void operator() (uint32 spell_id) { spellmgr.mSpellBonusMap[spell_id] = spellBonus; } + void operator() (uint32 spell_id) { sSpellMgr.mSpellBonusMap[spell_id] = spellBonus; } SpellBonusEntry const& spellBonus; }; @@ -1251,7 +1251,7 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo) if(IsProfessionOrRidingSpell(spellInfo->Id)) return false; - if(spellmgr.IsSkillBonusSpell(spellInfo->Id)) + if(sSpellMgr.IsSkillBonusSpell(spellInfo->Id)) return false; // All stance spells. if any better way, change it. @@ -2260,8 +2260,8 @@ void SpellMgr::LoadSpellScriptTarget() { if( spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || spellInfo->EffectImplicitTargetA[j] != TARGET_SELF && spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT ) { - SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(spellInfo->Id); - SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(spellInfo->Id); + SpellScriptTarget::const_iterator lower = sSpellMgr.GetBeginSpellScriptTarget(spellInfo->Id); + SpellScriptTarget::const_iterator upper = sSpellMgr.GetEndSpellScriptTarget(spellInfo->Id); if(lower==upper) { sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = %u (TARGET_SCRIPT), but does not have record in `spell_script_target`",spellInfo->Id,TARGET_SCRIPT); @@ -2408,7 +2408,7 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr return false; // remove duplicates with levelupSpells if any - if(PetLevelupSpellSet const *levelupSpells = cInfo->family ? spellmgr.GetPetLevelupSpellList(cInfo->family) : NULL) + if(PetLevelupSpellSet const *levelupSpells = cInfo->family ? sSpellMgr.GetPetLevelupSpellList(cInfo->family) : NULL) { for(int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { @@ -2680,7 +2680,7 @@ void SpellMgr::LoadSpellAreas() continue; } - if(spellArea.questStart && !objmgr.GetQuestTemplate(spellArea.questStart)) + if(spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell,spellArea.questStart); continue; @@ -2688,7 +2688,7 @@ void SpellMgr::LoadSpellAreas() if(spellArea.questEnd) { - if(!objmgr.GetQuestTemplate(spellArea.questEnd)) + if(!sObjectMgr.GetQuestTemplate(spellArea.questEnd)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell,spellArea.questEnd); continue; @@ -2849,7 +2849,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell } // DB base check (if non empty then must fit at least single for allow) - SpellAreaMapBounds saBounds = spellmgr.GetSpellAreaMapBounds(spellInfo->Id); + SpellAreaMapBounds saBounds = sSpellMgr.GetSpellAreaMapBounds(spellInfo->Id); if (saBounds.first != saBounds.second) { for(SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index f8675224c..fbe5621d3 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -1035,5 +1035,5 @@ class SpellMgr SpellAreaForAreaMap mSpellAreaForAreaMap; }; -#define spellmgr SpellMgr::Instance() +#define sSpellMgr SpellMgr::Instance() #endif diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index be879ab9b..754a441c0 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -49,7 +49,7 @@ void WorldSession::SendTaxiStatus( uint64 guid ) return; } - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); + uint32 curloc = sObjectMgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); // not found nearest if(curloc == 0) @@ -94,7 +94,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data ) void WorldSession::SendTaxiMenu( Creature* unit ) { // find current node - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); + uint32 curloc = sObjectMgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); if ( curloc == 0 ) return; @@ -129,7 +129,7 @@ void WorldSession::SendDoFlight( uint32 mountDisplayId, uint32 path, uint32 path bool WorldSession::SendLearnNewTaxiNode( Creature* unit ) { // find current node - uint32 curloc = objmgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); + uint32 curloc = sObjectMgr.GetNearestTaxiNode(unit->GetPositionX(),unit->GetPositionY(),unit->GetPositionZ(),unit->GetMapId(),GetPlayer( )->GetTeam()); if ( curloc == 0 ) return true; // `true` send to avoid WorldSession::SendTaxiMenu call with one more curlock seartch with same false result. @@ -231,10 +231,10 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& /*recv_data*/) sLog.outDebug( "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode ); - uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam()); + uint32 mountDisplayId = sObjectMgr.GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam()); uint32 path, cost; - objmgr.GetTaxiPath( sourcenode, destinationnode, path, cost); + sObjectMgr.GetTaxiPath( sourcenode, destinationnode, path, cost); if(path && mountDisplayId) SendDoFlight( mountDisplayId, path, 1 ); // skip start fly node diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 1bfcc7e22..e14dba9f3 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -59,8 +59,8 @@ void Totem::Summon(Unit* owner) CreatureInfo const *cinfo = GetCreatureInfo(); if(owner->GetTypeId() == TYPEID_PLAYER && cinfo) { - uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); - CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); + uint32 display_id = sObjectMgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo); + CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; SetDisplayId(display_id); diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index d143c2a7d..9494d86f9 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -102,7 +102,7 @@ void MapManager::LoadTransports() m_TransportsByMap[*i].insert(t); //If we someday decide to use the grid to track transports, here: - t->SetMap(mapmgr.CreateMap(mapid, t)); + t->SetMap(sMapMgr.CreateMap(mapid, t)); //t->GetMap()->Add((GameObject *)t); ++count; @@ -205,7 +205,7 @@ struct keyFrame bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) { TransportPath path; - objmgr.GetTransportPathNodes(pathid, path); + sObjectMgr.GetTransportPathNodes(pathid, path); if (path.Empty()) return false; @@ -459,7 +459,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... //player far teleport would try to create same instance, but we need it NOW for transport... //correct me if I'm wrong O.o - Map * newMap = mapmgr.CreateMap(newMapid, this); + Map * newMap = sMapMgr.CreateMap(newMapid, this); SetMap(newMap); if(oldMap != newMap) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 31cbad0af..166cbaa73 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -691,7 +691,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // the reset time is set but not added to the scheduler // until the players leave the instance time_t resettime = cVictim->GetRespawnTimeEx() + 2 * HOUR; - if(InstanceSave *save = sInstanceSaveManager.GetInstanceSave(cVictim->GetInstanceId())) + if(InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(cVictim->GetInstanceId())) if(save->GetResetTime() < resettime) save->SetResetTime(resettime); } } @@ -3617,7 +3617,7 @@ void Unit::RemoveRankAurasDueToSpell(uint32 spellId) uint32 i_spellId = (*i).second->GetId(); if((*i).second && i_spellId && i_spellId != spellId) { - if(spellmgr.IsRankSpellDueToSpell(spellInfo,i_spellId)) + if(sSpellMgr.IsRankSpellDueToSpell(spellInfo,i_spellId)) { RemoveAurasDueToSpell(i_spellId); @@ -3673,7 +3673,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) continue; // passive non-stackable spells not stackable only with another rank of same spell - if (!spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) + if (!sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) continue; } @@ -3703,7 +3703,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) if( is_spellSpecPerTarget || is_spellSpecPerTargetPerCaster && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) { // cannot remove higher rank - if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) + if (sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) return false; @@ -3726,7 +3726,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) // spell with spell specific that allow single ranks for spell from diff caster // same caster case processed or early or later bool is_spellPerTarget = IsSingleFromSpellSpecificSpellRanksPerTarget(spellId_spec,i_spellId_spec); - if ( is_spellPerTarget && Aur->GetCasterGUID() != (*i).second->GetCasterGUID() && spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) + if ( is_spellPerTarget && Aur->GetCasterGUID() != (*i).second->GetCasterGUID() && sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) { // cannot remove higher rank if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) @@ -3749,7 +3749,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) } // non single (per caster) per target spell specific (possible single spell per target at caster) - if( !is_spellSpecPerTargetPerCaster && !is_spellSpecPerTarget && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) + if( !is_spellSpecPerTargetPerCaster && !is_spellSpecPerTarget && sSpellMgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) { // Its a parent aura (create this aura in ApplyModifier) if ((*i).second->IsInUse()) @@ -7175,7 +7175,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB { // have rank dependent proc chance, ignore too often cases // PPM = 2.5 * (rank of talent), - uint32 rank = spellmgr.GetSpellRank(auraSpellInfo->Id); + uint32 rank = sSpellMgr.GetSpellRank(auraSpellInfo->Id); // 5 rank -> 100% 4 rank -> 80% and etc from full rate if(!roll_chance_i(20*rank)) return false; @@ -8463,7 +8463,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 SpellModSpellDamage /= 100.0f; // Check for table values - if (SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id)) + if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) { float coeff; if (damagetype == DOT) @@ -8911,7 +8911,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint SpellModSpellDamage /= 100.0f; // Check for table values - SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id); + SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id); if (bonus) { float coeff; @@ -9377,7 +9377,7 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att float LvlPenalty = CalculateLevelPenalty(spellProto); // Check for table values - if (SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id)) + if (SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellProto->Id)) { float coeff; if (damagetype == DOT) @@ -11219,14 +11219,14 @@ void CharmInfo::InitCharmCreateSpells() bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate) { - uint32 first_id = spellmgr.GetFirstSpellInChain(spell_id); + uint32 first_id = sSpellMgr.GetFirstSpellInChain(spell_id); // new spell rank can be already listed for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { if (uint32 action = PetActionBar[i].GetAction()) { - if (PetActionBar[i].IsActionBarForSpell() && spellmgr.GetFirstSpellInChain(action) == first_id) + if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr.GetFirstSpellInChain(action) == first_id) { PetActionBar[i].SetAction(spell_id); return true; @@ -11248,13 +11248,13 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate) bool CharmInfo::RemoveSpellFromActionBar(uint32 spell_id) { - uint32 first_id = spellmgr.GetFirstSpellInChain(spell_id); + uint32 first_id = sSpellMgr.GetFirstSpellInChain(spell_id); for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { if (uint32 action = PetActionBar[i].GetAction()) { - if (PetActionBar[i].IsActionBarForSpell() && spellmgr.GetFirstSpellInChain(action) == first_id) + if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr.GetFirstSpellInChain(action) == first_id) { SetActionBar(i,0,ACT_DISABLED); return true; @@ -11981,7 +11981,7 @@ void Unit::ClearComboPointHolders() { uint32 lowguid = *m_ComboPointHolders.begin(); - Player* plr = objmgr.GetPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); + Player* plr = sObjectMgr.GetPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); if(plr && plr->GetComboTarget()==GetGUID()) // recheck for safe plr->ClearComboPoints(); // remove also guid from m_ComboPointHolders; else @@ -12341,7 +12341,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return NULL; } - pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); + pet->GetCharmInfo()->SetPetNumber(sObjectMgr.GeneratePetNumber(), true); // this enables pet details window (Shift+P) pet->AIM_Initialize(); pet->InitPetCreateSpells(); @@ -12357,7 +12357,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry con SpellEntry const* spellProto = aura->GetSpellProto (); // Get proc Event Entry - spellProcEvent = spellmgr.GetSpellProcEvent(spellProto->Id); + spellProcEvent = sSpellMgr.GetSpellProcEvent(spellProto->Id); // Aura info stored here Modifier *mod = aura->GetModifier(); diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index 831ffca68..e0f60bd2c 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -331,7 +331,7 @@ void WaypointManager::CheckTextsExistance(std::set& ids) } else { - if (!objmgr.GetMangosStringLocale(be->textid[j])) + if (!sObjectMgr.GetMangosStringLocale(be->textid[j])) { sLog.outErrorDb("Some waypoint has textid%u with not existing %u text.", j, be->textid[j]); be->textid[j] = 0; diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index 54f2fec82..28ea5f6a0 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -87,6 +87,6 @@ class WaypointManager WaypointPathMap m_pathMap; }; -#define WaypointMgr MaNGOS::Singleton::Instance() +#define sWaypointMgr MaNGOS::Singleton::Instance() #endif diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index db6c459e7..60f8b5477 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -47,7 +47,7 @@ void WaypointMovementGenerator::LoadPath(Creature &c) { sLog.outDetail("LoadPath: loading waypoint path for creature %d,%d", c.GetGUIDLow(), c.GetDBTableGUIDLow()); - i_path = WaypointMgr.GetPath(c.GetDBTableGUIDLow()); + i_path = sWaypointMgr.GetPath(c.GetDBTableGUIDLow()); if(!i_path) { sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %d) doesn't have waypoint path", @@ -213,7 +213,7 @@ void WaypointMovementGenerator::MovementInform(Creature &unit) //----------------------------------------------------// void FlightPathMovementGenerator::LoadPath(Player &) { - objmgr.GetTaxiPathNodes(i_pathId, i_path,i_mapIds); + sObjectMgr.GetTaxiPathNodes(i_pathId, i_path,i_mapIds); } uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const diff --git a/src/game/World.cpp b/src/game/World.cpp index 3f77b6c4d..ce6244b35 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -377,7 +377,7 @@ void World::RemoveWeather(uint32 id) /// Add a Weather object to the list Weather* World::AddWeather(uint32 zone_id) { - WeatherZoneChances const* weatherChances = objmgr.GetWeatherChances(zone_id); + WeatherZoneChances const* weatherChances = sObjectMgr.GetWeatherChances(zone_id); // zone not have weather, ignore if(!weatherChances) @@ -569,7 +569,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; } if(reload) - mapmgr.SetGridCleanUpDelay(m_configs[CONFIG_INTERVAL_GRIDCLEAN]); + sMapMgr.SetGridCleanUpDelay(m_configs[CONFIG_INTERVAL_GRIDCLEAN]); m_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfig.GetIntDefault("MapUpdateInterval", 100); if(m_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) @@ -578,7 +578,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if(reload) - mapmgr.SetMapUpdateInterval(m_configs[CONFIG_INTERVAL_MAPUPDATE]); + sMapMgr.SetMapUpdateInterval(m_configs[CONFIG_INTERVAL_MAPUPDATE]); m_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfig.GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILISECONDS); @@ -1113,7 +1113,7 @@ void World::SetInitialWorldSettings() LoadConfigSettings(); ///- Init highest guids before any table loading to prevent using not initialized guids in some code. - objmgr.SetHighestGuids(); + sObjectMgr.SetHighestGuids(); ///- Check the existence of the map files for all races' startup areas. if( !MapManager::ExistMapAndVMap(0,-6240.32f, 331.033f) @@ -1133,7 +1133,7 @@ void World::SetInitialWorldSettings() ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. sLog.outString(); sLog.outString("Loading MaNGOS strings..."); - if (!objmgr.LoadMangosStrings()) + if (!sObjectMgr.LoadMangosStrings()) exit(1); // Error message displayed in function already ///- Update the realm entry in the database with the realm type from the config file @@ -1153,124 +1153,124 @@ void World::SetInitialWorldSettings() DetectDBCLang(); sLog.outString( "Loading Script Names..."); - objmgr.LoadScriptNames(); + sObjectMgr.LoadScriptNames(); sLog.outString( "Loading InstanceTemplate..." ); - objmgr.LoadInstanceTemplate(); + sObjectMgr.LoadInstanceTemplate(); sLog.outString( "Loading SkillLineAbilityMultiMap Data..." ); - spellmgr.LoadSkillLineAbilityMap(); + sSpellMgr.LoadSkillLineAbilityMap(); ///- Clean up and pack instances sLog.outString( "Cleaning up instances..." ); - sInstanceSaveManager.CleanupInstances(); // must be called before `creature_respawn`/`gameobject_respawn` tables + sInstanceSaveMgr.CleanupInstances(); // must be called before `creature_respawn`/`gameobject_respawn` tables sLog.outString( "Packing instances..." ); - sInstanceSaveManager.PackInstances(); + sInstanceSaveMgr.PackInstances(); sLog.outString(); sLog.outString( "Loading Localization strings..." ); - objmgr.LoadCreatureLocales(); - objmgr.LoadGameObjectLocales(); - objmgr.LoadItemLocales(); - objmgr.LoadQuestLocales(); - objmgr.LoadNpcTextLocales(); - objmgr.LoadPageTextLocales(); - objmgr.LoadNpcOptionLocales(); - objmgr.LoadPointOfInterestLocales(); - objmgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) + sObjectMgr.LoadCreatureLocales(); + sObjectMgr.LoadGameObjectLocales(); + sObjectMgr.LoadItemLocales(); + sObjectMgr.LoadQuestLocales(); + sObjectMgr.LoadNpcTextLocales(); + sObjectMgr.LoadPageTextLocales(); + sObjectMgr.LoadNpcOptionLocales(); + sObjectMgr.LoadPointOfInterestLocales(); + sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) sLog.outString( ">>> Localization strings loaded" ); sLog.outString(); sLog.outString( "Loading Page Texts..." ); - objmgr.LoadPageTexts(); + sObjectMgr.LoadPageTexts(); sLog.outString( "Loading Game Object Templates..." ); // must be after LoadPageTexts - objmgr.LoadGameobjectInfo(); + sObjectMgr.LoadGameobjectInfo(); sLog.outString( "Loading Spell Chain Data..." ); - spellmgr.LoadSpellChains(); + sSpellMgr.LoadSpellChains(); sLog.outString( "Loading Spell Elixir types..." ); - spellmgr.LoadSpellElixirs(); + sSpellMgr.LoadSpellElixirs(); sLog.outString( "Loading Spell Learn Skills..." ); - spellmgr.LoadSpellLearnSkills(); // must be after LoadSpellChains + sSpellMgr.LoadSpellLearnSkills(); // must be after LoadSpellChains sLog.outString( "Loading Spell Learn Spells..." ); - spellmgr.LoadSpellLearnSpells(); + sSpellMgr.LoadSpellLearnSpells(); sLog.outString( "Loading Spell Proc Event conditions..." ); - spellmgr.LoadSpellProcEvents(); + sSpellMgr.LoadSpellProcEvents(); sLog.outString( "Loading Spell Bonus Data..." ); - spellmgr.LoadSpellBonusess(); + sSpellMgr.LoadSpellBonusess(); sLog.outString( "Loading Spell Proc Item Enchant..." ); - spellmgr.LoadSpellProcItemEnchant(); // must be after LoadSpellChains + sSpellMgr.LoadSpellProcItemEnchant(); // must be after LoadSpellChains sLog.outString( "Loading Aggro Spells Definitions..."); - spellmgr.LoadSpellThreats(); + sSpellMgr.LoadSpellThreats(); sLog.outString( "Loading NPC Texts..." ); - objmgr.LoadGossipText(); + sObjectMgr.LoadGossipText(); sLog.outString( "Loading Item Random Enchantments Table..." ); LoadRandomEnchantmentsTable(); sLog.outString( "Loading Items..." ); // must be after LoadRandomEnchantmentsTable and LoadPageTexts - objmgr.LoadItemPrototypes(); + sObjectMgr.LoadItemPrototypes(); sLog.outString( "Loading Item Texts..." ); - objmgr.LoadItemTexts(); + sObjectMgr.LoadItemTexts(); sLog.outString( "Loading Creature Model Based Info Data..." ); - objmgr.LoadCreatureModelInfo(); + sObjectMgr.LoadCreatureModelInfo(); sLog.outString( "Loading Equipment templates..."); - objmgr.LoadEquipmentTemplates(); + sObjectMgr.LoadEquipmentTemplates(); sLog.outString( "Loading Creature templates..." ); - objmgr.LoadCreatureTemplates(); + sObjectMgr.LoadCreatureTemplates(); sLog.outString( "Loading SpellsScriptTarget..."); - spellmgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo + sSpellMgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo sLog.outString( "Loading ItemRequiredTarget..."); - objmgr.LoadItemRequiredTarget(); + sObjectMgr.LoadItemRequiredTarget(); sLog.outString( "Loading Creature Reputation OnKill Data..." ); - objmgr.LoadReputationOnKill(); + sObjectMgr.LoadReputationOnKill(); sLog.outString( "Loading Points Of Interest Data..." ); - objmgr.LoadPointsOfInterest(); + sObjectMgr.LoadPointsOfInterest(); sLog.outString( "Loading Creature Data..." ); - objmgr.LoadCreatures(); + sObjectMgr.LoadCreatures(); sLog.outString( "Loading pet levelup spells..." ); - spellmgr.LoadPetLevelupSpellMap(); + sSpellMgr.LoadPetLevelupSpellMap(); sLog.outString( "Loading pet default spell additional to levelup spells..." ); - spellmgr.LoadPetDefaultSpells(); + sSpellMgr.LoadPetDefaultSpells(); sLog.outString( "Loading Creature Addon Data..." ); sLog.outString(); - objmgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() + sObjectMgr.LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() sLog.outString( ">>> Creature Addon Data loaded" ); sLog.outString(); sLog.outString( "Loading Creature Respawn Data..." ); // must be after PackInstances() - objmgr.LoadCreatureRespawnTimes(); + sObjectMgr.LoadCreatureRespawnTimes(); sLog.outString( "Loading Gameobject Data..." ); - objmgr.LoadGameobjects(); + sObjectMgr.LoadGameobjects(); sLog.outString( "Loading Gameobject Respawn Data..." ); // must be after PackInstances() - objmgr.LoadGameobjectRespawnTimes(); + sObjectMgr.LoadGameobjectRespawnTimes(); sLog.outString( "Loading Objects Pooling Data..."); - poolhandler.LoadFromDB(); + sPoolMgr.LoadFromDB(); sLog.outString( "Loading Game Event Data..."); sLog.outString(); @@ -1279,67 +1279,67 @@ void World::SetInitialWorldSettings() sLog.outString(); sLog.outString( "Loading Weather Data..." ); - objmgr.LoadWeatherZoneChances(); + sObjectMgr.LoadWeatherZoneChances(); sLog.outString( "Loading Quests..." ); - objmgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables + sObjectMgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables sLog.outString( "Loading Quests Relations..." ); sLog.outString(); - objmgr.LoadQuestRelations(); // must be after quest load + sObjectMgr.LoadQuestRelations(); // must be after quest load sLog.outString( ">>> Quests Relations loaded" ); sLog.outString(); sLog.outString( "Loading UNIT_NPC_FLAG_SPELLCLICK Data..." ); - objmgr.LoadNPCSpellClickSpells(); + sObjectMgr.LoadNPCSpellClickSpells(); sLog.outString( "Loading SpellArea Data..." ); // must be after quest load - spellmgr.LoadSpellAreas(); + sSpellMgr.LoadSpellAreas(); sLog.outString( "Loading AreaTrigger definitions..." ); - objmgr.LoadAreaTriggerTeleports(); // must be after item template load + sObjectMgr.LoadAreaTriggerTeleports(); // must be after item template load sLog.outString( "Loading Quest Area Triggers..." ); - objmgr.LoadQuestAreaTriggers(); // must be after LoadQuests + sObjectMgr.LoadQuestAreaTriggers(); // must be after LoadQuests sLog.outString( "Loading Tavern Area Triggers..." ); - objmgr.LoadTavernAreaTriggers(); + sObjectMgr.LoadTavernAreaTriggers(); sLog.outString( "Loading AreaTrigger script names..." ); - objmgr.LoadAreaTriggerScripts(); + sObjectMgr.LoadAreaTriggerScripts(); sLog.outString( "Loading Graveyard-zone links..."); - objmgr.LoadGraveyardZones(); + sObjectMgr.LoadGraveyardZones(); sLog.outString( "Loading Spell target coordinates..." ); - spellmgr.LoadSpellTargetPositions(); + sSpellMgr.LoadSpellTargetPositions(); sLog.outString( "Loading spell pet auras..." ); - spellmgr.LoadSpellPetAuras(); + sSpellMgr.LoadSpellPetAuras(); sLog.outString( "Loading Player Create Info & Level Stats..." ); sLog.outString(); - objmgr.LoadPlayerInfo(); + sObjectMgr.LoadPlayerInfo(); sLog.outString( ">>> Player Create Info & Level Stats loaded" ); sLog.outString(); sLog.outString( "Loading Exploration BaseXP Data..." ); - objmgr.LoadExplorationBaseXP(); + sObjectMgr.LoadExplorationBaseXP(); sLog.outString( "Loading Pet Name Parts..." ); - objmgr.LoadPetNames(); + sObjectMgr.LoadPetNames(); sLog.outString( "Loading the max pet number..." ); - objmgr.LoadPetNumber(); + sObjectMgr.LoadPetNumber(); sLog.outString( "Loading pet level stats..." ); - objmgr.LoadPetLevelInfo(); + sObjectMgr.LoadPetLevelInfo(); sLog.outString( "Loading Player Corpses..." ); - objmgr.LoadCorpses(); + sObjectMgr.LoadCorpses(); sLog.outString( "Loading Player level dependent mail rewards..." ); - objmgr.LoadMailLevelRewards(); + sObjectMgr.LoadMailLevelRewards(); sLog.outString( "Loading Loot Tables..." ); sLog.outString(); @@ -1354,41 +1354,41 @@ void World::SetInitialWorldSettings() LoadSkillExtraItemTable(); sLog.outString( "Loading Skill Fishing base level requirements..." ); - objmgr.LoadFishingBaseSkillLevel(); + sObjectMgr.LoadFishingBaseSkillLevel(); sLog.outString( "Loading Achievements..." ); sLog.outString(); - achievementmgr.LoadAchievementReferenceList(); - achievementmgr.LoadAchievementCriteriaList(); - achievementmgr.LoadAchievementCriteriaRequirements(); - achievementmgr.LoadRewards(); - achievementmgr.LoadRewardLocales(); - achievementmgr.LoadCompletedAchievements(); + sAchievementMgr.LoadAchievementReferenceList(); + sAchievementMgr.LoadAchievementCriteriaList(); + sAchievementMgr.LoadAchievementCriteriaRequirements(); + sAchievementMgr.LoadRewards(); + sAchievementMgr.LoadRewardLocales(); + sAchievementMgr.LoadCompletedAchievements(); sLog.outString( ">>> Achievements loaded" ); sLog.outString(); ///- Load dynamic data tables from the database sLog.outString( "Loading Auctions..." ); sLog.outString(); - auctionmgr.LoadAuctionItems(); - auctionmgr.LoadAuctions(); + sAuctionMgr.LoadAuctionItems(); + sAuctionMgr.LoadAuctions(); sLog.outString( ">>> Auctions loaded" ); sLog.outString(); sLog.outString( "Loading Guilds..." ); - objmgr.LoadGuilds(); + sObjectMgr.LoadGuilds(); sLog.outString( "Loading ArenaTeams..." ); - objmgr.LoadArenaTeams(); + sObjectMgr.LoadArenaTeams(); sLog.outString( "Loading Groups..." ); - objmgr.LoadGroups(); + sObjectMgr.LoadGroups(); sLog.outString( "Loading ReservedNames..." ); - objmgr.LoadReservedPlayersNames(); + sObjectMgr.LoadReservedPlayersNames(); sLog.outString( "Loading GameObjects for quests..." ); - objmgr.LoadGameObjectForQuests(); + sObjectMgr.LoadGameObjectForQuests(); sLog.outString( "Loading BattleMasters..." ); sBattleGroundMgr.LoadBattleMastersEntry(); @@ -1397,53 +1397,53 @@ void World::SetInitialWorldSettings() sBattleGroundMgr.LoadBattleEventIndexes(); sLog.outString( "Loading GameTeleports..." ); - objmgr.LoadGameTele(); + sObjectMgr.LoadGameTele(); sLog.outString( "Loading Npc Text Id..." ); - objmgr.LoadNpcTextId(); // must be after load Creature and NpcText + sObjectMgr.LoadNpcTextId(); // must be after load Creature and NpcText sLog.outString( "Loading Npc Options..." ); - objmgr.LoadNpcOptions(); + sObjectMgr.LoadNpcOptions(); sLog.outString( "Loading Vendors..." ); - objmgr.LoadVendors(); // must be after load CreatureTemplate and ItemTemplate + sObjectMgr.LoadVendors(); // must be after load CreatureTemplate and ItemTemplate sLog.outString( "Loading Trainers..." ); - objmgr.LoadTrainerSpell(); // must be after load CreatureTemplate + sObjectMgr.LoadTrainerSpell(); // must be after load CreatureTemplate sLog.outString( "Loading Waypoints..." ); sLog.outString(); - WaypointMgr.Load(); + sWaypointMgr.Load(); sLog.outString( "Loading GM tickets..."); - ticketmgr.LoadGMTickets(); + sTicketMgr.LoadGMTickets(); ///- Handle outdated emails (delete/return) sLog.outString( "Returning old mails..." ); - objmgr.ReturnOrDeleteOldMails(false); + sObjectMgr.ReturnOrDeleteOldMails(false); ///- Load and initialize scripts sLog.outString( "Loading Scripts..." ); sLog.outString(); - objmgr.LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate - objmgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate - objmgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data) - objmgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data) - objmgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) + sObjectMgr.LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate + sObjectMgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate + sObjectMgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data) + sObjectMgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data) + sObjectMgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sLog.outString( ">>> Scripts loaded" ); sLog.outString(); sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls - objmgr.LoadDbScriptStrings(); + sObjectMgr.LoadDbScriptStrings(); sLog.outString( "Loading CreatureEventAI Texts..."); - CreatureEAI_Mgr.LoadCreatureEventAI_Texts(false); // false, will checked in LoadCreatureEventAI_Scripts + sEventAIMgr.LoadCreatureEventAI_Texts(false); // false, will checked in LoadCreatureEventAI_Scripts sLog.outString( "Loading CreatureEventAI Summons..."); - CreatureEAI_Mgr.LoadCreatureEventAI_Summons(false); // false, will checked in LoadCreatureEventAI_Scripts + sEventAIMgr.LoadCreatureEventAI_Summons(false); // false, will checked in LoadCreatureEventAI_Scripts sLog.outString( "Loading CreatureEventAI Scripts..."); - CreatureEAI_Mgr.LoadCreatureEventAI_Scripts(); + sEventAIMgr.LoadCreatureEventAI_Scripts(); sLog.outString( "Initializing Scripts..." ); if(!LoadScriptingModule()) @@ -1489,7 +1489,7 @@ void World::SetInitialWorldSettings() ///- Initialize MapManager sLog.outString( "Starting Map System" ); - mapmgr.Initialize(); + sMapMgr.Initialize(); ///- Initialize Battlegrounds sLog.outString( "Starting BattleGround System" ); @@ -1498,7 +1498,7 @@ void World::SetInitialWorldSettings() //Not sure if this can be moved up in the sequence (with static data loading) as it uses MapManager sLog.outString( "Loading Transports..." ); - mapmgr.LoadTransports(); + sMapMgr.LoadTransports(); sLog.outString("Deleting expired bans..." ); loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); @@ -1507,7 +1507,7 @@ void World::SetInitialWorldSettings() InitDailyQuestResetTime(); sLog.outString("Starting objects Pooling system..." ); - poolhandler.Initialize(); + sPoolMgr.Initialize(); sLog.outString("Starting Game Event system..." ); uint32 nextGameEvent = gameeventmgr.Initialize(); @@ -1592,11 +1592,11 @@ void World::Update(uint32 diff) if (++mail_timer > mail_timer_expires) { mail_timer = 0; - objmgr.ReturnOrDeleteOldMails(true); + sObjectMgr.ReturnOrDeleteOldMails(true); } ///- Handle expired auctions - auctionmgr.Update(); + sAuctionMgr.Update(); } ///
  • Handle session updates when the timer has passed @@ -1643,7 +1643,7 @@ void World::Update(uint32 diff) { m_timers[WUPDATE_OBJECTS].Reset(); ///- Update objects when the timer has passed (maps, transport, creatures,...) - mapmgr.Update(diff); // As interval = 0 + sMapMgr.Update(diff); // As interval = 0 sBattleGroundMgr.Update(diff); } @@ -1670,10 +1670,10 @@ void World::Update(uint32 diff) /// ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" - mapmgr.DoDelayedMovesAndRemoves(); + sMapMgr.DoDelayedMovesAndRemoves(); // update the instance reset times - sInstanceSaveManager.Update(); + sInstanceSaveMgr.Update(); // And last, but not least handle the issued cli commands ProcessCliCommands(); @@ -1705,7 +1705,7 @@ namespace MaNGOS explicit WorldWorldTextBuilder(int32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) {} void operator()(WorldPacketList& data_list, int32 loc_idx) { - char const* text = objmgr.GetMangosString(i_textId,loc_idx); + char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx); if(i_args) { @@ -1911,7 +1911,7 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP) if (mode == BAN_ACCOUNT) account = accmgr.GetId (nameOrIP); else if (mode == BAN_CHARACTER) - account = objmgr.GetPlayerAccountIdByPlayerName (nameOrIP); + account = sObjectMgr.GetPlayerAccountIdByPlayerName (nameOrIP); if (!account) return false; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 3108beb73..075445d36 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -41,7 +41,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), -m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), +m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)), _logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0), m_TutorialsChanged(false) { @@ -378,7 +378,7 @@ void WorldSession::LogoutPlayer(bool Save) loginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE id = '%u'", GetAccountId()); ///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members - Guild *guild = objmgr.GetGuildById(_player->GetGuildId()); + Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId()); if(guild) { guild->SetMemberStats(_player->GetGUID()); @@ -523,7 +523,7 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) const char * WorldSession::GetMangosString( int32 entry ) const { - return objmgr.GetMangosString(entry,GetSessionDbLocaleIndex()); + return sObjectMgr.GetMangosString(entry,GetSessionDbLocaleIndex()); } void WorldSession::Handle_NULL( WorldPacket& recvPacket ) diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index d5a359a29..66a30084a 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -653,7 +653,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args) bool ChatHandler::HandleDebugSpellCheckCommand(const char* /*args*/) { sLog.outString( "Check expected in code spell properties base at table 'spell_check' content..."); - spellmgr.CheckUsedSpells("spell_check"); + sSpellMgr.CheckUsedSpells("spell_check"); return true; } diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index cd730e39a..8c948e841 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -124,7 +124,7 @@ bool ChatHandler::HandleCharacterDeleteCommand(const char* args) uint64 character_guid; uint32 account_id; - Player *player = objmgr.GetPlayer(character_name.c_str()); + Player *player = sObjectMgr.GetPlayer(character_name.c_str()); if(player) { character_guid = player->GetGUID(); @@ -133,7 +133,7 @@ bool ChatHandler::HandleCharacterDeleteCommand(const char* args) } else { - character_guid = objmgr.GetPlayerGUIDByName(character_name); + character_guid = sObjectMgr.GetPlayerGUIDByName(character_name); if(!character_guid) { PSendSysMessage(LANG_NO_PLAYER,character_name.c_str()); @@ -141,7 +141,7 @@ bool ChatHandler::HandleCharacterDeleteCommand(const char* args) return false; } - account_id = objmgr.GetPlayerAccountIdByGUID(character_guid); + account_id = sObjectMgr.GetPlayerAccountIdByGUID(character_guid); } std::string account_name; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2c696aec5..56938ac78 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8788" + #define REVISION_NR "8789" #endif // __REVISION_NR_H__ From 1e9c672abdb18ad6646f213071b28fd553fab448 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 12:22:29 +0100 Subject: [PATCH 14/23] [8790] Remove useless/unused Base and CountedReference sources. --- src/framework/Makefile.am | 3 - .../Utilities/CountedReference/Reference.h | 97 ------------- .../CountedReference/ReferenceHolder.h | 39 ------ .../CountedReference/ReferenceImpl.h | 130 ------------------ src/shared/Base.cpp | 67 --------- src/shared/Base.h | 54 -------- src/shared/Makefile.am | 2 - src/shared/revision_nr.h | 2 +- win/VC100/framework.vcxproj | 3 - win/VC100/shared.vcxproj | 2 - win/VC80/framework.vcproj | 16 --- win/VC80/shared.vcproj | 8 -- win/VC90/framework.vcproj | 16 --- win/VC90/shared.vcproj | 8 -- 14 files changed, 1 insertion(+), 446 deletions(-) delete mode 100644 src/framework/Utilities/CountedReference/Reference.h delete mode 100644 src/framework/Utilities/CountedReference/ReferenceHolder.h delete mode 100644 src/framework/Utilities/CountedReference/ReferenceImpl.h delete mode 100644 src/shared/Base.cpp delete mode 100644 src/shared/Base.h diff --git a/src/framework/Makefile.am b/src/framework/Makefile.am index 9a1e8bb06..756f5493e 100644 --- a/src/framework/Makefile.am +++ b/src/framework/Makefile.am @@ -51,9 +51,6 @@ EXTRA_DIST = \ Policies/Singleton.h \ Policies/SingletonImp.h \ Policies/ThreadingModel.h \ - Utilities/CountedReference/Reference.h \ - Utilities/CountedReference/ReferenceHolder.h \ - Utilities/CountedReference/ReferenceImpl.h \ Utilities/LinkedReference/RefManager.h \ Utilities/LinkedReference/Reference.h \ Utilities/ByteConverter.h \ diff --git a/src/framework/Utilities/CountedReference/Reference.h b/src/framework/Utilities/CountedReference/Reference.h deleted file mode 100644 index 8fd513bb5..000000000 --- a/src/framework/Utilities/CountedReference/Reference.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_REFERENCE_H -#define MANGOS_REFERENCE_H - -/** - * Referencer - * Referencer is an object that holds a reference holder that hold a reference - * counted object. When an object's reference count drop to zero, it removes - * the object. This is a non intrusive mechanism and any object at any point - * in time can be referenced. When and object is reference counted, do not - * pass the object directly to other methods but rather, pass its - * reference around. Objects can be reference counted in both single threaded - * model and multi-threaded model - */ - -#include -#include "Platform/Define.h" -#include "Policies/ThreadingModel.h" -#include "ReferenceHolder.h" - -template -< -typename T, -class THREADING_MODEL = MaNGOS::SingleThreaded -> -class MANGOS_DLL_DECL Referencer -{ - typedef typename THREADING_MODEL::Lock Lock; - typedef ReferenceHolder ReferenceeHolder; - public: - - /// Constructs a referencer. - Referencer(T *ref = NULL); - - /// Copy constructor - Referencer(const Referencer &obj) : i_holder(NULL) { *this = obj; } - - /// Destructor - ~Referencer(); - - /// Referencee accessor - T* referencee(void) { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - const T* referencee(void) const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - - //T& referencee(void){ return _referencee(); } - //const T& referencee(void) const { return const_cast(this)->_referencee(); } - operator T&(void) { return _referencee(); } - operator const T&(void) const { return *const_cast(this)->_referencee(); } - - /// cast operators - T* operator*() { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - T const * operator*() const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - - /// overload operators - T* operator->() { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - const T * operator->() const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - - /// operator = - Referencer& operator=(const Referencer &obj); - Referencer& operator=(T *); - - /// returns true if i_referencee is null - bool isNull(void) const { return i_holder == NULL; } - - private: - - T& _referencee(void) - { - if( i_holder == NULL ) - throw std::runtime_error("Invalid access to null pointer"); - return *i_holder->i_referencee; - } - - void deReference(ReferenceeHolder *); - void addReference(ReferenceeHolder *); - - // private data - ReferenceeHolder *i_holder; -}; -#endif diff --git a/src/framework/Utilities/CountedReference/ReferenceHolder.h b/src/framework/Utilities/CountedReference/ReferenceHolder.h deleted file mode 100644 index d0bb2cb3e..000000000 --- a/src/framework/Utilities/CountedReference/ReferenceHolder.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_REFERENCEHOLDER_H -#define MANGOS_REFERENCEHOLDER_H - -/** ReferenceHolder holds the actualy referenced obejct as well the refence - count. The ReferenecHolder implements as a policy base object and - will decided by the Reference class to be consnsitent. - */ - -template -< -typename T, -class THREADING_MODEL -> -struct ReferenceHolder : public THREADING_MODEL -{ - explicit ReferenceHolder(T *ref) : i_referencee(ref), i_referenceCount(0) {} - T *i_referencee; - unsigned int i_referenceCount; - typedef typename THREADING_MODEL::Lock Lock; -}; -#endif diff --git a/src/framework/Utilities/CountedReference/ReferenceImpl.h b/src/framework/Utilities/CountedReference/ReferenceImpl.h deleted file mode 100644 index cd0143748..000000000 --- a/src/framework/Utilities/CountedReference/ReferenceImpl.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_REFERENCEIMPL_H -#define MANGOS_REFERENCEIMPL_H - -#include "Reference.h" - -template -< -typename T, -class THREADING_MODEL -> -Referencer::Referencer(T *ref) -: i_holder(NULL) -{ - if( ref != NULL ) - { - i_holder = new ReferenceeHolder(ref); - ++i_holder->i_referenceCount; - } -} - -template -< -typename T, -class THREADING_MODEL -> -Referencer::~Referencer() -{ - if( i_holder != NULL ) - deReference(i_holder); - i_holder = NULL; -} - -template -< -typename T, -class THREADING_MODEL -> -Referencer& -Referencer::operator=(const Referencer &obj) -{ - if( i_holder != NULL ) - deReference(i_holder); - if( obj.i_holder != NULL ) - addReference(obj.i_holder); - i_holder = obj.i_holder; - return *this; -} - -template -< -typename T, -class THREADING_MODEL -> -Referencer& -Referencer::operator=(T *ref) -{ - if( i_holder != NULL ) - deReference(i_holder); - i_holder = NULL; - if( ref != NULL ) - { - i_holder = new ReferenceeHolder(ref); - ++i_holder->i_referenceCount; - } - - return *this; -} - -template -< -typename T, -class THREADING_MODEL -> -void -Referencer::deReference(ReferenceHolder *holder) -{ - assert( holder != NULL && holder->i_referenceCount > 0); - bool delete_object = false; - - { - // The guard is within the scope due to the guard - // must release earlier than expected. - Lock guard(*holder); - Guard(&guard); - - --holder->i_referenceCount; - if( holder->i_referenceCount == 0 ) - delete_object = true; - } - - if( delete_object ) - { - delete holder->i_referencee; - delete holder; - } -} - -template -< -typename T, -class THREADING_MODEL -> -void -Referencer::addReference(ReferenceHolder *holder) -{ - assert( i_holder != NULL ); - Lock guard(*holder); - Guard(&guard); - - ++holder->i_referenceCount; -} -#endif diff --git a/src/shared/Base.cpp b/src/shared/Base.cpp deleted file mode 100644 index 9929cd41f..000000000 --- a/src/shared/Base.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - Base class interface - Copyright (C) 1998,1999 by Andrew Zabolotny - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "Base.h" - -Base::~Base () -{ -} - -/** - * Decrement object's reference count; as soon as the last reference - * to the object is removed, it is destroyed. - */ - -void Base::DecRef () -{ - if (!--RefCount) - delete this; -} - -/** - * Object initialization. The initial reference count is set to one; - * this means if you call DecRef() immediately after creating the object, - * it will be destroyed. - */ -Base::Base () -{ - RefCount = 1; -} - -/** - * Increment reference count. - * Every time when you copy a pointer to a object and store it for - * later use you MUST call IncRef() on it; this will allow to keep - * objects as long as they are referenced by some entity. - */ -void Base::IncRef () -{ - ++RefCount; - -} - -/** - * Query number of references to this object. - * I would rather prefer to have the reference counter strictly private, - * but sometimes, mostly for debugging, such a function can help. - */ -int Base::GetRefCount () -{ - return RefCount; -} diff --git a/src/shared/Base.h b/src/shared/Base.h deleted file mode 100644 index d5907fdf4..000000000 --- a/src/shared/Base.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Base class interface - Copyright (C) 1998,1999 by Andrew Zabolotny - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __BASE_H__ -#define __BASE_H__ - -#include "Common.h" - -/** - * This class is intended to be a base class for every other class. - * It defines the basic interface available for any object. - */ -class Base -{ - private: - /// Object reference count - int RefCount; - - protected: - /** - * Destroy this object. Destructor is virtual, because class contains - * virtual methods; also it is private because it is never intended - * to be called directly; use DecRef() instead: when reference counter - * reaches zero, the object will be destroyed. - */ - virtual ~Base (); - - public: - - Base (); - - void IncRef (); - - void DecRef (); - int GetRefCount (); - -}; -#endif // __BASE_H__ diff --git a/src/shared/Makefile.am b/src/shared/Makefile.am index e72c2fbb8..4f5912045 100644 --- a/src/shared/Makefile.am +++ b/src/shared/Makefile.am @@ -30,8 +30,6 @@ noinst_LIBRARIES = libmangosshared.a # libmangosshared library will later be reused by ... libmangosshared_a_SOURCES = \ - Base.cpp \ - Base.h \ ByteBuffer.h \ Common.cpp \ Common.h \ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 56938ac78..3a2685c5a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8789" + #define REVISION_NR "8790" #endif // __REVISION_NR_H__ diff --git a/win/VC100/framework.vcxproj b/win/VC100/framework.vcxproj index 90ff8548e..a9532a2be 100644 --- a/win/VC100/framework.vcxproj +++ b/win/VC100/framework.vcxproj @@ -312,9 +312,6 @@ - - - diff --git a/win/VC100/shared.vcxproj b/win/VC100/shared.vcxproj index 27e231e6a..c0e1ef747 100644 --- a/win/VC100/shared.vcxproj +++ b/win/VC100/shared.vcxproj @@ -435,7 +435,6 @@ - @@ -472,7 +471,6 @@ - diff --git a/win/VC80/framework.vcproj b/win/VC80/framework.vcproj index 60c60b7c5..9ccf1a7a9 100644 --- a/win/VC80/framework.vcproj +++ b/win/VC80/framework.vcproj @@ -582,22 +582,6 @@ RelativePath="..\..\src\framework\Utilities\UnorderedMap.h" > - - - - - - - - diff --git a/win/VC80/shared.vcproj b/win/VC80/shared.vcproj index c0991b3bd..0a7a79081 100644 --- a/win/VC80/shared.vcproj +++ b/win/VC80/shared.vcproj @@ -616,14 +616,6 @@ - - - - diff --git a/win/VC90/framework.vcproj b/win/VC90/framework.vcproj index cda4de128..64c0bc5a9 100644 --- a/win/VC90/framework.vcproj +++ b/win/VC90/framework.vcproj @@ -587,22 +587,6 @@ RelativePath="..\..\src\framework\Utilities\UnorderedMap.h" > - - - - - - - - diff --git a/win/VC90/shared.vcproj b/win/VC90/shared.vcproj index b5701f503..65de0fcdd 100644 --- a/win/VC90/shared.vcproj +++ b/win/VC90/shared.vcproj @@ -622,14 +622,6 @@ - - - - From a0141c7d2f4679a352472ae51c2ce41b901e64b9 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 8 Nov 2009 18:15:20 +0300 Subject: [PATCH 15/23] [8791] Fixed problems with atomic_support.obj in x64 mode * Place atomic_support.obj to porjtect dirs instaed bin dir * This also fix build fail at clean solution (not need now restart build for finish). --- src/shared/revision_nr.h | 2 +- win/VC100/tbb.vcxproj | 12 ++++++------ win/VC100/tbbmalloc.vcxproj | 12 ++++++------ win/VC80/tbb.vcproj | 12 ++++++------ win/VC80/tbbmalloc.vcproj | 12 ++++++------ win/VC90/tbb.vcproj | 12 ++++++------ win/VC90/tbbmalloc.vcproj | 12 ++++++------ 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3a2685c5a..971004f51 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8790" + #define REVISION_NR "8791" #endif // __REVISION_NR_H__ diff --git a/win/VC100/tbb.vcxproj b/win/VC100/tbb.vcxproj index bba9e8fa1..cfea8cdd4 100644 --- a/win/VC100/tbb.vcxproj +++ b/win/VC100/tbb.vcxproj @@ -288,19 +288,19 @@ true building atomic_support.obj - ml64 /Fo"..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm + ml64 /Fo"tbb__$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm - ..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) + tbb__$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) true building atomic_support.obj - ml64 /Fo"..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj" /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm + ml64 /Fo"tbb__$(Platform)_$(Configuration)\atomic_support.obj" /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm - ..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) + tbb__$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) true building atomic_support.obj - ml64 /Fo..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm + ml64 /Fo"tbb__$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm - ..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) + tbb__$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) /coff /Zi diff --git a/win/VC100/tbbmalloc.vcxproj b/win/VC100/tbbmalloc.vcxproj index 6adbf0bea..27a84b024 100644 --- a/win/VC100/tbbmalloc.vcxproj +++ b/win/VC100/tbbmalloc.vcxproj @@ -289,19 +289,19 @@ true building atomic_support.obj - ml64 /Fo"..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm + ml64 /Fo"tbbmalloc__$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm - ..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) + tbbmalloc__$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) true building atomic_support.obj - ml64 /Fo"..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj" /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm + ml64 /Fo"tbbmalloc__$(Platform)_$(Configuration)\atomic_support.obj" /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm - ..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) + tbbmalloc__$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) true building atomic_support.obj - ml64 /Fo"..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm + ml64 /Fo"tbbmalloc__$(Platform)_$(Configuration)\atomic_support.obj" /DUSE_FRAME_POINTER /DEM64T=1 /c /Zi ../../dep/tbb/src/tbb/intel64-masm/atomic_support.asm - ..\..\bin\$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) + tbbmalloc__$(Platform)_$(Configuration)\atomic_support.obj;%(Outputs) diff --git a/win/VC80/tbb.vcproj b/win/VC80/tbb.vcproj index 5ee57d580..1e8810219 100644 --- a/win/VC80/tbb.vcproj +++ b/win/VC80/tbb.vcproj @@ -544,8 +544,8 @@ diff --git a/win/VC80/tbbmalloc.vcproj b/win/VC80/tbbmalloc.vcproj index fe6f943c4..5847b37ab 100644 --- a/win/VC80/tbbmalloc.vcproj +++ b/win/VC80/tbbmalloc.vcproj @@ -604,8 +604,8 @@ diff --git a/win/VC90/tbb.vcproj b/win/VC90/tbb.vcproj index 2fd53e2c4..5da97fc16 100644 --- a/win/VC90/tbb.vcproj +++ b/win/VC90/tbb.vcproj @@ -585,8 +585,8 @@ diff --git a/win/VC90/tbbmalloc.vcproj b/win/VC90/tbbmalloc.vcproj index 2ad796961..31c58952f 100644 --- a/win/VC90/tbbmalloc.vcproj +++ b/win/VC90/tbbmalloc.vcproj @@ -553,8 +553,8 @@ From 146657885d5dfa197a79830f498ea4a40c3ab976 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 8 Nov 2009 19:53:53 +0300 Subject: [PATCH 16/23] [8792] Fixed *nix configure work after [8790] --- configure.ac | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e016db0b9..e8638b2b9 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ # VERSION: 0.15.0 (trunk) # BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net AC_INIT( [mangos], [0.15.0], [mangos-devs@lists.sourceforge.net]) -AC_CONFIG_SRCDIR([src/shared/Base.cpp]) +AC_CONFIG_SRCDIR([src/shared/Common.h]) ## Prelude, basic settings for Automake # Turn on all warnings and error messages, and enforce GNU diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 971004f51..d1615903e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8791" + #define REVISION_NR "8792" #endif // __REVISION_NR_H__ From b3f3ffa885e27ed1b49f0fa1609d0d5d71e351af Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 19:32:50 +0100 Subject: [PATCH 17/23] [8793] Don't do operations through singleton if already in singleton context. * Also, some minor things: - Remove duplicate sWorldLog define. - Add sRealmList macro for RealmList::Instance(). - Use sLog macro in scripting log functions. --- src/game/InstanceSaveMgr.cpp | 2 +- src/game/ObjectMgr.cpp | 6 +++--- src/game/SpellMgr.cpp | 6 +++--- src/game/World.cpp | 22 +++++++++++----------- src/game/WorldLog.cpp | 2 -- src/realmd/AuthSocket.cpp | 6 +++--- src/realmd/Main.cpp | 4 ++-- src/realmd/RealmList.cpp | 2 +- src/realmd/RealmList.h | 2 ++ src/shared/Log.cpp | 10 +++++----- src/shared/revision_nr.h | 2 +- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index c5a679cdb..8963de3f5 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -258,7 +258,7 @@ void InstanceSaveManager::CleanupInstances() bar.step(); // load reset times and clean expired instances - sInstanceSaveMgr.LoadResetTimes(); + LoadResetTimes(); // clean character/group - instance binds with invalid group/characters _DelHelper(CharacterDatabase, "character_instance.guid, instance", "character_instance", "LEFT JOIN characters ON character_instance.guid = characters.guid WHERE characters.guid IS NULL"); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 20ec90844..8f111a0ad 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4099,7 +4099,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) continue; } - // if(!sObjectMgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading + // if(!GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading break; } @@ -5111,11 +5111,11 @@ uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_al if (!mount_info) return 0; - uint16 mount_id = sObjectMgr.ChooseDisplayId(team,mount_info); + uint16 mount_id = ChooseDisplayId(team,mount_info); if (!mount_id) return 0; - CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(mount_id); + CreatureModelInfo const *minfo = GetCreatureModelRandomGender(mount_id); if (minfo) mount_id = minfo->modelid; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 8ac87a673..2d4d5590c 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2260,8 +2260,8 @@ void SpellMgr::LoadSpellScriptTarget() { if( spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || spellInfo->EffectImplicitTargetA[j] != TARGET_SELF && spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT ) { - SpellScriptTarget::const_iterator lower = sSpellMgr.GetBeginSpellScriptTarget(spellInfo->Id); - SpellScriptTarget::const_iterator upper = sSpellMgr.GetEndSpellScriptTarget(spellInfo->Id); + SpellScriptTarget::const_iterator lower = GetBeginSpellScriptTarget(spellInfo->Id); + SpellScriptTarget::const_iterator upper = GetEndSpellScriptTarget(spellInfo->Id); if(lower==upper) { sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = %u (TARGET_SCRIPT), but does not have record in `spell_script_target`",spellInfo->Id,TARGET_SCRIPT); @@ -2849,7 +2849,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell } // DB base check (if non empty then must fit at least single for allow) - SpellAreaMapBounds saBounds = sSpellMgr.GetSpellAreaMapBounds(spellInfo->Id); + SpellAreaMapBounds saBounds = GetSpellAreaMapBounds(spellInfo->Id); if (saBounds.first != saBounds.second) { for(SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) diff --git a/src/game/World.cpp b/src/game/World.cpp index ce6244b35..f0cd0fdb5 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -242,7 +242,7 @@ World::AddSession_ (WorldSession* s) s->SendAddonsInfo(); WorldPacket pkt(SMSG_CLIENTCACHE_VERSION, 4); - pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION)); + pkt << uint32(getConfig(CONFIG_CLIENTCACHE_VERSION)); s->SendPacket(&pkt); s->SendAccountDataTimes(GLOBAL_CACHE_MASK); @@ -329,7 +329,7 @@ bool World::RemoveQueuedPlayer(WorldSession* sess) pop_sess->SendAddonsInfo(); WorldPacket pkt(SMSG_CLIENTCACHE_VERSION, 4); - pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION)); + pkt << uint32(getConfig(CONFIG_CLIENTCACHE_VERSION)); pop_sess->SendPacket(&pkt); pop_sess->SendAccountDataTimes(GLOBAL_CACHE_MASK); @@ -1016,10 +1016,10 @@ void World::LoadConfigSettings(bool reload) //visibility on continents m_MaxVisibleDistanceOnContinents = sConfig.GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE); - if(m_MaxVisibleDistanceOnContinents < 45*sWorld.getRate(RATE_CREATURE_AGGRO)) + if(m_MaxVisibleDistanceOnContinents < 45*getRate(RATE_CREATURE_AGGRO)) { - sLog.outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld.getRate(RATE_CREATURE_AGGRO)); - m_MaxVisibleDistanceOnContinents = 45*sWorld.getRate(RATE_CREATURE_AGGRO); + sLog.outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*getRate(RATE_CREATURE_AGGRO)); + m_MaxVisibleDistanceOnContinents = 45*getRate(RATE_CREATURE_AGGRO); } else if(m_MaxVisibleDistanceOnContinents + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE) { @@ -1029,10 +1029,10 @@ void World::LoadConfigSettings(bool reload) //visibility in instances m_MaxVisibleDistanceInInctances = sConfig.GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE); - if(m_MaxVisibleDistanceInInctances < 45*sWorld.getRate(RATE_CREATURE_AGGRO)) + if(m_MaxVisibleDistanceInInctances < 45*getRate(RATE_CREATURE_AGGRO)) { - sLog.outError("Visibility.Distance.Instances can't be less max aggro radius %f",45*sWorld.getRate(RATE_CREATURE_AGGRO)); - m_MaxVisibleDistanceInInctances = 45*sWorld.getRate(RATE_CREATURE_AGGRO); + sLog.outError("Visibility.Distance.Instances can't be less max aggro radius %f",45*getRate(RATE_CREATURE_AGGRO)); + m_MaxVisibleDistanceInInctances = 45*getRate(RATE_CREATURE_AGGRO); } else if(m_MaxVisibleDistanceInInctances + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE) { @@ -1042,10 +1042,10 @@ void World::LoadConfigSettings(bool reload) //visibility in BG/Arenas m_MaxVisibleDistanceInBGArenas = sConfig.GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS); - if(m_MaxVisibleDistanceInBGArenas < 45*sWorld.getRate(RATE_CREATURE_AGGRO)) + if(m_MaxVisibleDistanceInBGArenas < 45*getRate(RATE_CREATURE_AGGRO)) { - sLog.outError("Visibility.Distance.BGArenas can't be less max aggro radius %f",45*sWorld.getRate(RATE_CREATURE_AGGRO)); - m_MaxVisibleDistanceInBGArenas = 45*sWorld.getRate(RATE_CREATURE_AGGRO); + sLog.outError("Visibility.Distance.BGArenas can't be less max aggro radius %f",45*getRate(RATE_CREATURE_AGGRO)); + m_MaxVisibleDistanceInBGArenas = 45*getRate(RATE_CREATURE_AGGRO); } else if(m_MaxVisibleDistanceInBGArenas + m_VisibleUnitGreyDistance > MAX_VISIBILITY_DISTANCE) { diff --git a/src/game/WorldLog.cpp b/src/game/WorldLog.cpp index aab743e0b..6b6f6f337 100644 --- a/src/game/WorldLog.cpp +++ b/src/game/WorldLog.cpp @@ -45,5 +45,3 @@ void WorldLog::Initialize() i_file = fopen((logsDir+logname).c_str(), "w"); } } - -#define sWorldLog WorldLog::Instance() diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 64e615254..f1c1027b6 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -879,14 +879,14 @@ bool AuthSocket::_HandleRealmList() delete result; ///- Update realm list if need - RealmList::Instance().UpdateIfNeed(); + sRealmList.UpdateIfNeed(); ///- Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) ByteBuffer pkt; pkt << (uint32) 0; - pkt << (uint16) RealmList::Instance().size(); + pkt << (uint16) sRealmList.size(); RealmList::RealmMap::const_iterator i; - for( i = RealmList::Instance().begin(); i != RealmList::Instance().end(); ++i ) + for( i = sRealmList.begin(); i != sRealmList.end(); ++i ) { uint8 AmountOfCharacters; diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 2cfe62abd..70f93f431 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -190,8 +190,8 @@ extern int main(int argc, char **argv) return 1; ///- Get the list of realms for the server - RealmList::Instance().Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); - if (RealmList::Instance().size() == 0) + sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); + if (sRealmList.size() == 0) { sLog.outError("No valid realms specified."); return 1; diff --git a/src/realmd/RealmList.cpp b/src/realmd/RealmList.cpp index f41344c00..23255eb60 100644 --- a/src/realmd/RealmList.cpp +++ b/src/realmd/RealmList.cpp @@ -33,7 +33,7 @@ RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) { } -RealmList& RealmList::Instance() +RealmList& sRealmList { static RealmList realmlist; return realmlist; diff --git a/src/realmd/RealmList.h b/src/realmd/RealmList.h index 1ab6d9371..936f83e4e 100644 --- a/src/realmd/RealmList.h +++ b/src/realmd/RealmList.h @@ -64,5 +64,7 @@ class RealmList time_t m_NextUpdateTime; }; +#define sRealmList RealmList::Instance() + #endif /// @} diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index a4166dcee..15600ed7a 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -767,7 +767,7 @@ void outstring_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton::Instance().outString(buf); + sLog.outString(buf); } void detail_log(const char * str, ...) @@ -781,7 +781,7 @@ void detail_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton::Instance().outDetail(buf); + sLog.outDetail(buf); } void debug_log(const char * str, ...) @@ -795,7 +795,7 @@ void debug_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton::Instance().outDebug(buf); + sLog.outDebug(buf); } void error_log(const char * str, ...) @@ -809,7 +809,7 @@ void error_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton::Instance().outError(buf); + sLog.outError(buf); } void error_db_log(const char * str, ...) @@ -823,5 +823,5 @@ void error_db_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton::Instance().outErrorDb(buf); + sLog.outErrorDb(buf); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d1615903e..0e91d5c27 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8792" + #define REVISION_NR "8793" #endif // __REVISION_NR_H__ From 3c1aef871a7c06282a8db9f88f3f77cdd956881a Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sun, 8 Nov 2009 19:39:44 +0100 Subject: [PATCH 18/23] [8794] Also rename gameeventmgr to sGameEventMgr. Hopefully last singleton rename. :) --- src/game/GameEventMgr.cpp | 4 ++-- src/game/GameEventMgr.h | 2 +- src/game/Level2.cpp | 28 ++++++++++++++-------------- src/game/ObjectMgr.cpp | 4 ++-- src/game/World.cpp | 6 +++--- src/shared/revision_nr.h | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 270942f05..71557ad24 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -750,8 +750,8 @@ GameEventMgr::GameEventMgr() MANGOS_DLL_SPEC bool IsHolidayActive( HolidayIds id ) { - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); - GameEventMgr::ActiveEvents const& ae = gameeventmgr.GetActiveEventList(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); + GameEventMgr::ActiveEvents const& ae = sGameEventMgr.GetActiveEventList(); for(GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr) if(events[*itr].holiday_id==id) diff --git a/src/game/GameEventMgr.h b/src/game/GameEventMgr.h index 60a025ca5..cc61c4c98 100644 --- a/src/game/GameEventMgr.h +++ b/src/game/GameEventMgr.h @@ -97,7 +97,7 @@ class GameEventMgr bool m_IsGameEventsInit; }; -#define gameeventmgr MaNGOS::Singleton::Instance() +#define sGameEventMgr MaNGOS::Singleton::Instance() MANGOS_DLL_SPEC bool IsHolidayActive(HolidayIds id); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index d1b6cb378..bc75ce542 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -398,7 +398,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) { Player* pl = m_session->GetPlayer(); QueryResult *result; - GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList(); + GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr.GetActiveEventList(); if(*args) { // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r @@ -3687,8 +3687,8 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) uint32 counter = 0; - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); - GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); + GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList(); for(uint32 id = 0; id < events.size(); ++id ) { @@ -3725,8 +3725,8 @@ bool ChatHandler::HandleEventListCommand(const char* args) if (arg == "all") all = true; - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); - GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); + GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList(); char const* active = GetMangosString(LANG_ACTIVE); char const* inactive = GetMangosString(LANG_FACTION_INACTIVE); @@ -3771,7 +3771,7 @@ bool ChatHandler::HandleEventInfoCommand(const char* args) uint32 event_id = atoi(cId); - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); if(event_id >=events.size()) { @@ -3788,14 +3788,14 @@ bool ChatHandler::HandleEventInfoCommand(const char* args) return false; } - GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList(); bool active = activeEvents.find(event_id) != activeEvents.end(); char const* activeStr = active ? GetMangosString(LANG_ACTIVE) : ""; std::string startTimeStr = TimeToTimestampStr(eventData.start); std::string endTimeStr = TimeToTimestampStr(eventData.end); - uint32 delay = gameeventmgr.NextCheck(event_id); + uint32 delay = sGameEventMgr.NextCheck(event_id); time_t nextTime = time(NULL)+delay; std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL)+delay) : "-"; @@ -3820,7 +3820,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args) int32 event_id = atoi(cId); - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); if(event_id < 1 || event_id >=events.size()) { @@ -3837,7 +3837,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args) return false; } - GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList(); if(activeEvents.find(event_id) != activeEvents.end()) { PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE,event_id); @@ -3846,7 +3846,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args) } PSendSysMessage(LANG_EVENT_STARTED, event_id, eventData.description.c_str()); - gameeventmgr.StartEvent(event_id,true); + sGameEventMgr.StartEvent(event_id,true); return true; } @@ -3862,7 +3862,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args) int32 event_id = atoi(cId); - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); if(event_id < 1 || event_id >=events.size()) { @@ -3879,7 +3879,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args) return false; } - GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr.GetActiveEventList(); if(activeEvents.find(event_id) == activeEvents.end()) { @@ -3889,7 +3889,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args) } PSendSysMessage(LANG_EVENT_STOPPED, event_id, eventData.description.c_str()); - gameeventmgr.StopEvent(event_id,true); + sGameEventMgr.StopEvent(event_id,true); return true; } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 8f111a0ad..4365f2c19 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7246,7 +7246,7 @@ bool PlayerCondition::Meets(Player const * player) const case CONDITION_NO_AURA: return !player->HasAura(value1, value2); case CONDITION_ACTIVE_EVENT: - return gameeventmgr.IsActiveEvent(value1); + return sGameEventMgr.IsActiveEvent(value1); default: return false; } @@ -7383,7 +7383,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val } case CONDITION_ACTIVE_EVENT: { - GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); if(value1 >=events.size() || !events[value1].isValid()) { sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1); diff --git a/src/game/World.cpp b/src/game/World.cpp index f0cd0fdb5..0616f46fe 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1274,7 +1274,7 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading Game Event Data..."); sLog.outString(); - gameeventmgr.LoadFromDB(); + sGameEventMgr.LoadFromDB(); sLog.outString( ">>> Game Event Data loaded" ); sLog.outString(); @@ -1510,7 +1510,7 @@ void World::SetInitialWorldSettings() sPoolMgr.Initialize(); sLog.outString("Starting Game Event system..." ); - uint32 nextGameEvent = gameeventmgr.Initialize(); + uint32 nextGameEvent = sGameEventMgr.Initialize(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event sLog.outString( "WORLD: World initialized" ); @@ -1663,7 +1663,7 @@ void World::Update(uint32 diff) if (m_timers[WUPDATE_EVENTS].Passed()) { m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed - uint32 nextGameEvent = gameeventmgr.Update(); + uint32 nextGameEvent = sGameEventMgr.Update(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); m_timers[WUPDATE_EVENTS].Reset(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0e91d5c27..3243ef11c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8793" + #define REVISION_NR "8794" #endif // __REVISION_NR_H__ From 29949518b543c99eaae658524483e2b4c1d05478 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 8 Nov 2009 22:34:21 +0300 Subject: [PATCH 19/23] [8795] Reset UNIT_FIELD_AURASTATE before aura load or health/etc set. This resolve problem when some aura state not remove aftre reload and original aura source lost. --- src/game/Player.cpp | 3 +++ src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 6de25fcdf..296e7f70d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2506,6 +2506,9 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ); SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(getLevel())); + // reset before any aura state sources (health set/aura apply) + SetUInt32Value(UNIT_FIELD_AURASTATE, 0); + UpdateSkillsForLevel (); // set default cast time multiplier diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3243ef11c..a35b588cc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8794" + #define REVISION_NR "8795" #endif // __REVISION_NR_H__ From fc42125cfb438eba5c746c211c3595b86bb795cc Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Mon, 9 Nov 2009 01:19:34 +0100 Subject: [PATCH 20/23] [8796] * Add WARNING file to mangosd.vcproj. Also minor cosmetics. --- WARNING | 6 +++--- src/shared/revision_nr.h | 2 +- win/VC100/mangosd.vcxproj | 13 +++++++------ win/VC80/mangosd.vcproj | 16 ++++++++++------ win/VC90/mangosd.vcproj | 16 ++++++++++------ 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/WARNING b/WARNING index 89688d768..532f5962c 100644 --- a/WARNING +++ b/WARNING @@ -1,11 +1,11 @@ The Massive Network Game Object Server (MaNGOS) has been built with education -as the main target and the MaNGOS team would like to keep it that way. +as the main purpose and the MaNGOS team would like to keep it that way. Since any public and/or commercial use of this software is considered illegal in many countries (please refer to your local law), the MaNGOS team will not provide any help nor support with such usage in any way. Every user of this software is encouraged to make sure no law is being broken -on his side. +on his/her side. -Both the MaNGOS team and MaNGOS foundation don't take any responsibility +Both the MaNGOS team and MaNGOS foundation will not take any responsibility for any kind of usage of this software by the end users. diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a35b588cc..e9537ab6a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8795" + #define REVISION_NR "8796" #endif // __REVISION_NR_H__ diff --git a/win/VC100/mangosd.vcxproj b/win/VC100/mangosd.vcxproj index 3176231fa..d967c332a 100644 --- a/win/VC100/mangosd.vcxproj +++ b/win/VC100/mangosd.vcxproj @@ -449,13 +449,14 @@ - + - - - - - + + + + + + diff --git a/win/VC80/mangosd.vcproj b/win/VC80/mangosd.vcproj index 4987d7ad5..114557ae5 100644 --- a/win/VC80/mangosd.vcproj +++ b/win/VC80/mangosd.vcproj @@ -631,7 +631,7 @@ Name="doc" > + + diff --git a/win/VC90/mangosd.vcproj b/win/VC90/mangosd.vcproj index 0d686b33c..d10d27b0e 100644 --- a/win/VC90/mangosd.vcproj +++ b/win/VC90/mangosd.vcproj @@ -631,7 +631,7 @@ Name="doc" > + + From 07aa44992bacafe643d2d0cdafa427f79a149378 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Mon, 9 Nov 2009 02:24:12 +0100 Subject: [PATCH 21/23] [8797] Merge WorldLog class into Log class. * Added AuthSocket::SendPacket() function. * Packet logging now also possible in realmd. * realmd.conf.dist.in updated (added "WorldLogFile" setting). --- src/game/Makefile.am | 2 - src/game/WorldLog.cpp | 47 --------------------- src/game/WorldLog.h | 76 ---------------------------------- src/game/WorldSocket.cpp | 52 +++++++++++------------ src/realmd/AuthSocket.cpp | 68 ++++++++++++++++++++++++++---- src/realmd/AuthSocket.h | 3 ++ src/realmd/realmd.conf.dist.in | 5 +++ src/shared/Log.cpp | 17 +++++++- src/shared/Log.h | 10 ++++- src/shared/revision_nr.h | 2 +- win/VC100/game.vcxproj | 2 - win/VC80/game.vcproj | 8 ---- win/VC90/game.vcproj | 8 ---- 13 files changed, 117 insertions(+), 183 deletions(-) delete mode 100644 src/game/WorldLog.cpp delete mode 100644 src/game/WorldLog.h diff --git a/src/game/Makefile.am b/src/game/Makefile.am index 39a6cb5b8..d13bc32af 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -283,8 +283,6 @@ libmangosgame_a_SOURCES = \ Weather.h \ World.cpp \ World.h \ - WorldLog.cpp \ - WorldLog.h \ WorldSession.cpp \ WorldSession.h \ WorldSocket.cpp \ diff --git a/src/game/WorldLog.cpp b/src/game/WorldLog.cpp deleted file mode 100644 index 6b6f6f337..000000000 --- a/src/game/WorldLog.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/** \file - \ingroup u2w -*/ - -#include "WorldLog.h" -#include "Policies/SingletonImp.h" -#include "Config/ConfigEnv.h" - -#define CLASS_LOCK MaNGOS::ClassLevelLockable -INSTANTIATE_SINGLETON_2(WorldLog, CLASS_LOCK); -INSTANTIATE_CLASS_MUTEX(WorldLog, ACE_Thread_Mutex); - -/// Open the log file (if specified so in the configuration file) -void WorldLog::Initialize() -{ - std::string logsDir = sConfig.GetStringDefault("LogsDir",""); - - if(!logsDir.empty()) - { - if((logsDir.at(logsDir.length()-1)!='/') && (logsDir.at(logsDir.length()-1)!='\\')) - logsDir.append("/"); - } - - std::string logname = sConfig.GetStringDefault("WorldLogFile", ""); - if(!logname.empty()) - { - i_file = fopen((logsDir+logname).c_str(), "w"); - } -} diff --git a/src/game/WorldLog.h b/src/game/WorldLog.h deleted file mode 100644 index eb11b48a5..000000000 --- a/src/game/WorldLog.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/// \addtogroup u2w -/// @{ -/// \file - -#ifndef MANGOS_WORLDLOG_H -#define MANGOS_WORLDLOG_H - -#include "Common.h" -#include "Policies/Singleton.h" -#include "Errors.h" - -#include - -/// %Log packets to a file -class MANGOS_DLL_DECL WorldLog : public MaNGOS::Singleton > -{ - friend class MaNGOS::OperatorNew; - WorldLog() : i_file(NULL) { Initialize(); } - WorldLog(const WorldLog &); - WorldLog& operator=(const WorldLog &); - typedef MaNGOS::ClassLevelLockable::Lock Guard; - - /// Close the file in destructor - ~WorldLog() - { - if( i_file != NULL ) - fclose(i_file); - i_file = NULL; - } - - public: - void Initialize(); - /// Is the world logger active? - bool LogWorld(void) const { return (i_file != NULL); } - /// %Log to the file - void Log(char const *fmt, ...) - { - if( LogWorld() ) - { - Guard guard(*this); - ASSERT(i_file); - - va_list args; - va_start(args, fmt); - vfprintf(i_file, fmt, args); - va_end(args); - - fflush(i_file); - } - } - - private: - FILE *i_file; -}; - -#define sWorldLog WorldLog::Instance() -#endif -/// @} diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 1de190ba5..886755359 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -42,7 +42,6 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" -#include "WorldLog.h" #if defined( __GNUC__ ) #pragma pack(1) @@ -166,24 +165,21 @@ int WorldSocket::SendPacket (const WorldPacket& pct) return -1; // Dump outgoing packet. - if (sWorldLog.LogWorld ()) + if (sLog.IsLogWorld()) { - sWorldLog.Log ("SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - (uint32) get_handle (), - pct.size (), - LookupOpcodeName (pct.GetOpcode ()), - pct.GetOpcode ()); + sLog.outWorld("S->C - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n", + uint32(get_handle()), pct.size (), LookupOpcodeName(pct.GetOpcode()), pct.GetOpcode()); - uint32 p = 0; - while (p < pct.size ()) + size_t p = 0; + while (p < pct.size()) { - for (uint32 j = 0; j < 16 && p < pct.size (); j++) - sWorldLog.Log ("%.2X ", const_cast(pct)[p++]); + for (size_t j = 0; j < 16 && p < pct.size(); ++j) + sLog.outWorld("%.2X ", const_cast(pct)[p++]); - sWorldLog.Log ("\n"); + sLog.outWorld("\n"); } - sWorldLog.Log ("\n\n"); + sLog.outWorld("\n\n"); } ServerPktHeader header(pct.size()+2, pct.GetOpcode()); @@ -682,25 +678,25 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) return -1; // Dump received packet. - if (sWorldLog.LogWorld ()) + if (sLog.IsLogWorld()) { - sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - (uint32) get_handle (), - new_pct->size (), - LookupOpcodeName (new_pct->GetOpcode ()), - new_pct->GetOpcode ()); + sLog.outWorld("C->S - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n", + uint32(get_handle()), new_pct->size(), LookupOpcodeName(new_pct->GetOpcode()), new_pct->GetOpcode()); - uint32 p = 0; - while (p < new_pct->size ()) + size_t p = 0; + while (p < new_pct->size()) { - for (uint32 j = 0; j < 16 && p < new_pct->size (); j++) - sWorldLog.Log ("%.2X ", (*new_pct)[p++]); - sWorldLog.Log ("\n"); + for (size_t j = 0; j < 16 && p < new_pct->size(); ++j) + sLog.outWorld("%.2X ", (*new_pct)[p++]); + + sLog.outWorld("\n"); } - sWorldLog.Log ("\n\n"); + + sLog.outWorld("\n\n"); } - try { + try + { switch(opcode) { case CMSG_PING: @@ -738,13 +734,13 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) } } } - catch(ByteBufferException &) + catch (ByteBufferException &) { sLog.outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1); if(sLog.IsOutDebug()) { - sLog.outDebug("Dumping error causing packet:"); + sLog.outDebug("Dumping error-causing packet:"); new_pct->hexlike(); } diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index f1c1027b6..2c344fe24 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -22,7 +22,6 @@ #include "Common.h" #include "Database/DatabaseEnv.h" -#include "ByteBuffer.h" #include "Config/ConfigEnv.h" #include "Log.h" #include "RealmList.h" @@ -252,14 +251,37 @@ void AuthSocket::OnRead() ///- Read the packet TcpSocket::OnRead(); uint8 _cmd; - while (1) + while (true) { if (!ibuf.GetLength()) return; - ///- Get the command out of it + ///- Get the command out of it. We can assume it's there, since length is not 0. ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ??? + // Dump incoming packet. + if (sLog.IsLogWorld()) + { + sLog.outWorld ("C->S - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n", + GetSocket(), ibuf.GetLength(), _cmd); + + size_t p = 0; + while (p < ibuf.GetLength()) + { + char dest; + for (size_t j = 0; j < 16 && p < ibuf.GetLength(); ++j) + { + ibuf.SoftRead(&dest, 1); + sLog.outWorld("%.2X ", *((uint8*)dest)); + p++; + } + + sLog.outWorld("\n"); + } + + sLog.outWorld("\n\n"); + } + size_t i; ///- Circle through known commands and call the correct command handler @@ -289,7 +311,34 @@ void AuthSocket::OnRead() } } -/// Make the SRP6 calculation from hash in dB +void AuthSocket::SendPacket(ByteBuffer* buf) +{ + // TODO: Also handle outgoing structs? + + uint8 _cmd = buf->read(); + + // Dump outgoing packet. + if (sLog.IsLogWorld()) + { + sLog.outWorld ("S->C - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n", + GetSocket(), buf->size(), _cmd); + + size_t p = 0; + while (p < buf->size()) + { + for (size_t j = 0; j < 16 && p < buf->size(); ++j) + sLog.outWorld("%.2X ", (*buf)[p++]); + + sLog.outWorld("\n"); + } + + sLog.outWorld("\n\n"); + } + + SendBuf((char const*)buf->contents(), buf->size()); +} + +/// Make the SRP6 calculation from hash in DB void AuthSocket::_SetVSFields(const std::string& rI) { s.SetRand(s_BYTE_SIZE * 8); @@ -521,7 +570,8 @@ bool AuthSocket::_HandleLogonChallenge() pkt<< (uint8) REALM_AUTH_NO_MATCH; } } - SendBuf((char const*)pkt.contents(), pkt.size()); + + SendPacket(&pkt); return true; } @@ -567,7 +617,7 @@ bool AuthSocket::_HandleLogonProof() pkt << (uint8) REALM_AUTH_WRONG_BUILD_NUMBER; DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build); DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp); - SendBuf((char const*)pkt.contents(), pkt.size()); + SendPacket(&pkt); return true; } else // have patch @@ -807,7 +857,7 @@ bool AuthSocket::_HandleReconnectChallenge() _reconnectProof.SetRand(16 * 8); pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros - SendBuf((char const*)pkt.contents(), pkt.size()); + SendPacket(&pkt); return true; } @@ -839,7 +889,7 @@ bool AuthSocket::_HandleReconnectProof() pkt << (uint8) AUTH_RECONNECT_PROOF; pkt << (uint8) 0x00; pkt << (uint16) 0x00; // 2 bytes zeros - SendBuf((char const*)pkt.contents(), pkt.size()); + SendPacket(&pkt); ///- Set _authed to true! _authed = true; @@ -921,7 +971,7 @@ bool AuthSocket::_HandleRealmList() hdr << (uint16)pkt.size(); hdr.append(pkt); - SendBuf((char const*)hdr.contents(), hdr.size()); + SendPacket(&pkt); return true; } diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index cf82f34f7..be91a99cd 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -24,6 +24,7 @@ #define _AUTHSOCKET_H #include "Common.h" +#include "ByteBuffer.h" #include "Auth/BigNumber.h" #include "sockets/TcpSocket.h" #include "sockets/SocketHandler.h" @@ -55,6 +56,8 @@ class AuthSocket: public TcpSocket bool _HandleXferCancel(); bool _HandleXferAccept(); + void SendPacket(ByteBuffer* buf); + void _SetVSFields(const std::string& rI); FILE *pPatch; diff --git a/src/realmd/realmd.conf.dist.in b/src/realmd/realmd.conf.dist.in index 217cb15d2..286cd900a 100644 --- a/src/realmd/realmd.conf.dist.in +++ b/src/realmd/realmd.conf.dist.in @@ -49,6 +49,10 @@ ConfVersion=2007062001 # Default: "Realmd.log" # "" - empty name disable creating log file # +# WorldLogFile +# Packet logging file for the realmserver +# Default: "world.log" +# # LogTimestamp # Logfile with timestamp of server start in name # Default: 0 - no timestamp in name @@ -105,6 +109,7 @@ PidFile = "" LogLevel = 0 LogTime = 0 LogFile = "Realmd.log" +WorldLogFile = "" LogTimestamp = 0 LogFileLevel = 0 LogColors = "" diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 15600ed7a..c46cb0d4e 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -225,9 +225,9 @@ void Log::Initialize() } charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a"); - dberLogfile = openLogFile("DBErrorLogFile",NULL,"a"); raLogfile = openLogFile("RaLogFile",NULL,"a"); + worldLogfile = openLogFile("WorldLogFile",NULL,"a"); // Main log file settings m_includeTime = sConfig.GetBoolDefault("LogTime", false); @@ -698,6 +698,21 @@ void Log::outChar(const char * str, ... ) } } +void Log::outWorld( const char * str, ... ) +{ + if (!str) + return; + + if (worldLogfile) + { + va_list args; + va_start(args, str); + vfprintf(worldLogfile, str, args); + va_end(args); + fflush(worldLogfile); + } +} + void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ) { if(charLogfile) diff --git a/src/shared/Log.h b/src/shared/Log.h index c9c004512..e4c596979 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -80,6 +80,10 @@ class Log : public MaNGOS::Singleton 2 || (m_logFileLevel > 2 && logfile); } bool IsOutCharDump() const { return m_charLog_Dump; } + bool IsLogWorld() const { return (worldLogfile); } bool IsIncludeTime() const { return m_includeTime; } private: FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode); @@ -128,6 +135,7 @@ class Log : public MaNGOS::Singleton::Instance() #ifdef MANGOS_DEBUG -#define DEBUG_LOG MaNGOS::Singleton::Instance().outDebug +#define DEBUG_LOG sLog.outDebug #else #define DEBUG_LOG #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e9537ab6a..dacf6c37f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8796" + #define REVISION_NR "8797" #endif // __REVISION_NR_H__ diff --git a/win/VC100/game.vcxproj b/win/VC100/game.vcxproj index 6b648c5ac..eaa5566eb 100644 --- a/win/VC100/game.vcxproj +++ b/win/VC100/game.vcxproj @@ -488,7 +488,6 @@ - @@ -621,7 +620,6 @@ - diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index a7b62a9f2..590a5dc25 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -1485,14 +1485,6 @@ RelativePath="..\..\src\game\SharedDefines.h" > - - - - diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index 613c6f080..d860b9f9f 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -1486,14 +1486,6 @@ RelativePath="..\..\src\game\SharedDefines.h" > - - - - From ea7100ff6318707bfe5c5e388d28fdf94a5a980a Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 9 Nov 2009 15:06:36 +0300 Subject: [PATCH 22/23] [8798] Partly revert and optimize [8797] * Revert realmd changes: - typos in prev. commit prevent correct work of realmd code. - useless log login packets - and really horrible idea log of patch packets (how nice convert some MB in hex strings) * Revert output world packet format to more readable old but output timestamp * Drop outWorld, but use explcit fprintf calls into new outWorldPacketDump. Not nice have 16 flush calls at hex line. --- src/game/WorldSocket.cpp | 34 +--------------- src/mangosd/mangosd.conf.dist.in | 5 +++ src/realmd/AuthSocket.cpp | 68 +++++--------------------------- src/realmd/AuthSocket.h | 3 -- src/realmd/realmd.conf.dist.in | 5 --- src/shared/Log.cpp | 28 ++++++++----- src/shared/Log.h | 6 +-- src/shared/revision_nr.h | 2 +- 8 files changed, 39 insertions(+), 112 deletions(-) diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 886755359..4b66ab137 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -165,22 +165,7 @@ int WorldSocket::SendPacket (const WorldPacket& pct) return -1; // Dump outgoing packet. - if (sLog.IsLogWorld()) - { - sLog.outWorld("S->C - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n", - uint32(get_handle()), pct.size (), LookupOpcodeName(pct.GetOpcode()), pct.GetOpcode()); - - size_t p = 0; - while (p < pct.size()) - { - for (size_t j = 0; j < 16 && p < pct.size(); ++j) - sLog.outWorld("%.2X ", const_cast(pct)[p++]); - - sLog.outWorld("\n"); - } - - sLog.outWorld("\n\n"); - } + sLog.outWorldPacketDump(uint32(get_handle()), pct.GetOpcode(), LookupOpcodeName(pct.GetOpcode()), &pct, false); ServerPktHeader header(pct.size()+2, pct.GetOpcode()); m_Crypt.EncryptSend ((uint8*)header.header, header.getHeaderLength()); @@ -678,22 +663,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) return -1; // Dump received packet. - if (sLog.IsLogWorld()) - { - sLog.outWorld("C->S - SOCKET: %u LENGTH: %u OPCODE: %s (0x%.4X)\n", - uint32(get_handle()), new_pct->size(), LookupOpcodeName(new_pct->GetOpcode()), new_pct->GetOpcode()); - - size_t p = 0; - while (p < new_pct->size()) - { - for (size_t j = 0; j < 16 && p < new_pct->size(); ++j) - sLog.outWorld("%.2X ", (*new_pct)[p++]); - - sLog.outWorld("\n"); - } - - sLog.outWorld("\n\n"); - } + sLog.outWorldPacketDump(uint32(get_handle()), new_pct->GetOpcode(), LookupOpcodeName(new_pct->GetOpcode()), new_pct, true); try { diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 55733004f..d925a1571 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -235,6 +235,11 @@ AddonChannel = 1 # Packet logging file for the worldserver # Default: "world.log" # +# WorldLogTimestamp +# Logfile with timestamp of server start in name +# Default: 0 - no timestamp in name +# 1 - add timestamp in name in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# # DBErrorLogFile # Log file of DB errors detected at server run # Default: "DBErrors.log" diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 2c344fe24..f1c1027b6 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -22,6 +22,7 @@ #include "Common.h" #include "Database/DatabaseEnv.h" +#include "ByteBuffer.h" #include "Config/ConfigEnv.h" #include "Log.h" #include "RealmList.h" @@ -251,37 +252,14 @@ void AuthSocket::OnRead() ///- Read the packet TcpSocket::OnRead(); uint8 _cmd; - while (true) + while (1) { if (!ibuf.GetLength()) return; - ///- Get the command out of it. We can assume it's there, since length is not 0. + ///- Get the command out of it ibuf.SoftRead((char *)&_cmd, 1); // UQ1: No longer exists in new net code ??? - // Dump incoming packet. - if (sLog.IsLogWorld()) - { - sLog.outWorld ("C->S - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n", - GetSocket(), ibuf.GetLength(), _cmd); - - size_t p = 0; - while (p < ibuf.GetLength()) - { - char dest; - for (size_t j = 0; j < 16 && p < ibuf.GetLength(); ++j) - { - ibuf.SoftRead(&dest, 1); - sLog.outWorld("%.2X ", *((uint8*)dest)); - p++; - } - - sLog.outWorld("\n"); - } - - sLog.outWorld("\n\n"); - } - size_t i; ///- Circle through known commands and call the correct command handler @@ -311,34 +289,7 @@ void AuthSocket::OnRead() } } -void AuthSocket::SendPacket(ByteBuffer* buf) -{ - // TODO: Also handle outgoing structs? - - uint8 _cmd = buf->read(); - - // Dump outgoing packet. - if (sLog.IsLogWorld()) - { - sLog.outWorld ("S->C - SOCKET: %u LENGTH: %u OPCODE: 0x%.4X\n", - GetSocket(), buf->size(), _cmd); - - size_t p = 0; - while (p < buf->size()) - { - for (size_t j = 0; j < 16 && p < buf->size(); ++j) - sLog.outWorld("%.2X ", (*buf)[p++]); - - sLog.outWorld("\n"); - } - - sLog.outWorld("\n\n"); - } - - SendBuf((char const*)buf->contents(), buf->size()); -} - -/// Make the SRP6 calculation from hash in DB +/// Make the SRP6 calculation from hash in dB void AuthSocket::_SetVSFields(const std::string& rI) { s.SetRand(s_BYTE_SIZE * 8); @@ -570,8 +521,7 @@ bool AuthSocket::_HandleLogonChallenge() pkt<< (uint8) REALM_AUTH_NO_MATCH; } } - - SendPacket(&pkt); + SendBuf((char const*)pkt.contents(), pkt.size()); return true; } @@ -617,7 +567,7 @@ bool AuthSocket::_HandleLogonProof() pkt << (uint8) REALM_AUTH_WRONG_BUILD_NUMBER; DEBUG_LOG("[AuthChallenge] %u is not a valid client version!", _build); DEBUG_LOG("[AuthChallenge] Patch %s not found", tmp); - SendPacket(&pkt); + SendBuf((char const*)pkt.contents(), pkt.size()); return true; } else // have patch @@ -857,7 +807,7 @@ bool AuthSocket::_HandleReconnectChallenge() _reconnectProof.SetRand(16 * 8); pkt.append(_reconnectProof.AsByteArray(16),16); // 16 bytes random pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros - SendPacket(&pkt); + SendBuf((char const*)pkt.contents(), pkt.size()); return true; } @@ -889,7 +839,7 @@ bool AuthSocket::_HandleReconnectProof() pkt << (uint8) AUTH_RECONNECT_PROOF; pkt << (uint8) 0x00; pkt << (uint16) 0x00; // 2 bytes zeros - SendPacket(&pkt); + SendBuf((char const*)pkt.contents(), pkt.size()); ///- Set _authed to true! _authed = true; @@ -971,7 +921,7 @@ bool AuthSocket::_HandleRealmList() hdr << (uint16)pkt.size(); hdr.append(pkt); - SendPacket(&pkt); + SendBuf((char const*)hdr.contents(), hdr.size()); return true; } diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index be91a99cd..cf82f34f7 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -24,7 +24,6 @@ #define _AUTHSOCKET_H #include "Common.h" -#include "ByteBuffer.h" #include "Auth/BigNumber.h" #include "sockets/TcpSocket.h" #include "sockets/SocketHandler.h" @@ -56,8 +55,6 @@ class AuthSocket: public TcpSocket bool _HandleXferCancel(); bool _HandleXferAccept(); - void SendPacket(ByteBuffer* buf); - void _SetVSFields(const std::string& rI); FILE *pPatch; diff --git a/src/realmd/realmd.conf.dist.in b/src/realmd/realmd.conf.dist.in index 286cd900a..217cb15d2 100644 --- a/src/realmd/realmd.conf.dist.in +++ b/src/realmd/realmd.conf.dist.in @@ -49,10 +49,6 @@ ConfVersion=2007062001 # Default: "Realmd.log" # "" - empty name disable creating log file # -# WorldLogFile -# Packet logging file for the realmserver -# Default: "world.log" -# # LogTimestamp # Logfile with timestamp of server start in name # Default: 0 - no timestamp in name @@ -109,7 +105,6 @@ PidFile = "" LogLevel = 0 LogTime = 0 LogFile = "Realmd.log" -WorldLogFile = "" LogTimestamp = 0 LogFileLevel = 0 LogColors = "" diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index c46cb0d4e..429b089e7 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -21,6 +21,7 @@ #include "Policies/SingletonImp.h" #include "Config/ConfigEnv.h" #include "Util.h" +#include "ByteBuffer.h" #include @@ -227,7 +228,7 @@ void Log::Initialize() charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a"); dberLogfile = openLogFile("DBErrorLogFile",NULL,"a"); raLogfile = openLogFile("RaLogFile",NULL,"a"); - worldLogfile = openLogFile("WorldLogFile",NULL,"a"); + worldLogfile = openLogFile("WorldLogFile","WorldLogTimestamp","a"); // Main log file settings m_includeTime = sConfig.GetBoolDefault("LogTime", false); @@ -698,19 +699,28 @@ void Log::outChar(const char * str, ... ) } } -void Log::outWorld( const char * str, ... ) +void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming ) { - if (!str) + if (!worldLogfile) return; - if (worldLogfile) + outTimestamp(worldLogfile); + + fprintf(worldLogfile,"\n%s:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", + incoming ? "CLIENT" : "SERVER", + socket, packet->size(), opcodeName, opcode); + + size_t p = 0; + while (p < packet->size()) { - va_list args; - va_start(args, str); - vfprintf(worldLogfile, str, args); - va_end(args); - fflush(worldLogfile); + for (size_t j = 0; j < 16 && p < packet->size(); ++j) + fprintf(worldLogfile, "%.2X ", (*packet)[p++]); + + fprintf(worldLogfile, "\n"); } + + fprintf(worldLogfile, "\n\n"); + fflush(worldLogfile); } void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ) diff --git a/src/shared/Log.h b/src/shared/Log.h index e4c596979..2500c6722 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -23,6 +23,7 @@ #include "Policies/Singleton.h" class Config; +class ByteBuffer; // bitmask enum LogFilters @@ -110,8 +111,8 @@ class Log : public MaNGOS::Singleton 2 || (m_logFileLevel > 2 && logfile); } bool IsOutCharDump() const { return m_charLog_Dump; } - bool IsLogWorld() const { return (worldLogfile); } bool IsIncludeTime() const { return m_includeTime; } private: FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index dacf6c37f..34b770567 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8797" + #define REVISION_NR "8798" #endif // __REVISION_NR_H__ From ee0fa561664d36309fb96c516b52c46c9a0b3823 Mon Sep 17 00:00:00 2001 From: Triply Date: Mon, 9 Nov 2009 22:24:06 +0100 Subject: [PATCH 23/23] [8799] Implemented thread safe bg queue updates. Signed-off-by: Triply --- src/game/BattleGround.cpp | 2 +- src/game/BattleGroundHandler.cpp | 289 +++++++++++++------------------ src/game/BattleGroundMgr.cpp | 80 ++++++--- src/game/BattleGroundMgr.h | 20 ++- src/shared/revision_nr.h | 2 +- 5 files changed, 187 insertions(+), 206 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 9517b206a..fa41ad7ea 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1084,7 +1084,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac { // a player has left the battleground, so there are free slots -> add to queue AddToBGFreeSlotQueue(); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId()); + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, GetQueueId()); } // Let others know diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 903a5de89..30d98ee3e 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -148,8 +148,9 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) // if we're here, then the conditions to join a bg are met. We can proceed in joining. // _player->GetGroup() was already checked, grp is already initialized - GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0); - uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); + BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, bgTypeId, 0, false, isPremade, 0); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); if (joinAsGroup /* && _player->GetGroup()*/) { sLog.outDebug("Battleground: the following players are joining as group:"); @@ -166,7 +167,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) member->GetSession()->SendPacket(&data); sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId); member->GetSession()->SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(member, ginfo); + bgQueue.AddPlayer(member, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName()); } sLog.outDebug("Battleground: group end"); @@ -181,12 +182,11 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(_player, ginfo); + bgQueue.AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); - if (!ginfo->IsInvitedToBGInstanceGUID) - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true); + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); + //we should announce queue status here, if we want } void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ ) @@ -303,7 +303,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) uint8 type; // arenatype if arena uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1 - uint32 instanceId; uint32 bgTypeId_; // type id from dbc uint16 unk; // 0x1F90 constant? uint8 action; // enter battle 0x1, leave queue 0x0 @@ -312,183 +311,131 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_); - // update battleground slots for the player to fix his UI and sent data. - // this is a HACK, I don't know why the client starts sending invalid packets in the first place. - // it usually happens with extremely high latency (if debugging / stepping in the code for example) - if (_player->InBattleGroundQueue()) - { - // update all queues, send invitation info if player is invited, queue info if queued - for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) - { - BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i); - if (!bgQueueTypeId) - continue; - BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId); - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); - // if the player is not in queue, continue or no group information - this should never happen - if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo) - continue; - - BattleGround * bg = NULL; - // get possibly needed data from groupinfo - uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType; - uint8 status = 0; - - if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) - { - // not invited to bg, get template - bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); - status = STATUS_WAIT_QUEUE; - } - else - { - // get the bg we're invited to - bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); - status = STATUS_WAIT_JOIN; - } - - // if bg not found, then continue, don't invite if already in the instance - if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID())) - continue; - - // re - invite player with proper data - WorldPacket data; - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, status, INVITE_ACCEPT_WAIT_TIME, 0, arenatype); - SendPacket(&data); - } - } + sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", bgTypeId_); + return; + } + if (!_player->InBattleGroundQueue()) + { + sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), he is not in bg_queue.", _player->GetGUIDLow()); return; } //get GroupQueueInfo from BattleGroundQueue BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type); - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); - if (itrPlayerStatus == qpMap.end()) + BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + //we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function + GroupQueueInfo ginfo; + if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) { - sLog.outError("Battleground: itrplayerstatus not found."); + sLog.outError("BattlegroundHandler: itrplayerstatus not found."); return; } - - instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID; // if action == 1, then instanceId is required - if (!instanceId && action == 1) + if (!ginfo.IsInvitedToBGInstanceGUID && action == 1) { - sLog.outError("Battleground: instance not found."); + sLog.outError("BattlegroundHandler: instance not found."); return; } - BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId); + BattleGround *bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); // bg template might and must be used in case of leaving queue, when instance is not created yet if (!bg && action == 0) bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg) { - sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId); + sLog.outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId); return; } - if (_player->InBattleGroundQueue()) + //some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it + if (action == 1 && ginfo.ArenaType == 0) { - //we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function! - uint32 team = itrPlayerStatus->second.GroupInfo->Team; - uint32 arenaType = itrPlayerStatus->second.GroupInfo->ArenaType; - uint32 isRated = itrPlayerStatus->second.GroupInfo->IsRated; - uint32 rating = itrPlayerStatus->second.GroupInfo->ArenaTeamRating; - uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating; - - //some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it - if (action == 1 && arenaType == 0) + //if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue + if (!_player->CanJoinToBattleground()) { - //if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue - if (!_player->CanJoinToBattleground()) - { - //send bg command result to show nice message - WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4); - data2 << uint32(0xFFFFFFFE); - _player->GetSession()->SendPacket(&data2); - action = 0; - sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); - } - //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue - if (_player->getLevel() > bg->GetMaxLevel()) - { - sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); - action = 0; - } + //send bg command result to show nice message + WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4); + data2 << uint32(0xFFFFFFFE); + _player->GetSession()->SendPacket(&data2); + action = 0; + sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); } - uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId); - WorldPacket data; - switch( action ) + //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue + if (_player->getLevel() > bg->GetMaxLevel()) { - case 1: // port to battleground - if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) - return; // cheating? - - _player->SetBattleGroundEntryPoint(); - - // resurrect the player - if (!_player->isAlive()) - { - _player->ResurrectPlayer(1.0f); - _player->SpawnCorpseBones(); - } - // stop taxi flight at port - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->m_taxi.ClearTaxiDestinations(); - } - - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType()); - _player->GetSession()->SendPacket(&data); - // remove battleground queue status from BGmgr - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), false); - // this is still needed here if battleground "jumping" shouldn't add deserter debuff - // also this is required to prevent stuck at old battleground after SetBattleGroundId set to new - if (BattleGround *currentBg = _player->GetBattleGround()) - currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); - - // set the destination instance id - _player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId); - // set the destination team - _player->SetBGTeam(team); - // bg->HandleBeforeTeleportToBattleGround(_player); - sBattleGroundMgr.SendToBattleGround(_player, instanceId, bgTypeId); - // add only in HandleMoveWorldPortAck() - // bg->AddPlayer(_player,team); - sLog.outDebug("Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); - break; - case 0: // leave queue - // if player leaves rated arena match before match start, it is counted as he played but he lost - if (isRated) - { - ArenaTeam * at = sObjectMgr.GetArenaTeamById(team); - if (at) - { - sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating); - at->MemberLost(_player, opponentsRating); - at->SaveToDB(); - } - } - _player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), true); - // player left queue, we should update it - do not update Arena Queue - if (!arenaType) - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(), arenaType, isRated, rating); - SendPacket(&data); - sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); - break; - default: - sLog.outError("Battleground port: unknown action %u", action); - break; + sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); + action = 0; } } + uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId); + WorldPacket data; + switch( action ) + { + case 1: // port to battleground + if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) + return; // cheating? + + _player->SetBattleGroundEntryPoint(); + + // resurrect the player + if (!_player->isAlive()) + { + _player->ResurrectPlayer(1.0f); + _player->SpawnCorpseBones(); + } + // stop taxi flight at port + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType()); + _player->GetSession()->SendPacket(&data); + // remove battleground queue status from BGmgr + bgQueue.RemovePlayer(_player->GetGUID(), false); + // this is still needed here if battleground "jumping" shouldn't add deserter debuff + // also this is required to prevent stuck at old battleground after SetBattleGroundId set to new + if (BattleGround *currentBg = _player->GetBattleGround()) + currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); + + // set the destination instance id + _player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId); + // set the destination team + _player->SetBGTeam(ginfo.Team); + // bg->HandleBeforeTeleportToBattleGround(_player); + sBattleGroundMgr.SendToBattleGround(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId); + // add only in HandleMoveWorldPortAck() + // bg->AddPlayer(_player,team); + sLog.outDebug("Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); + break; + case 0: // leave queue + // if player leaves rated arena match before match start, it is counted as he played but he lost + if (ginfo.IsRated) + { + ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.Team); + if (at) + { + sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating); + at->MemberLost(_player, ginfo.OpponentsTeamRating); + at->SaveToDB(); + } + } + _player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); + bgQueue.RemovePlayer(_player->GetGUID(), true); + // player left queue, we should update it - do not update Arena Queue + if (!ginfo.ArenaType) + sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); + SendPacket(&data); + sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); + break; + default: + sLog.outError("Battleground port: unknown action %u", action); + break; + } } void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket & /*recv_data*/ ) @@ -544,16 +491,16 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) } //we are sending update to player about queue - he can be invited there! //get GroupQueueInfo for queue status - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); - if (itrPlayerStatus == qpMap.end()) + BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + GroupQueueInfo ginfo; + if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) continue; - if (itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) + if (ginfo.IsInvitedToBGInstanceGUID) { - bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); + bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); if (!bg) continue; - uint32 remainingTime = getMSTimeDiff(getMSTime(), itrPlayerStatus->second.GroupInfo->RemoveInviteTime); + uint32 remainingTime = getMSTimeDiff(getMSTime(), ginfo.RemoveInviteTime); // send status invited to BattleGround sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType); SendPacket(&data); @@ -563,9 +510,9 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg) continue; - uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel()); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, _player->GetBattleGroundQueueIdFromLevel()); // send status in BattleGround Queue - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(itrPlayerStatus->second.GroupInfo->JoinTime, getMSTime()), arenaType); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(ginfo.JoinTime, getMSTime()), arenaType); SendPacket(&data); } } @@ -725,8 +672,9 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) arenaRating = avg_pers_rating; } - GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); - uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); if (asGroup) { sLog.outDebug("Battleground: arena join as group start"); @@ -745,12 +693,11 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) member->GetSession()->SendPacket(&data); sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId); member->GetSession()->SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(member, ginfo); + bgQueue.AddPlayer(member, ginfo); sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName()); } sLog.outDebug("Battleground: arena join as group end"); - if (isRated) - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true); + //announce to world ... removed } else { @@ -760,10 +707,10 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(_player, ginfo); + bgQueue.AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(), arenatype, isRated, arenaRating); + sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); } void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 2f23cbd5e..471c5d427 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -177,6 +177,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId index++; sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, queue_id : %u, index : %u", BgTypeId, queue_id, index); + ACE_Guard guard(m_Lock); m_QueuedGroups[queue_id][index].push_back(ginfo); // return ginfo, because it is needed to add players to this group info @@ -186,6 +187,8 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId //add player to playermap void BattleGroundQueue::AddPlayer(Player *plr, GroupQueueInfo *ginfo) { + ACE_Guard guard(m_Lock); + //if player isn't in queue, he is added, if already is, then values are overwritten, no memory leak PlayerQueueInfo& info = m_QueuedPlayers[plr->GetGUID()]; info.LastOnlineTime = getMSTime(); @@ -248,6 +251,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueue void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount) { //Player *plr = sObjectMgr.GetPlayer(guid); + ACE_Guard guard(m_Lock); int32 queue_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; @@ -364,6 +368,26 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou } } +//returns true when player pl_guid is in queue and is invited to bgInstanceGuid +bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime) +{ + ACE_Guard g(m_Lock); + QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid); + return ( qItr != m_QueuedPlayers.end() + && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == bgInstanceGuid + && qItr->second.GroupInfo->RemoveInviteTime == removeTime ); +} + +bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo) +{ + ACE_Guard g(m_Lock); + QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid); + if (qItr == m_QueuedPlayers.end()) + return false; + *ginfo = *(qItr->second.GroupInfo); + return true; +} + //Announce world message void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue) { @@ -461,7 +485,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID); // create remind invite events - BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->RemoveInviteTime); + BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime); plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME)); // create automatic remove events BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime); @@ -732,6 +756,7 @@ should be called from BattleGround::RemovePlayer function in some cases */ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType, bool isRated, uint32 arenaRating) { + ACE_Guard guard(m_Lock); //if no players in queue - do nothing if( m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty() && @@ -1021,17 +1046,15 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType()); uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); - if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue or in battleground + if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground { // check if player is invited to this bg - BattleGroundQueue::QueuedPlayersMap const& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::const_iterator qItr = qpMap.find(m_PlayerGuid); - if( qItr != qpMap.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID - && qItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime ) + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) { 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, qItr->second.GroupInfo->ArenaType); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType); plr->GetSession()->SendPacket(&data); } } @@ -1064,22 +1087,19 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) //bg pointer can be NULL! so use it carefully! uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId); - if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue, or in Battleground + 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::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator qMapItr = qpMap.find(m_PlayerGuid); - if( qMapItr != qpMap.end() && qMapItr->second.GroupInfo - && qMapItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID - && qMapItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime ) + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId]; + if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) { sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID); plr->RemoveBattleGroundQueueId(m_BgQueueTypeId); - sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].RemovePlayer(m_PlayerGuid, true); + bgQueue.RemovePlayer(m_PlayerGuid, true); //update queues if battleground isn't ended - if (bg) - sBattleGroundMgr.ScheduleQueueUpdate(m_BgQueueTypeId, m_BgTypeId, bg->GetQueueId()); + if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE) + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetQueueId()); WorldPacket data; sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); @@ -1167,18 +1187,24 @@ void BattleGroundMgr::Update(uint32 diff) // update scheduled queues if (!m_QueueUpdateScheduler.empty()) { - //copy vector and clear the other - // TODO add lock - // TODO maybe std::list would be better and then unlock after end of cycle - std::vector scheduled(m_QueueUpdateScheduler); - m_QueueUpdateScheduler.clear(); - // TODO drop lock + std::vector scheduled; + { + //create mutex + ACE_Guard guard(SchedulerLock); + //copy vector and clear the other + scheduled = std::vector(m_QueueUpdateScheduler); + m_QueueUpdateScheduler.clear(); + //release lock + } + for (uint8 i = 0; i < scheduled.size(); i++) { - BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16); + uint32 arenaRating = scheduled[i] >> 32; + uint8 arenaType = scheduled[i] >> 24 & 255; + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16 & 255); BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255); BGQueueIdBasedOnLevel queue_id = BGQueueIdBasedOnLevel(scheduled[i] & 255); - m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id); + m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id, arenaType, arenaRating > 0, arenaRating); } } @@ -2008,11 +2034,11 @@ void BattleGroundMgr::ToggleArenaTesting() sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF); } -void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) +void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) { - //This method must be atomic, TODO add mutex + ACE_Guard guard(SchedulerLock); //we will use only 1 number created of bgTypeId and queue_id - uint32 schedule_id = (bgQueueTypeId << 16) | (bgTypeId << 8) | queue_id; + uint64 schedule_id = ((uint64)arenaRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | queue_id; bool found = false; for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++) { diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 4d72d9656..36f097cdb 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -23,6 +23,7 @@ #include "Policies/Singleton.h" #include "Utilities/EventProcessor.h" #include "BattleGround.h" +#include "ace/Recursive_Thread_Mutex.h" typedef std::map BattleGroundSet; @@ -83,12 +84,19 @@ class BattleGroundQueue GroupQueueInfo * AddGroup(Player * leader, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); void AddPlayer(Player *plr, GroupQueueInfo *ginfo); void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); + bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); + bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo); void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); void DecreaseGroupLength(uint32 queueId, uint32 AsGroup); void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue); + private: + //mutex that should not allow changing private data, nor allowing to update Queue during private data change. + ACE_Recursive_Thread_Mutex m_Lock; + + typedef std::map QueuedPlayersMap; QueuedPlayersMap m_QueuedPlayers; @@ -123,8 +131,6 @@ class BattleGroundQueue //one selection pool for horde, other one for alliance SelectionPool m_SelectionPools[BG_TEAMS_COUNT]; - private: - bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side); uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES]; @@ -138,8 +144,8 @@ class BattleGroundQueue class BGQueueInviteEvent : public BasicEvent { public: - BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 removeTime) : - m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_RemoveTime(removeTime) + BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) : + m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime) { }; virtual ~BGQueueInviteEvent() {}; @@ -150,6 +156,7 @@ class BGQueueInviteEvent : public BasicEvent uint64 m_PlayerGuid; uint32 m_BgInstanceGUID; BattleGroundTypeId m_BgTypeId; + uint8 m_ArenaType; uint32 m_RemoveTime; }; @@ -219,7 +226,7 @@ class BattleGroundMgr BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID]; - void ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); + void ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); uint32 GetMaxRatingDifference() const; uint32 GetRatingDiscardTimer() const; uint32 GetPrematureFinishTime() const; @@ -265,13 +272,14 @@ class BattleGroundMgr static bool IsBGWeekend(BattleGroundTypeId bgTypeId); private: + ACE_Thread_Mutex SchedulerLock; BattleMastersMap mBattleMastersMap; CreatureBattleEventIndexesMap m_CreatureBattleEventIndexMap; GameObjectBattleEventIndexesMap m_GameObjectBattleEventIndexMap; /* Battlegrounds */ BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; - std::vectorm_QueueUpdateScheduler; + std::vector m_QueueUpdateScheduler; std::set m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_QUEUES]; //the instanceids just visible for the client uint32 m_NextRatingDiscardUpdate; time_t m_NextAutoDistributionTime; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 34b770567..25d6d8913 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8798" + #define REVISION_NR "8799" #endif // __REVISION_NR_H__