summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormik1893 <michele.roscelli@gmail.com>2016-08-10 16:03:21 +0100
committerYehonal <yehonal.azeroth@gmail.com>2016-08-24 15:27:32 +0200
commitf23858188f5d9e6be50e5f24772b1256f057316a (patch)
tree683c97a3e4abb55494b54303b80f243fa0521628 /src
parent1cb7c81a78e26440fbe621847c1a575337160cb4 (diff)
Core/Instance: Shared normal/heroic ID is now a configurable feature (default: deactivated)
Diffstat (limited to 'src')
-rw-r--r--src/game/DataStores/DBCStores.cpp5
-rw-r--r--src/game/DataStores/DBCStores.h2
-rw-r--r--src/game/Handlers/MiscHandler.cpp4
-rw-r--r--src/game/Instances/InstanceSaveMgr.cpp5
-rw-r--r--src/game/Maps/Map.cpp2
-rw-r--r--src/game/Maps/MapInstanced.cpp2
-rw-r--r--src/game/World/World.cpp1
-rw-r--r--src/game/World/World.h1
8 files changed, 16 insertions, 6 deletions
diff --git a/src/game/DataStores/DBCStores.cpp b/src/game/DataStores/DBCStores.cpp
index 9768c73ae4..ea99e4df4f 100644
--- a/src/game/DataStores/DBCStores.cpp
+++ b/src/game/DataStores/DBCStores.cpp
@@ -856,6 +856,11 @@ PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundB
return NULL;
}
+bool IsSharedDifficultyMap(uint32 mapid)
+{
+ return sWorld->getBoolConfig(CONFIG_INSTANCE_SHARED_ID) && (mapid == 631 || mapid == 724);
+}
+
uint32 GetLiquidFlags(uint32 liquidType)
{
if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquidType))
diff --git a/src/game/DataStores/DBCStores.h b/src/game/DataStores/DBCStores.h
index 8370d7d8f9..d69d2132b9 100644
--- a/src/game/DataStores/DBCStores.h
+++ b/src/game/DataStores/DBCStores.h
@@ -44,6 +44,8 @@ typedef std::map<uint32/*pair32(map, diff)*/, MapDifficulty> MapDifficultyMap;
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
+bool IsSharedDifficultyMap(uint32 mapid);
+
uint32 GetLiquidFlags(uint32 liquidType);
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);
diff --git a/src/game/Handlers/MiscHandler.cpp b/src/game/Handlers/MiscHandler.cpp
index 87abeac96d..f4f93bda28 100644
--- a/src/game/Handlers/MiscHandler.cpp
+++ b/src/game/Handlers/MiscHandler.cpp
@@ -1508,7 +1508,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
return;
}
- if ((groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) && mode%2 == _player->GetRaidDifficulty()%2 && group->isRaidGroup())
+ if (IsSharedDifficultyMap(groupGuy->GetMap()->GetId()) && mode%2 == _player->GetRaidDifficulty()%2 && group->isRaidGroup())
{
if (!currMap)
currMap = groupGuy->GetMap();
@@ -1592,7 +1592,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
if (!groupGuy)
continue;
- if (groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724)
+ if (IsSharedDifficultyMap(groupGuy->GetMap()->GetId()))
{
anyoneInside = true;
diff --git a/src/game/Instances/InstanceSaveMgr.cpp b/src/game/Instances/InstanceSaveMgr.cpp
index c403861af7..3e6f791a0a 100644
--- a/src/game/Instances/InstanceSaveMgr.cpp
+++ b/src/game/Instances/InstanceSaveMgr.cpp
@@ -126,7 +126,7 @@ bool InstanceSaveManager::DeleteInstanceSaveIfNeeded(InstanceSave* save, bool sk
}
InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, time_t extendedResetTime)
-: m_resetTime(resetTime), m_extendedResetTime(extendedResetTime), m_instanceid(InstanceId), m_mapid(MapId), m_difficulty(MapId == 631 || MapId == 724 ? Difficulty(difficulty%2) : difficulty), m_canReset(true), m_instanceData(""), m_completedEncounterMask(0)
+: m_resetTime(resetTime), m_extendedResetTime(extendedResetTime), m_instanceid(InstanceId), m_mapid(MapId), m_difficulty(IsSharedDifficultyMap(MapId) ? Difficulty(difficulty%2) : difficulty), m_canReset(true), m_instanceData(""), m_completedEncounterMask(0)
{
}
@@ -676,7 +676,8 @@ void InstanceSaveManager::PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32
InstancePlayerBind* InstanceSaveManager::PlayerGetBoundInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty)
{
- Difficulty difficulty_fixed = (mapid == 631 || mapid == 724 ? Difficulty(difficulty%2) : difficulty);
+ Difficulty difficulty_fixed = ( IsSharedDifficultyMap(mapid) ? Difficulty(difficulty%2) : difficulty);
+
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty_fixed);
if (!mapDiff)
return NULL;
diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp
index 33abb8627a..268b11ecce 100644
--- a/src/game/Maps/Map.cpp
+++ b/src/game/Maps/Map.cpp
@@ -2974,7 +2974,7 @@ void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source)
{
- Difficulty difficulty_fixed = (GetId() == 631 || GetId() == 724 ? Difficulty(GetDifficulty()%2) : GetDifficulty());
+ Difficulty difficulty_fixed = (IsSharedDifficultyMap(GetId()) ? Difficulty(GetDifficulty()%2) : GetDifficulty());
DungeonEncounterList const* encounters = sObjectMgr->GetDungeonEncounterList(GetId(), difficulty_fixed);
if (!encounters)
return;
diff --git a/src/game/Maps/MapInstanced.cpp b/src/game/Maps/MapInstanced.cpp
index 1e8701b525..5f04566b77 100644
--- a/src/game/Maps/MapInstanced.cpp
+++ b/src/game/Maps/MapInstanced.cpp
@@ -139,7 +139,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
map = FindInstanceMap(destInstId);
if (!map)
map = CreateInstance(destInstId, pSave, realdiff);
- else if ((mapId == 631 || mapId == 724) && !map->HavePlayers() && map->GetDifficulty() != realdiff)
+ else if (IsSharedDifficultyMap(mapId) && !map->HavePlayers() && map->GetDifficulty() != realdiff)
{
if (player->isBeingLoaded()) // pussywizard: crashfix (assert(passengers.empty) fail in ~transport), could be added to a transport during loading from db
return NULL;
diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp
index 682906a193..8272744436 100644
--- a/src/game/World/World.cpp
+++ b/src/game/World/World.cpp
@@ -858,6 +858,7 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_INSTANCE_IGNORE_LEVEL] = sConfigMgr->GetBoolDefault("Instance.IgnoreLevel", false);
m_bool_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Instance.IgnoreRaid", false);
+ m_bool_configs[CONFIG_INSTANCE_SHARED_ID] = sConfigMgr->GetBoolDefault("Instance.SharedNormalHeroicId", false);
m_int_configs[CONFIG_INSTANCE_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Instance.ResetTimeHour", 4);
m_int_configs[CONFIG_INSTANCE_RESET_TIME_RELATIVE_TIMESTAMP] = sConfigMgr->GetIntDefault("Instance.ResetTimeRelativeTimestamp", 1135814400);
diff --git a/src/game/World/World.h b/src/game/World/World.h
index 6f568b22c9..96b03fd5d7 100644
--- a/src/game/World/World.h
+++ b/src/game/World/World.h
@@ -93,6 +93,7 @@ enum WorldBoolConfigs
CONFIG_INSTANT_TAXI,
CONFIG_INSTANCE_IGNORE_LEVEL,
CONFIG_INSTANCE_IGNORE_RAID,
+ CONFIG_INSTANCE_SHARED_ID,
CONFIG_GM_LOG_TRADE,
CONFIG_ALLOW_GM_GROUP,
CONFIG_ALLOW_GM_FRIEND,