Core/Items: Implement new item bonus types
Port From (https://github.com/TrinityCore/TrinityCore/commit/3d9e21193dd9f7d5f38a7a8edb3d6f6f8daa1867)
This commit is contained in:
@@ -345,7 +345,9 @@ namespace Framework.Constants
|
|||||||
RandomEnchantment = 15, // Responsible for showing "<Random additional stats>" or "+%d Rank Random Minor Trait" in the tooltip before item is obtained
|
RandomEnchantment = 15, // Responsible for showing "<Random additional stats>" or "+%d Rank Random Minor Trait" in the tooltip before item is obtained
|
||||||
Bounding = 16,
|
Bounding = 16,
|
||||||
RelicType = 17,
|
RelicType = 17,
|
||||||
OverrideRequiredLevel = 18
|
OverrideRequiredLevel = 18,
|
||||||
|
OverrideCanDisenchant = 21,
|
||||||
|
OverrideCanScrap = 22
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ItemContext : byte
|
public enum ItemContext : byte
|
||||||
|
|||||||
@@ -1957,6 +1957,9 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public ItemDisenchantLootRecord GetDisenchantLoot(Player owner)
|
public ItemDisenchantLootRecord GetDisenchantLoot(Player owner)
|
||||||
{
|
{
|
||||||
|
if (!_bonusData.CanDisenchant)
|
||||||
|
return null;
|
||||||
|
|
||||||
return GetDisenchantLoot(GetTemplate(), (uint)GetQuality(), GetItemLevel(owner));
|
return GetDisenchantLoot(GetTemplate(), (uint)GetQuality(), GetItemLevel(owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2834,9 +2837,10 @@ namespace Game.Entities
|
|||||||
RepairCostMultiplier = 1.0f;
|
RepairCostMultiplier = 1.0f;
|
||||||
ScalingStatDistribution = proto.GetScalingStatDistribution();
|
ScalingStatDistribution = proto.GetScalingStatDistribution();
|
||||||
RelicType = -1;
|
RelicType = -1;
|
||||||
HasItemLevelBonus = false;
|
|
||||||
HasFixedLevel = false;
|
HasFixedLevel = false;
|
||||||
RequiredLevelOverride = 0;
|
RequiredLevelOverride = 0;
|
||||||
|
CanDisenchant = !proto.GetFlags().HasAnyFlag(ItemFlags.NoDisenchant);
|
||||||
|
CanScrap = proto.GetFlags4().HasAnyFlag(ItemFlags4.Scrapable);
|
||||||
|
|
||||||
_state.AppearanceModPriority = int.MaxValue;
|
_state.AppearanceModPriority = int.MaxValue;
|
||||||
_state.ScalingStatDistributionPriority = int.MaxValue;
|
_state.ScalingStatDistributionPriority = int.MaxValue;
|
||||||
@@ -2865,7 +2869,6 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
case ItemBonusType.ItemLevel:
|
case ItemBonusType.ItemLevel:
|
||||||
ItemLevelBonus += values[0];
|
ItemLevelBonus += values[0];
|
||||||
HasItemLevelBonus = true;
|
|
||||||
break;
|
break;
|
||||||
case ItemBonusType.Stat:
|
case ItemBonusType.Stat:
|
||||||
{
|
{
|
||||||
@@ -2935,6 +2938,12 @@ namespace Game.Entities
|
|||||||
case ItemBonusType.OverrideRequiredLevel:
|
case ItemBonusType.OverrideRequiredLevel:
|
||||||
RequiredLevelOverride = values[0];
|
RequiredLevelOverride = values[0];
|
||||||
break;
|
break;
|
||||||
|
case ItemBonusType.OverrideCanDisenchant:
|
||||||
|
CanDisenchant = values[0] != 0;
|
||||||
|
break;
|
||||||
|
case ItemBonusType.OverrideCanScrap:
|
||||||
|
CanScrap = values[0] != 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2956,7 +2965,8 @@ namespace Game.Entities
|
|||||||
public ushort[] GemRelicRankBonus = new ushort[ItemConst.MaxGemSockets];
|
public ushort[] GemRelicRankBonus = new ushort[ItemConst.MaxGemSockets];
|
||||||
public int RelicType;
|
public int RelicType;
|
||||||
public int RequiredLevelOverride;
|
public int RequiredLevelOverride;
|
||||||
public bool HasItemLevelBonus;
|
public bool CanDisenchant;
|
||||||
|
public bool CanScrap;
|
||||||
public bool HasFixedLevel;
|
public bool HasFixedLevel;
|
||||||
State _state;
|
State _state;
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ namespace Game.Entities
|
|||||||
public ItemFlags GetFlags() { return (ItemFlags)ExtendedData.Flags[0]; }
|
public ItemFlags GetFlags() { return (ItemFlags)ExtendedData.Flags[0]; }
|
||||||
public ItemFlags2 GetFlags2() { return (ItemFlags2)ExtendedData.Flags[1]; }
|
public ItemFlags2 GetFlags2() { return (ItemFlags2)ExtendedData.Flags[1]; }
|
||||||
public ItemFlags3 GetFlags3() { return (ItemFlags3)ExtendedData.Flags[2]; }
|
public ItemFlags3 GetFlags3() { return (ItemFlags3)ExtendedData.Flags[2]; }
|
||||||
public uint GetFlags4() { return ExtendedData.Flags[3]; }
|
public ItemFlags4 GetFlags4() { return (ItemFlags4)ExtendedData.Flags[3]; }
|
||||||
public float GetPriceRandomValue() { return ExtendedData.PriceRandomValue; }
|
public float GetPriceRandomValue() { return ExtendedData.PriceRandomValue; }
|
||||||
public float GetPriceVariance() { return ExtendedData.PriceVariance; }
|
public float GetPriceVariance() { return ExtendedData.PriceVariance; }
|
||||||
public uint GetBuyCount() { return Math.Max(ExtendedData.VendorStackCount, 1u); }
|
public uint GetBuyCount() { return Math.Max(ExtendedData.VendorStackCount, 1u); }
|
||||||
|
|||||||
@@ -2673,6 +2673,8 @@ namespace Game.Groups
|
|||||||
{
|
{
|
||||||
ItemInstance itemInstance = new ItemInstance(lootItemInSlot);
|
ItemInstance itemInstance = new ItemInstance(lootItemInSlot);
|
||||||
BonusData bonusData = new BonusData(itemInstance);
|
BonusData bonusData = new BonusData(itemInstance);
|
||||||
|
if (!bonusData.CanDisenchant)
|
||||||
|
return null;
|
||||||
|
|
||||||
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemid);
|
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemid);
|
||||||
uint itemLevel = Item.GetItemLevel(itemTemplate, bonusData, player.GetLevel(), 0, 0, 0, 0, false, 0);
|
uint itemLevel = Item.GetItemLevel(itemTemplate, bonusData, player.GetLevel(), 0, 0, 0, 0, false, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user