Core/Items: Implement azerite empowered items
Port From (https://github.com/TrinityCore/TrinityCore/commit/d934824421c83598853487c5cc9e4cbb3c5d0006)
This commit is contained in:
@@ -54,6 +54,7 @@ namespace Game.DataStorage
|
||||
ArtifactTierStorage = DBReader.Read<ArtifactTierRecord>("ArtifactTier.db2", HotfixStatements.SEL_ARTIFACT_TIER);
|
||||
ArtifactUnlockStorage = DBReader.Read<ArtifactUnlockRecord>("ArtifactUnlock.db2", HotfixStatements.SEL_ARTIFACT_UNLOCK);
|
||||
AuctionHouseStorage = DBReader.Read<AuctionHouseRecord>("AuctionHouse.db2", HotfixStatements.SEL_AUCTION_HOUSE, HotfixStatements.SEL_AUCTION_HOUSE_LOCALE);
|
||||
AzeriteEmpoweredItemStorage = DBReader.Read<AzeriteEmpoweredItemRecord>("AzeriteEmpoweredItem.db2", HotfixStatements.SEL_AZERITE_EMPOWERED_ITEM);
|
||||
AzeriteEssenceStorage = DBReader.Read<AzeriteEssenceRecord>("AzeriteEssence.db2", HotfixStatements.SEL_AZERITE_ESSENCE, HotfixStatements.SEL_AZERITE_ESSENCE_LOCALE);
|
||||
AzeriteEssencePowerStorage = DBReader.Read<AzeriteEssencePowerRecord>("AzeriteEssencePower.db2", HotfixStatements.SEL_AZERITE_ESSENCE_POWER, HotfixStatements.SEL_AZERITE_ESSENCE_POWER_LOCALE);
|
||||
AzeriteItemStorage = DBReader.Read<AzeriteItemRecord>("AzeriteItem.db2", HotfixStatements.SEL_AZERITE_ITEM);
|
||||
@@ -61,6 +62,10 @@ namespace Game.DataStorage
|
||||
AzeriteKnowledgeMultiplierStorage = DBReader.Read<AzeriteKnowledgeMultiplierRecord>("AzeriteKnowledgeMultiplier.db2", HotfixStatements.SEL_AZERITE_KNOWLEDGE_MULTIPLIER);
|
||||
AzeriteLevelInfoStorage = DBReader.Read<AzeriteLevelInfoRecord>("AzeriteLevelInfo.db2", HotfixStatements.SEL_AZERITE_LEVEL_INFO);
|
||||
AzeritePowerStorage = DBReader.Read<AzeritePowerRecord>("AzeritePower.db2", HotfixStatements.SEL_AZERITE_POWER);
|
||||
AzeritePowerSetMemberStorage = DBReader.Read<AzeritePowerSetMemberRecord> ("AzeritePowerSetMember.db2", HotfixStatements.SEL_AZERITE_POWER_SET_MEMBER);
|
||||
AzeriteTierUnlockStorage = DBReader.Read<AzeriteTierUnlockRecord> ("AzeriteTierUnlock.db2", HotfixStatements.SEL_AZERITE_TIER_UNLOCK);
|
||||
AzeriteTierUnlockSetStorage = DBReader.Read<AzeriteTierUnlockSetRecord> ("AzeriteTierUnlockSet.db2", HotfixStatements.SEL_AZERITE_TIER_UNLOCK_SET);
|
||||
AzeriteUnlockMappingStorage = DBReader.Read<AzeriteUnlockMappingRecord> ("AzeriteUnlockMapping.db2", HotfixStatements.SEL_AZERITE_UNLOCK_MAPPING);
|
||||
BankBagSlotPricesStorage = DBReader.Read<BankBagSlotPricesRecord>("BankBagSlotPrices.db2", HotfixStatements.SEL_BANK_BAG_SLOT_PRICES);
|
||||
//BannedAddOnsStorage = DBReader.Read<BannedAddOnsRecord>("BannedAddons.db2", HotfixStatements.SEL_BANNED_ADDONS);
|
||||
BarberShopStyleStorage = DBReader.Read<BarberShopStyleRecord>("BarberShopStyle.db2", HotfixStatements.SEL_BARBER_SHOP_STYLE, HotfixStatements.SEL_BARBER_SHOP_STYLE_LOCALE);
|
||||
@@ -406,6 +411,7 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<ArtifactTierRecord> ArtifactTierStorage;
|
||||
public static DB6Storage<ArtifactUnlockRecord> ArtifactUnlockStorage;
|
||||
public static DB6Storage<AuctionHouseRecord> AuctionHouseStorage;
|
||||
public static DB6Storage<AzeriteEmpoweredItemRecord> AzeriteEmpoweredItemStorage;
|
||||
public static DB6Storage<AzeriteEssenceRecord> AzeriteEssenceStorage;
|
||||
public static DB6Storage<AzeriteEssencePowerRecord> AzeriteEssencePowerStorage;
|
||||
public static DB6Storage<AzeriteItemRecord> AzeriteItemStorage;
|
||||
@@ -413,6 +419,10 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<AzeriteKnowledgeMultiplierRecord> AzeriteKnowledgeMultiplierStorage;
|
||||
public static DB6Storage<AzeriteLevelInfoRecord> AzeriteLevelInfoStorage;
|
||||
public static DB6Storage<AzeritePowerRecord> AzeritePowerStorage;
|
||||
public static DB6Storage<AzeritePowerSetMemberRecord> AzeritePowerSetMemberStorage;
|
||||
public static DB6Storage<AzeriteTierUnlockRecord> AzeriteTierUnlockStorage;
|
||||
public static DB6Storage<AzeriteTierUnlockSetRecord> AzeriteTierUnlockSetStorage;
|
||||
public static DB6Storage<AzeriteUnlockMappingRecord> AzeriteUnlockMappingStorage;
|
||||
public static DB6Storage<BankBagSlotPricesRecord> BankBagSlotPricesStorage;
|
||||
//public static DB6Storage<BannedAddOnsRecord> BannedAddOnsStorage;
|
||||
public static DB6Storage<BarberShopStyleRecord> BarberShopStyleStorage;
|
||||
|
||||
@@ -63,8 +63,11 @@ namespace Game.DataStorage
|
||||
|
||||
CliDB.ArtifactPowerRankStorage.Clear();
|
||||
|
||||
foreach (AzeriteEmpoweredItemRecord azeriteEmpoweredItem in CliDB.AzeriteEmpoweredItemStorage.Values)
|
||||
_azeriteEmpoweredItems[azeriteEmpoweredItem.ItemID] = azeriteEmpoweredItem;
|
||||
|
||||
foreach (AzeriteEssencePowerRecord azeriteEssencePower in CliDB.AzeriteEssencePowerStorage.Values)
|
||||
_azeriteEssencePowersByIdAndRank[Tuple.Create((uint)azeriteEssencePower.AzeriteEssenceID, (uint)azeriteEssencePower.Tier)] = azeriteEssencePower;
|
||||
_azeriteEssencePowersByIdAndRank[((uint)azeriteEssencePower.AzeriteEssenceID, (uint)azeriteEssencePower.Tier)] = azeriteEssencePower;
|
||||
|
||||
foreach (AzeriteItemMilestonePowerRecord azeriteItemMilestonePower in CliDB.AzeriteItemMilestonePowerStorage.Values)
|
||||
_azeriteItemMilestonePowers.Add(azeriteItemMilestonePower);
|
||||
@@ -81,7 +84,25 @@ namespace Game.DataStorage
|
||||
_azeriteItemMilestonePowerByEssenceSlot[azeriteEssenceSlot] = azeriteItemMilestonePower;
|
||||
++azeriteEssenceSlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (AzeritePowerSetMemberRecord azeritePowerSetMember in CliDB.AzeritePowerSetMemberStorage.Values)
|
||||
if (CliDB.AzeritePowerStorage.ContainsKey(azeritePowerSetMember.AzeritePowerID))
|
||||
_azeritePowers.Add(azeritePowerSetMember.AzeritePowerSetID, azeritePowerSetMember);
|
||||
|
||||
foreach (AzeriteTierUnlockRecord azeriteTierUnlock in CliDB.AzeriteTierUnlockStorage.Values)
|
||||
{
|
||||
var key = (azeriteTierUnlock.AzeriteTierUnlockSetID, (ItemContext)azeriteTierUnlock.ItemCreationContext);
|
||||
|
||||
if (!_azeriteTierUnlockLevels.ContainsKey(key))
|
||||
_azeriteTierUnlockLevels[key] = new byte[SharedConst.MaxAzeriteEmpoweredTier];
|
||||
|
||||
_azeriteTierUnlockLevels[key][azeriteTierUnlock.Tier] = azeriteTierUnlock.AzeriteLevel;
|
||||
}
|
||||
|
||||
MultiMap<uint, AzeriteUnlockMappingRecord> azeriteUnlockMappings = new MultiMap<uint, AzeriteUnlockMappingRecord>();
|
||||
foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in CliDB.AzeriteUnlockMappingStorage.Values)
|
||||
azeriteUnlockMappings.Add(azeriteUnlockMapping.AzeriteUnlockMappingSetID, azeriteUnlockMapping);
|
||||
|
||||
foreach (CharacterFacialHairStylesRecord characterFacialStyle in CliDB.CharacterFacialHairStylesStorage.Values)
|
||||
_characterFacialHairStyles.Add(Tuple.Create(characterFacialStyle.RaceID, characterFacialStyle.SexID, (uint)characterFacialStyle.VariationID));
|
||||
@@ -286,6 +307,9 @@ namespace Game.DataStorage
|
||||
|
||||
CliDB.ItemXBonusTreeStorage.Clear();
|
||||
|
||||
foreach (var pair in _azeriteEmpoweredItems)
|
||||
LoadAzeriteEmpoweredItemUnlockMappings(azeriteUnlockMappings, pair.Key);
|
||||
|
||||
foreach (MapDifficultyRecord entry in CliDB.MapDifficultyStorage.Values)
|
||||
{
|
||||
if (!_mapDifficulties.ContainsKey(entry.MapID))
|
||||
@@ -745,6 +769,11 @@ namespace Game.DataStorage
|
||||
return _artifactPowerRanks.LookupByKey(Tuple.Create(artifactPowerId, rank));
|
||||
}
|
||||
|
||||
public AzeriteEmpoweredItemRecord GetAzeriteEmpoweredItem(uint itemId)
|
||||
{
|
||||
return _azeriteEmpoweredItems.LookupByKey(itemId);
|
||||
}
|
||||
|
||||
public bool IsAzeriteItem(uint itemId)
|
||||
{
|
||||
return CliDB.AzeriteItemStorage.Any(pair => pair.Value.ItemID == itemId);
|
||||
@@ -766,6 +795,33 @@ namespace Game.DataStorage
|
||||
return _azeriteItemMilestonePowerByEssenceSlot[slot];
|
||||
}
|
||||
|
||||
public List<AzeritePowerSetMemberRecord> GetAzeritePowers(uint itemId)
|
||||
{
|
||||
AzeriteEmpoweredItemRecord azeriteEmpoweredItem = GetAzeriteEmpoweredItem(itemId);
|
||||
if (azeriteEmpoweredItem != null)
|
||||
return _azeritePowers.LookupByKey(azeriteEmpoweredItem.AzeritePowerSetID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public uint GetRequiredAzeriteLevelForAzeritePowerTier(uint azeriteUnlockSetId, ItemContext context, uint tier)
|
||||
{
|
||||
//ASSERT(tier < MAX_AZERITE_EMPOWERED_TIER);
|
||||
var levels = _azeriteTierUnlockLevels.LookupByKey((azeriteUnlockSetId, context));
|
||||
if (levels != null)
|
||||
return levels[tier];
|
||||
|
||||
AzeriteTierUnlockSetRecord azeriteTierUnlockSet = CliDB.AzeriteTierUnlockSetStorage.LookupByKey(azeriteUnlockSetId);
|
||||
if (azeriteTierUnlockSet != null && azeriteTierUnlockSet.Flags.HasAnyFlag(AzeriteTierUnlockSetFlags.Default))
|
||||
{
|
||||
levels = _azeriteTierUnlockLevels.LookupByKey((azeriteUnlockSetId, ItemContext.None));
|
||||
if (levels != null)
|
||||
return levels[tier];
|
||||
}
|
||||
|
||||
return (uint)CliDB.AzeriteLevelInfoStorage.Count;
|
||||
}
|
||||
|
||||
public string GetBroadcastTextValue(BroadcastTextRecord broadcastText, LocaleConstant locale = LocaleConstant.enUS, Gender gender = Gender.Male, bool forceGender = false)
|
||||
{
|
||||
if ((gender == Gender.Female || gender == Gender.None) && (forceGender || broadcastText.Text1.HasString(SharedConst.DefaultLocale)))
|
||||
@@ -1208,12 +1264,65 @@ namespace Game.DataStorage
|
||||
bonusListIDs.Add(itemSelectorQuality.QualityItemBonusListID);
|
||||
}
|
||||
}
|
||||
|
||||
AzeriteUnlockMappingRecord azeriteUnlockMapping = _azeriteUnlockMappings.LookupByKey((proto.Id, itemContext));
|
||||
if (azeriteUnlockMapping != null)
|
||||
{
|
||||
switch (proto.inventoryType)
|
||||
{
|
||||
case InventoryType.Head:
|
||||
bonusListIDs.Add(azeriteUnlockMapping.ItemBonusListHead);
|
||||
break;
|
||||
case InventoryType.Shoulders:
|
||||
bonusListIDs.Add(azeriteUnlockMapping.ItemBonusListShoulders);
|
||||
break;
|
||||
case InventoryType.Chest:
|
||||
case InventoryType.Robe:
|
||||
bonusListIDs.Add(azeriteUnlockMapping.ItemBonusListChest);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return bonusListIDs;
|
||||
}
|
||||
|
||||
void LoadAzeriteEmpoweredItemUnlockMappings(MultiMap<uint, AzeriteUnlockMappingRecord> azeriteUnlockMappingsBySet, uint itemId)
|
||||
{
|
||||
ItemSparseRecord proto = CliDB.ItemSparseStorage.LookupByKey(itemId);
|
||||
if (proto == null)
|
||||
return;
|
||||
|
||||
VisitItemBonusTree(itemId, bonusTreeNode =>
|
||||
{
|
||||
if (bonusTreeNode.ChildItemBonusListID == 0 && bonusTreeNode.ChildItemLevelSelectorID != 0)
|
||||
{
|
||||
ItemLevelSelectorRecord selector = CliDB.ItemLevelSelectorStorage.LookupByKey(bonusTreeNode.ChildItemLevelSelectorID);
|
||||
if (selector == null)
|
||||
return;
|
||||
|
||||
var azeriteUnlockMappings = azeriteUnlockMappingsBySet.LookupByKey(selector.AzeriteUnlockMappingSet);
|
||||
if (azeriteUnlockMappings != null)
|
||||
{
|
||||
AzeriteUnlockMappingRecord selectedAzeriteUnlockMapping = null;
|
||||
foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in azeriteUnlockMappings)
|
||||
{
|
||||
if (azeriteUnlockMapping.ItemLevel > selector.MinItemLevel ||
|
||||
(selectedAzeriteUnlockMapping != null && selectedAzeriteUnlockMapping.ItemLevel > azeriteUnlockMapping.ItemLevel))
|
||||
continue;
|
||||
|
||||
selectedAzeriteUnlockMapping = azeriteUnlockMapping;
|
||||
}
|
||||
|
||||
if (selectedAzeriteUnlockMapping != null)
|
||||
_azeriteUnlockMappings[(proto.Id, (ItemContext)bonusTreeNode.ItemContext)] = selectedAzeriteUnlockMapping;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ItemChildEquipmentRecord GetItemChildEquipment(uint itemId)
|
||||
{
|
||||
return _itemChildEquipment.LookupByKey(itemId);
|
||||
@@ -1988,9 +2097,13 @@ namespace Game.DataStorage
|
||||
MultiMap<uint, ArtifactPowerRecord> _artifactPowers = new MultiMap<uint, ArtifactPowerRecord>();
|
||||
MultiMap<uint, uint> _artifactPowerLinks = new MultiMap<uint, uint>();
|
||||
Dictionary<Tuple<uint, byte>, ArtifactPowerRankRecord> _artifactPowerRanks = new Dictionary<Tuple<uint, byte>, ArtifactPowerRankRecord>();
|
||||
Dictionary<Tuple<uint, uint>, AzeriteEssencePowerRecord> _azeriteEssencePowersByIdAndRank = new Dictionary<Tuple<uint, uint>, AzeriteEssencePowerRecord>();
|
||||
Dictionary<uint, AzeriteEmpoweredItemRecord> _azeriteEmpoweredItems = new Dictionary<uint, AzeriteEmpoweredItemRecord>();
|
||||
Dictionary<(uint azeriteEssenceId, uint rank), AzeriteEssencePowerRecord> _azeriteEssencePowersByIdAndRank = new Dictionary<(uint azeriteEssenceId, uint rank), AzeriteEssencePowerRecord>();
|
||||
List<AzeriteItemMilestonePowerRecord> _azeriteItemMilestonePowers = new List<AzeriteItemMilestonePowerRecord>();
|
||||
AzeriteItemMilestonePowerRecord[] _azeriteItemMilestonePowerByEssenceSlot = new AzeriteItemMilestonePowerRecord[SharedConst.MaxAzeriteEssenceSlot];
|
||||
MultiMap<uint, AzeritePowerSetMemberRecord> _azeritePowers = new MultiMap<uint, AzeritePowerSetMemberRecord>();
|
||||
Dictionary<(uint azeriteUnlockSetId, ItemContext itemContext), byte[]> _azeriteTierUnlockLevels = new Dictionary<(uint azeriteUnlockSetId, ItemContext itemContext), byte[]>();
|
||||
Dictionary<(uint itemId, ItemContext itemContext), AzeriteUnlockMappingRecord> _azeriteUnlockMappings = new Dictionary<(uint itemId, ItemContext itemContext), AzeriteUnlockMappingRecord>();
|
||||
List<Tuple<byte, byte, uint>> _characterFacialHairStyles = new List<Tuple<byte, byte, uint>>();
|
||||
MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, CharSectionsRecord> _charSections = new MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, CharSectionsRecord>();
|
||||
Dictionary<uint, CharStartOutfitRecord> _charStartOutfits = new Dictionary<uint, CharStartOutfitRecord>();
|
||||
|
||||
@@ -254,17 +254,25 @@ namespace Game.DataStorage
|
||||
public byte ConsignmentRate;
|
||||
}
|
||||
|
||||
public sealed class AzeriteEmpoweredItemRecord
|
||||
{
|
||||
public uint Id;
|
||||
public uint ItemID;
|
||||
public uint AzeriteTierUnlockSetID;
|
||||
public uint AzeritePowerSetID;
|
||||
}
|
||||
|
||||
public sealed class AzeriteEssenceRecord
|
||||
{
|
||||
public string Name;
|
||||
public string Description;
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public int SpecSetID;
|
||||
}
|
||||
|
||||
public sealed class AzeriteEssencePowerRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public string SourceAlliance;
|
||||
public string SourceHorde;
|
||||
public int AzeriteEssenceID;
|
||||
@@ -277,13 +285,13 @@ namespace Game.DataStorage
|
||||
|
||||
public sealed class AzeriteItemRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public uint ItemID;
|
||||
}
|
||||
|
||||
public sealed class AzeriteItemMilestonePowerRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public int RequiredLevel;
|
||||
public int AzeritePowerID;
|
||||
public int Type;
|
||||
@@ -292,13 +300,13 @@ namespace Game.DataStorage
|
||||
|
||||
public sealed class AzeriteKnowledgeMultiplierRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public float Multiplier;
|
||||
}
|
||||
|
||||
public sealed class AzeriteLevelInfoRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public ulong BaseExperienceToNextLevel;
|
||||
public ulong MinimumExperienceToNextLevel;
|
||||
public uint ItemLevel;
|
||||
@@ -306,10 +314,45 @@ namespace Game.DataStorage
|
||||
|
||||
public sealed class AzeritePowerRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public uint SpellID;
|
||||
public int ItemBonusListID;
|
||||
public uint ItemBonusListID;
|
||||
public int SpecSetID;
|
||||
public int Flags;
|
||||
}
|
||||
|
||||
public sealed class AzeritePowerSetMemberRecord
|
||||
{
|
||||
public uint Id;
|
||||
public uint AzeritePowerSetID;
|
||||
public int AzeritePowerID;
|
||||
public int Class;
|
||||
public int Tier;
|
||||
public uint OrderIndex;
|
||||
}
|
||||
|
||||
public sealed class AzeriteTierUnlockRecord
|
||||
{
|
||||
public uint Id;
|
||||
public byte ItemCreationContext;
|
||||
public byte Tier;
|
||||
public byte AzeriteLevel;
|
||||
public uint AzeriteTierUnlockSetID;
|
||||
}
|
||||
|
||||
public sealed class AzeriteTierUnlockSetRecord
|
||||
{
|
||||
public uint Id;
|
||||
public AzeriteTierUnlockSetFlags Flags;
|
||||
}
|
||||
|
||||
public sealed class AzeriteUnlockMappingRecord
|
||||
{
|
||||
public uint Id;
|
||||
public int ItemLevel;
|
||||
public uint ItemBonusListHead;
|
||||
public uint ItemBonusListShoulders;
|
||||
public uint ItemBonusListChest;
|
||||
public uint AzeriteUnlockMappingSetID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace Game.DataStorage
|
||||
{
|
||||
public TaxiPathBySourceAndDestination(uint _id, uint _price)
|
||||
{
|
||||
ID = _id;
|
||||
Id = _id;
|
||||
price = _price;
|
||||
}
|
||||
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public uint price;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Game.DataStorage
|
||||
|
||||
public sealed class SpecSetMemberRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint Id;
|
||||
public uint ChrSpecializationID;
|
||||
public uint SpecSetID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user