Core/Players: Use CharBaseInfo.db2 data to determine appropriate race for mercenary mode transforms

Port From (https://github.com/TrinityCore/TrinityCore/commit/c2ac37125b566cb4d9b659bc8ae2d381f60bc6db)
This commit is contained in:
Hondacrx
2024-08-04 16:13:43 -04:00
parent e9b21a91be
commit 8969d59a41
5 changed files with 26 additions and 44 deletions
+2
View File
@@ -95,6 +95,7 @@ namespace Game.DataStorage
CfgCategoriesStorage = ReadDB2<Cfg_CategoriesRecord>("Cfg_Categories.db2", HotfixStatements.SEL_CFG_CATEGORIES, HotfixStatements.SEL_CFG_CATEGORIES_LOCALE);
CfgRegionsStorage = ReadDB2<Cfg_RegionsRecord>("Cfg_Regions.db2", HotfixStatements.SEL_CFG_REGIONS);
ChallengeModeItemBonusOverrideStorage = ReadDB2<ChallengeModeItemBonusOverrideRecord>("ChallengeModeItemBonusOverride.db2", HotfixStatements.SEL_CHALLENGE_MODE_ITEM_BONUS_OVERRIDE);
CharBaseInfoStorage = ReadDB2<CharBaseInfoRecord>("CharBaseInfo.db2", HotfixStatements.SEL_CHAR_BASE_INFO);
CharTitlesStorage = ReadDB2<CharTitlesRecord>("CharTitles.db2", HotfixStatements.SEL_CHAR_TITLES, HotfixStatements.SEL_CHAR_TITLES_LOCALE);
CharacterLoadoutStorage = ReadDB2<CharacterLoadoutRecord>("CharacterLoadout.db2", HotfixStatements.SEL_CHARACTER_LOADOUT);
CharacterLoadoutItemStorage = ReadDB2<CharacterLoadoutItemRecord>("CharacterLoadoutItem.db2", HotfixStatements.SEL_CHARACTER_LOADOUT_ITEM);
@@ -532,6 +533,7 @@ namespace Game.DataStorage
public static DB6Storage<Cfg_CategoriesRecord> CfgCategoriesStorage;
public static DB6Storage<Cfg_RegionsRecord> CfgRegionsStorage;
public static DB6Storage<ChallengeModeItemBonusOverrideRecord> ChallengeModeItemBonusOverrideStorage;
public static DB6Storage<CharBaseInfoRecord> CharBaseInfoStorage;
public static DB6Storage<CharTitlesRecord> CharTitlesStorage;
public static DB6Storage<CharacterLoadoutRecord> CharacterLoadoutStorage;
public static DB6Storage<CharacterLoadoutItemRecord> CharacterLoadoutItemStorage;
+8
View File
@@ -113,6 +113,8 @@ namespace Game.DataStorage
foreach (var broadcastTextDuration in BroadcastTextDurationStorage.Values)
_broadcastTextDurations[(broadcastTextDuration.BroadcastTextID, (CascLocaleBit)broadcastTextDuration.Locale)] = broadcastTextDuration.Duration;
foreach (var (_, charBaseInfo) in CharBaseInfoStorage)
_charBaseInfoByRaceAndClass[(charBaseInfo.RaceID, charBaseInfo.ClassID)] = charBaseInfo;
foreach (var uiDisplay in ChrClassUIDisplayStorage.Values)
{
@@ -989,6 +991,11 @@ namespace Game.DataStorage
return _broadcastTextDurations.LookupByKey((broadcastTextId, SharedConst.WowLocaleToCascLocaleBit[(int)locale]));
}
public CharBaseInfoRecord GetCharBaseInfo(Race race, Class class_)
{
return _charBaseInfoByRaceAndClass.LookupByKey((race, class_));
}
public ChrClassUIDisplayRecord GetUiDisplayForClass(Class unitClass)
{
Cypher.Assert(unitClass < Class.Max);
@@ -2272,6 +2279,7 @@ namespace Game.DataStorage
MultiMap<uint, AzeritePowerSetMemberRecord> _azeritePowers = new();
Dictionary<(uint azeriteUnlockSetId, ItemContext itemContext), byte[]> _azeriteTierUnlockLevels = new();
Dictionary<(int broadcastTextId, CascLocaleBit cascLocaleBit), int> _broadcastTextDurations = new();
Dictionary<(sbyte, sbyte), CharBaseInfoRecord> _charBaseInfoByRaceAndClass = new();
ChrClassUIDisplayRecord[] _uiDisplayByClass = new ChrClassUIDisplayRecord[(int)Class.Max];
uint[][] _powersByClass = new uint[(int)Class.Max][];
MultiMap<uint, ChrCustomizationChoiceRecord> _chrCustomizationChoicesByOption = new();
@@ -43,6 +43,14 @@ namespace Game.DataStorage
public uint SrcItemBonusTreeID;
}
public sealed class CharBaseInfoRecord
{
public uint Id;
public sbyte RaceID;
public sbyte ClassID;
public int OtherFactionRaceID;
}
public sealed class CharTitlesRecord
{
public uint Id;