Core/Items: Implemented new item bonus types: ITEM_BONUS_OVERRIDE_CAN_SALVAGE, ITEM_BONUS_OVERRIDE_CAN_RECRAFT, ITEM_BONUS_OVERRIDE_CANNOT_TRADE_BOP and ITEM_BONUS_ITEM_LEVEL_BASE

Port From (https://github.com/TrinityCore/TrinityCore/commit/d82b3641db0c8243330ac33bfa15bdf337e0e8ec)
This commit is contained in:
Hondacrx
2025-12-08 16:17:17 -05:00
parent f01f61c464
commit ed33a88776
3 changed files with 70 additions and 34 deletions
+8
View File
@@ -460,14 +460,22 @@ namespace Framework.Constants
ItemEffectId = 23, ItemEffectId = 23,
ModifiedCraftingStat = 25, ModifiedCraftingStat = 25,
RequiredLevelCurve = 27, RequiredLevelCurve = 27,
IconFileDataID = 28,
DescriptionText = 30, // Item Description DescriptionText = 30, // Item Description
OverrideName = 31, // Itemnamedescription Id OverrideName = 31, // Itemnamedescription Id
UpgradeSequenceValue = 33,
ItemBonusListGroup = 34, ItemBonusListGroup = 34,
ItemLimitCategory = 35, ItemLimitCategory = 35,
PvpItemLevelIncrement = 36, PvpItemLevelIncrement = 36,
ItemConversion = 37, ItemConversion = 37,
ItemHistorySlot = 38, ItemHistorySlot = 38,
OverrideCanSalvage = 39,
OverrideCanRecraft = 41,
ItemLevelBase = 42,
PvpItemLevelBase = 43, PvpItemLevelBase = 43,
CosmeticStat = 44,
OverrideDescriptionColor = 45, // Overrides color of item description and upgrade track if TimeEvent from value[1] has passed
OverrideCannotTradeBop = 46,
BondingWithPriority = 47, BondingWithPriority = 47,
} }
+59 -33
View File
@@ -1122,7 +1122,7 @@ namespace Game.Entities
foreach (var bonusListId in gem.BonusListIDs) foreach (var bonusListId in gem.BonusListIDs)
gemBonus.AddBonusList(bonusListId); gemBonus.AddBonusList(bonusListId);
uint gemBaseItemLevel = gemTemplate.GetBaseItemLevel(); uint gemBaseItemLevel = gemBonus.ItemLevel;
if (gemBonus.PlayerLevelToItemLevelCurveId != 0) if (gemBonus.PlayerLevelToItemLevelCurveId != 0)
{ {
uint scaledIlvl = (uint)Global.DB2Mgr.GetCurveValueAt(gemBonus.PlayerLevelToItemLevelCurveId, gemScalingLevel); uint scaledIlvl = (uint)Global.DB2Mgr.GetCurveValueAt(gemBonus.PlayerLevelToItemLevelCurveId, gemScalingLevel);
@@ -1824,7 +1824,7 @@ namespace Game.Entities
if (itemTemplate == null) if (itemTemplate == null)
return 1; return 1;
uint itemLevel = itemTemplate.GetBaseItemLevel(); uint itemLevel = bonusData.ItemLevel;
AzeriteLevelInfoRecord azeriteLevelInfo = CliDB.AzeriteLevelInfoStorage.LookupByKey(azeriteLevel); AzeriteLevelInfoRecord azeriteLevelInfo = CliDB.AzeriteLevelInfoStorage.LookupByKey(azeriteLevel);
if (azeriteLevelInfo != null) if (azeriteLevelInfo != null)
itemLevel = azeriteLevelInfo.ItemLevel; itemLevel = azeriteLevelInfo.ItemLevel;
@@ -2904,12 +2904,48 @@ namespace Game.Entities
public class BonusData public class BonusData
{ {
public ItemQuality Quality;
public uint ItemLevel;
public int ItemLevelBonus;
public int RequiredLevel;
public int[] ItemStatType = new int[ItemConst.MaxStats];
public int[] StatPercentEditor = new int[ItemConst.MaxStats];
public float[] ItemStatSocketCostMultiplier = new float[ItemConst.MaxStats];
public uint[] socketColor = new uint[ItemConst.MaxGemSockets];
public ItemBondingType Bonding;
public uint AppearanceModID;
public float RepairCostMultiplier;
public uint ContentTuningId;
public uint PlayerLevelToItemLevelCurveId;
public uint DisenchantLootId;
public uint[] GemItemLevelBonus = new uint[ItemConst.MaxGemSockets];
public int[] GemRelicType = new int[ItemConst.MaxGemSockets];
public ushort[] GemRelicRankBonus = new ushort[ItemConst.MaxGemSockets];
public int RelicType;
public int RequiredLevelOverride;
public uint AzeriteTierUnlockSetId;
public uint Suffix;
public uint RequiredLevelCurve;
public ushort PvpItemLevel;
public short PvpItemLevelBonus;
public ItemEffectRecord[] Effects = new ItemEffectRecord[13];
public int EffectCount;
public uint LimitCategory;
public bool CanDisenchant;
public bool CanScrap;
public bool CanSalvage;
public bool CanRecraft;
public bool HasFixedLevel;
public bool CannotTradeBindOnPickup;
State _state;
public BonusData(ItemTemplate proto) public BonusData(ItemTemplate proto)
{ {
if (proto == null) if (proto == null)
return; return;
Quality = proto.GetQuality(); Quality = proto.GetQuality();
ItemLevel = proto.GetBaseItemLevel();
ItemLevelBonus = 0; ItemLevelBonus = 0;
RequiredLevel = proto.GetBaseRequiredLevel(); RequiredLevel = proto.GetBaseRequiredLevel();
for (uint i = 0; i < ItemConst.MaxStats; ++i) for (uint i = 0; i < ItemConst.MaxStats; ++i)
@@ -2953,6 +2989,9 @@ namespace Game.Entities
CanDisenchant = !proto.HasFlag(ItemFlags.NoDisenchant); CanDisenchant = !proto.HasFlag(ItemFlags.NoDisenchant);
CanScrap = proto.HasFlag(ItemFlags4.Scrapable); CanScrap = proto.HasFlag(ItemFlags4.Scrapable);
CanSalvage = !proto.HasFlag(ItemFlags4.NoSalvage);
CanRecraft = proto.HasFlag(ItemFlags4.Recraftable);
CannotTradeBindOnPickup = proto.HasFlag(ItemFlags2.NoTradeBindOnAcquire);
_state.SuffixPriority = int.MaxValue; _state.SuffixPriority = int.MaxValue;
_state.AppearanceModPriority = int.MaxValue; _state.AppearanceModPriority = int.MaxValue;
@@ -2960,6 +2999,7 @@ namespace Game.Entities
_state.ScalingStatDistributionPriority = int.MaxValue; _state.ScalingStatDistributionPriority = int.MaxValue;
_state.AzeriteTierUnlockSetPriority = int.MaxValue; _state.AzeriteTierUnlockSetPriority = int.MaxValue;
_state.RequiredLevelCurvePriority = int.MaxValue; _state.RequiredLevelCurvePriority = int.MaxValue;
_state.ItemLevelPriority = int.MaxValue;
_state.PvpItemLevelPriority = int.MaxValue; _state.PvpItemLevelPriority = int.MaxValue;
_state.BondingPriority = int.MaxValue; _state.BondingPriority = int.MaxValue;
} }
@@ -3105,6 +3145,19 @@ namespace Game.Entities
case ItemBonusType.PvpItemLevelIncrement: case ItemBonusType.PvpItemLevelIncrement:
PvpItemLevelBonus += (short)values[0]; PvpItemLevelBonus += (short)values[0];
break; break;
case ItemBonusType.OverrideCanSalvage:
CanSalvage = values[0] != 0;
break;
case ItemBonusType.OverrideCanRecraft:
CanRecraft = values[0] != 0;
break;
case ItemBonusType.ItemLevelBase:
if (values[1] < _state.ItemLevelPriority)
{
ItemLevel = (uint)values[0];
_state.ItemLevelPriority = values[1];
}
break;
case ItemBonusType.PvpItemLevelBase: case ItemBonusType.PvpItemLevelBase:
if (values[1] < _state.PvpItemLevelPriority) if (values[1] < _state.PvpItemLevelPriority)
{ {
@@ -3112,6 +3165,9 @@ namespace Game.Entities
_state.PvpItemLevelPriority = values[1]; _state.PvpItemLevelPriority = values[1];
} }
break; break;
case ItemBonusType.OverrideCannotTradeBop:
CannotTradeBindOnPickup = values[0] != 0;
break;
case ItemBonusType.BondingWithPriority: case ItemBonusType.BondingWithPriority:
if (values[1] < _state.BondingPriority) if (values[1] < _state.BondingPriority)
{ {
@@ -3122,37 +3178,6 @@ namespace Game.Entities
} }
} }
public ItemQuality Quality;
public int ItemLevelBonus;
public int RequiredLevel;
public int[] ItemStatType = new int[ItemConst.MaxStats];
public int[] StatPercentEditor = new int[ItemConst.MaxStats];
public float[] ItemStatSocketCostMultiplier = new float[ItemConst.MaxStats];
public uint[] socketColor = new uint[ItemConst.MaxGemSockets];
public ItemBondingType Bonding;
public uint AppearanceModID;
public float RepairCostMultiplier;
public uint ContentTuningId;
public uint PlayerLevelToItemLevelCurveId;
public uint DisenchantLootId;
public uint[] GemItemLevelBonus = new uint[ItemConst.MaxGemSockets];
public int[] GemRelicType = new int[ItemConst.MaxGemSockets];
public ushort[] GemRelicRankBonus = new ushort[ItemConst.MaxGemSockets];
public int RelicType;
public int RequiredLevelOverride;
public uint AzeriteTierUnlockSetId;
public uint Suffix;
public uint RequiredLevelCurve;
public ushort PvpItemLevel;
public short PvpItemLevelBonus;
public ItemEffectRecord[] Effects = new ItemEffectRecord[13];
public int EffectCount;
public uint LimitCategory;
public bool CanDisenchant;
public bool CanScrap;
public bool HasFixedLevel;
State _state;
struct State struct State
{ {
public int SuffixPriority; public int SuffixPriority;
@@ -3161,6 +3186,7 @@ namespace Game.Entities
public int ScalingStatDistributionPriority; public int ScalingStatDistributionPriority;
public int AzeriteTierUnlockSetPriority; public int AzeriteTierUnlockSetPriority;
public int RequiredLevelCurvePriority; public int RequiredLevelCurvePriority;
public int ItemLevelPriority;
public int PvpItemLevelPriority; public int PvpItemLevelPriority;
public int BondingPriority; public int BondingPriority;
public bool HasQualityBonus; public bool HasQualityBonus;
+3 -1
View File
@@ -1197,7 +1197,9 @@ namespace Game.Entities
UpdateCriteria(CriteriaType.ObtainAnyItem, itemId, count); UpdateCriteria(CriteriaType.ObtainAnyItem, itemId, count);
UpdateCriteria(CriteriaType.AcquireItem, itemId, count); UpdateCriteria(CriteriaType.AcquireItem, itemId, count);
if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound()) if (allowedLooters.Count > 1 && item.IsSoulBound()
&& (item.GetTemplate().GetMaxStackSize() == 1 || item.GetTemplate().HasFlag(ItemFlags2.CanTradeBindOnAcquire))
&& !item.GetBonus().CannotTradeBindOnPickup)
{ {
item.SetSoulboundTradeable(allowedLooters); item.SetSoulboundTradeable(allowedLooters);
AddTradeableItem(item); AddTradeableItem(item);