aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/DataStores
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-01-10 01:35:47 +0100
committerShauren <shauren.trinity@gmail.com>2015-01-10 01:35:47 +0100
commitfaa583c7843af37d757bd46ca0bd226175dabc38 (patch)
tree5af657d84903b337bdb22c341bb01f4e6aab1392 /src/server/game/DataStores
parentf6b30fdf616bd289dd668f98a0aed8dbfb14eba8 (diff)
Core/Maps: Updated map difficulties
Diffstat (limited to 'src/server/game/DataStores')
-rw-r--r--src/server/game/DataStores/DBCEnums.h33
-rw-r--r--src/server/game/DataStores/DBCStores.cpp64
-rw-r--r--src/server/game/DataStores/DBCStores.h4
-rw-r--r--src/server/game/DataStores/DBCStructure.h27
-rw-r--r--src/server/game/DataStores/DBCfmt.h3
5 files changed, 96 insertions, 35 deletions
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index 671e2816a19..cf8701dc0d7 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -352,21 +352,28 @@ enum Difficulty
DIFFICULTY_40 = 9,
DIFFICULTY_HC_SCENARIO = 11,
DIFFICULTY_N_SCENARIO = 12,
- DIFFICULTY_NORMAL2 = 14,
- DIFFICULTY_HEROIC2 = 15,
- DIFFICULTY_MYTHIC = 16,
- DIFFICULTY_LFR2 = 17,
- DIFFICULTY_EVENT = 18,
- DIFFICULTY_EVENT2 = 19,
+ DIFFICULTY_NORMAL_RAID = 14,
+ DIFFICULTY_HEROIC_RAID = 15,
+ DIFFICULTY_MYTHIC_RAID = 16,
+ DIFFICULTY_LFR_NEW = 17,
+ DIFFICULTY_EVENT_RAID = 18,
+ DIFFICULTY_EVENT_DUNGEON = 19,
DIFFICULTY_EVENT_SCENARIO = 20,
- DIFFICULTY_MAX = 21,
+
+ MAX_DIFFICULTY
};
-#define RAID_DIFFICULTY_MASK_25MAN 1 // since 25man difficulties are 1 and 3, we can check them like that
+enum DifficultyFlags
+{
+ DIFFICULTY_FLAG_HEROIC = 0x01,
+ DIFFICULTY_FLAG_DEFAULT = 0x02,
+ DIFFICULTY_FLAG_CAN_SELECT = 0x04, // Player can select this difficulty in dropdown menu
+ DIFFICULTY_FLAG_CHALLENGE_MODE = 0x08,
-#define MAX_DUNGEON_DIFFICULTY 3
-#define MAX_RAID_DIFFICULTY 4
-#define MAX_DIFFICULTY 4
+ DIFFICULTY_FLAG_LEGACY = 0x20,
+ DIFFICULTY_FLAG_DISPLAY_HEROIC = 0x40, // Controls icon displayed on minimap when inside the instance
+ DIFFICULTY_FLAG_DISPLAY_MYTHIC = 0x80 // Controls icon displayed on minimap when inside the instance
+};
enum SpawnMask
{
@@ -415,7 +422,9 @@ enum MapTypes // Lua_IsInInstance
enum MapFlags
{
- MAP_FLAG_DYNAMIC_DIFFICULTY = 0x100
+ MAP_FLAG_CAN_TOGGLE_DIFFICULTY = 0x0100,
+ MAP_FLAG_FLEX_LOCKING = 0x8000, // All difficulties share completed encounters lock, not bound to a single instance id
+ // heroic difficulty flag overrides it and uses instance id bind
};
enum AbilytyLearnType
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 6c0cc92550c..783827a4f93 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -90,6 +90,7 @@ DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore(CurrencyTypesfmt);
uint32 PowersByClass[MAX_CLASSES][MAX_POWERS];
DBCStorage <DestructibleModelDataEntry> sDestructibleModelDataStore(DestructibleModelDatafmt);
+DBCStorage <DifficultyEntry> sDifficultyStore(DifficultyFmt);
DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore(DungeonEncounterfmt);
DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore(DurabilityQualityfmt);
DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore(DurabilityCostsfmt);
@@ -415,13 +416,14 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sCriteriaTreeStore, dbcPath, "CriteriaTree.dbc");//19342
LoadDBC(availableDbcLocales, bad_dbc_files, sCurrencyTypesStore, dbcPath, "CurrencyTypes.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sDestructibleModelDataStore, dbcPath, "DestructibleModelData.dbc");//19116
+ LoadDBC(availableDbcLocales, bad_dbc_files, sDifficultyStore, dbcPath, "Difficulty.dbc");//19342
LoadDBC(availableDbcLocales, bad_dbc_files, sDungeonEncounterStore, dbcPath, "DungeonEncounter.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sDurabilityCostsStore, dbcPath, "DurabilityCosts.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sDurabilityQualityStore, dbcPath, "DurabilityQuality.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sEmotesStore, dbcPath, "Emotes.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sEmotesTextStore, dbcPath, "EmotesText.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sFactionStore, dbcPath, "Faction.dbc");//19116
- for (uint32 i=0; i<sFactionStore.GetNumRows(); ++i)
+ for (uint32 i = 0; i < sFactionStore.GetNumRows(); ++i)
{
FactionEntry const* faction = sFactionStore.LookupEntry(i);
if (faction && faction->ParentFactionID)
@@ -491,10 +493,10 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sMapStore, dbcPath, "Map.dbc");//19116
LoadDBC(availableDbcLocales, bad_dbc_files, sMapDifficultyStore, dbcPath, "MapDifficulty.dbc");//19116
// fill data
- sMapDifficultyMap[MAKE_PAIR32(0, 0)] = MapDifficulty(0, 0, false);//map 0 is missingg from MapDifficulty.dbc use this till its ported to sql
+ sMapDifficultyMap[0][0] = MapDifficulty(DIFFICULTY_NONE, 0, 0, false);//map 0 is missingg from MapDifficulty.dbc use this till its ported to sql
for (uint32 i = 0; i < sMapDifficultyStore.GetNumRows(); ++i)
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
- sMapDifficultyMap[MAKE_PAIR32(entry->MapID, entry->DifficultyID)] = MapDifficulty(entry->RaidDuration, entry->MaxPlayers, entry->Message_lang[0] > 0);
+ sMapDifficultyMap[entry->MapID][entry->DifficultyID] = MapDifficulty(entry->DifficultyID, entry->RaidDuration, entry->MaxPlayers, entry->Message_lang[0] > 0);
sMapDifficultyStore.Clear();
LoadDBC(availableDbcLocales, bad_dbc_files, sModifierTreeStore, dbcPath, "ModifierTree.dbc");//19342
@@ -950,35 +952,63 @@ void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
if (!maEntry)
return;
- x = (x-maEntry->LocTop)/((maEntry->LocBottom-maEntry->LocTop)/100);
- y = (y-maEntry->LocLeft)/((maEntry->LocRight-maEntry->LocLeft)/100); // client y coord from top to down
+ x = (x - maEntry->LocTop) / ((maEntry->LocBottom - maEntry->LocTop) / 100);
+ y = (y - maEntry->LocLeft) / ((maEntry->LocRight - maEntry->LocLeft) / 100); // client y coord from top to down
std::swap(x, y); // client have map coords swapped
}
+MapDifficulty const* GetDefaultMapDifficulty(uint32 mapID)
+{
+ auto itr = sMapDifficultyMap.find(mapID);
+ if (itr == sMapDifficultyMap.end())
+ return nullptr;
+
+ if (itr->second.empty())
+ return nullptr;
+
+ for (auto& p : itr->second)
+ {
+ DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(p.first);
+ if (!difficulty)
+ continue;
+
+ if (difficulty->Flags & DIFFICULTY_FLAG_DEFAULT)
+ return &p.second;
+ }
+
+ return &itr->second.begin()->second;
+}
+
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
{
- MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId, difficulty));
- return itr != sMapDifficultyMap.end() ? &itr->second : NULL;
+ auto itr = sMapDifficultyMap.find(mapId);
+ if (itr == sMapDifficultyMap.end())
+ return nullptr;
+
+ auto diffItr = itr->second.find(difficulty);
+ if (diffItr == itr->second.end())
+ return nullptr;
+
+ return &diffItr->second;
}
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
{
+ DifficultyEntry const* diffEntry = sDifficultyStore.LookupEntry(difficulty);
+ if (!diffEntry)
+ return GetDefaultMapDifficulty(mapId);
+
uint32 tmpDiff = difficulty;
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff));
- if (!mapDiff)
+ while (!mapDiff)
{
- if (tmpDiff > DIFFICULTY_25_N) // heroic, downscale to normal
- tmpDiff -= 2;
- else
- tmpDiff -= 1; // any non-normal mode for raids like tbc (only one mode)
+ tmpDiff = diffEntry->FallbackDifficultyID;
+ diffEntry = sDifficultyStore.LookupEntry(tmpDiff);
+ if (!diffEntry)
+ return GetDefaultMapDifficulty(mapId);
// pull new data
mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // we are 10 normal or 25 normal
- if (!mapDiff)
- {
- tmpDiff -= 1;
- mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // 10 normal
- }
}
difficulty = Difficulty(tmpDiff);
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index b73fbcf02f5..7bc8dcf5b64 100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -70,7 +70,8 @@ uint32 GetClassBySkillId(uint32 skillId);
uint32 GetSkillIdByClass(uint32 classId);
std::list<uint32> GetSpellsForLevels(uint32 classId, uint32 raceMask, uint32 specializationId, uint32 minLevel, uint32 maxLevel);
-typedef std::map<uint32/*pair32(map, diff)*/, MapDifficulty> MapDifficultyMap;
+typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficulty>> MapDifficultyMap;
+MapDifficulty const* GetDefaultMapDifficulty(uint32 mapID);
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
@@ -156,6 +157,7 @@ extern DBCStorage <CriteriaEntry> sCriteriaStore;
extern DBCStorage <CriteriaTreeEntry> sCriteriaTreeStore;
extern DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore;
extern DBCStorage <DestructibleModelDataEntry> sDestructibleModelDataStore;
+extern DBCStorage <DifficultyEntry> sDifficultyStore;
extern DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore;
extern DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore;
extern DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore;
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index a87083882e2..813f7ba4019 100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -620,6 +620,23 @@ struct DestructibleModelDataEntry
//uint32 HealEffectSpeed; // 23
};
+struct DifficultyEntry
+{
+ uint32 ID; // 0
+ uint32 FallbackDifficultyID; // 1
+ uint32 InstanceType; // 2
+ uint32 MinPlayers; // 3
+ uint32 MaxPlayers; // 4
+ //int32 OldEnumValue; // 5
+ uint32 Flags; // 6
+ uint32 ToggleDifficultyID; // 7
+ //uint32 GroupSizeHealthCurveID; // 8
+ //uint32 GroupSizeDmgCurveID; // 9
+ //uint32 GroupSizeSpellPointsCurveID; // 10
+ //char const* NameLang; // 11
+ //uint32 Unk; // 12
+};
+
struct DungeonEncounterEntry
{
uint32 ID; // 0
@@ -1202,7 +1219,7 @@ struct MapEntry
return ID == 0 || ID == 1 || ID == 530 || ID == 571 || ID == 870 || ID == 1116;
}
- bool IsDynamicDifficultyMap() const { return (Flags & MAP_FLAG_DYNAMIC_DIFFICULTY) != 0; }
+ bool IsDynamicDifficultyMap() const { return (Flags & MAP_FLAG_CAN_TOGGLE_DIFFICULTY) != 0; }
};
struct MapDifficultyEntry
@@ -1213,7 +1230,7 @@ struct MapDifficultyEntry
char* Message_lang; // 3 m_message_lang (text showed when transfer to map failed)
uint32 RaidDuration; // 4 m_raidDuration in secs, 0 if no fixed reset time
uint32 MaxPlayers; // 5 m_maxPlayers some heroic versions have 0 when expected same amount as in normal version
- //uint32 Unk1; // 6
+ uint32 LockID; // 6
//uint32 Unk2; // 7
};
@@ -2021,9 +2038,11 @@ typedef std::map<uint32, VectorArray> NameGenContainer;
// Structures not used for casting to loaded DBC data and not required then packing
struct MapDifficulty
{
- MapDifficulty() : resetTime(0), maxPlayers(0), hasErrorMessage(false) { }
- MapDifficulty(uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage) : resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) { }
+ MapDifficulty() : DifficultyID(0), resetTime(0), maxPlayers(0), hasErrorMessage(false) { }
+ MapDifficulty(uint32 difficultyID, uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage)
+ : DifficultyID(difficultyID), resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) { }
+ uint32 DifficultyID;
uint32 resetTime;
uint32 maxPlayers;
bool hasErrorMessage;
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 540e1951b72..3f9f01cab16 100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -52,6 +52,7 @@ char const Criteriafmt[] = "niiiiiiiixii";
char const CriteriaTreefmt[] = "niliixxx";
char const CurrencyTypesfmt[] = "nixxxxxiiixx";
char const DestructibleModelDatafmt[] = "nixxxixxxxixxxxixxxxxxxx";
+char const DifficultyFmt[] = "niiiixiixxxxx";
char const DungeonEncounterfmt[] = "niiixsxxx";
char const DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char const DurabilityQualityfmt[] = "nf";
@@ -106,7 +107,7 @@ char const LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
char const PhaseEntryfmt[] = "ni";
char const MailTemplateEntryfmt[] = "nxs";
char const MapEntryfmt[] = "nxiixxsixxixiffxiiiixx";
-char const MapDifficultyEntryfmt[] = "diisiixx";
+char const MapDifficultyEntryfmt[] = "diisiiix";
char const MinorTalentEntryfmt[] = "niii";
char const MovieEntryfmt[] = "nxxxx";
char const ModifierTreefmt[] = "niiiiii";