From 8bb67e69c5d8ddadbcb18f525f2a10214743fc4d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 14 Mar 2023 04:14:30 -0400 Subject: [PATCH] Core/Misc: Move GetContentTuningForArea from ObjectMgr to DB2Manager Port From (https://github.com/TrinityCore/TrinityCore/commit/8f38c12c4e7d832a91c7719ee1a5ac4d801862a6) --- Source/Game/DataStorage/DB2Manager.cs | 18 ++++++++++++++++++ Source/Game/Entities/GameObject/GameObject.cs | 2 +- Source/Game/Globals/ObjectManager.cs | 18 ------------------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index ec1382d20..905eeb57b 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -866,6 +866,24 @@ namespace Game.DataStorage return false; } + public ContentTuningRecord GetContentTuningForArea(AreaTableRecord areaEntry) + { + if (areaEntry == null) + return null; + + // Get ContentTuning for the area + var contentTuning = ContentTuningStorage.LookupByKey(areaEntry.ContentTuningID); + if (contentTuning != null) + return contentTuning; + + // If there is no data for the current area and it has a parent area, get data from the last (recursive) + var parentAreaEntry = AreaTableStorage.LookupByKey(areaEntry.ParentAreaID); + if (parentAreaEntry != null) + return GetContentTuningForArea(parentAreaEntry); + + return null; + } + public List GetArtifactPowers(byte artifactId) { return _artifactPowers.LookupByKey(artifactId); diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 09375c2f6..8222855c8 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -2007,7 +2007,7 @@ namespace Game.Entities } // Update the correct fishing skill according to the area's ContentTuning - ContentTuningRecord areaContentTuning = Global.ObjectMgr.GetContentTuningForArea(areaEntry); + ContentTuningRecord areaContentTuning = Global.DB2Mgr.GetContentTuningForArea(areaEntry); if (areaContentTuning == null) break; diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index be9b8b02e..e85ef2764 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -10476,24 +10476,6 @@ namespace Game return 0; } - - public ContentTuningRecord GetContentTuningForArea(AreaTableRecord areaEntry) - { - if (areaEntry == null) - return null; - - // Get ContentTuning for the area - var contentTuning = CliDB.ContentTuningStorage.LookupByKey(areaEntry.ContentTuningID); - if (contentTuning != null) - return contentTuning; - - // If there is no data for the current area and it has a parent area, get data from the last (recursive) - var parentAreaEntry = CliDB.AreaTableStorage.LookupByKey(areaEntry.ParentAreaID); - if (parentAreaEntry != null) - return GetContentTuningForArea(parentAreaEntry); - - return null; - } public uint GetMaxLevelForExpansion(Expansion expansion) {