29 lines
1.2 KiB
C#
29 lines
1.2 KiB
C#
namespace Harmony.EquipmentPatches
|
|
{
|
|
[HarmonyPatch(typeof(Equipment))]
|
|
[HarmonyPatch("ModifyValue")]
|
|
public class ModifyValuePatch
|
|
{
|
|
public static bool Prefix(Equipment __instance, ItemValue _originalItemValue, PassiveEffects _passiveEffect, ref float _base_val, ref float _perc_val, FastTags<TagGroup.Global> tags, bool _useDurability)
|
|
{
|
|
for (int index = 0; index < __instance.m_slots.Length; ++index)
|
|
{
|
|
ItemValue slot = __instance.m_slots[index];
|
|
if (slot != null && !slot.Equals(_originalItemValue) && slot.ItemClass != null)
|
|
{
|
|
//Log.Out("EquipmentPatches-ModifyValue slot: " + slot.ItemClass.Name);
|
|
//Log.Out("EquipmentPatches-ModifyValue PercentUsesLeft: " + slot.PercentUsesLeft);
|
|
|
|
if (slot.PercentUsesLeft > 0)
|
|
{
|
|
//Log.Out("EquipmentPatches-ModifyValue OVER ZERO");
|
|
slot.ModifyValue(__instance.m_entity, _originalItemValue, _passiveEffect, ref _base_val, ref _perc_val, tags, _useDurability: !RebirthUtilities.ScenarioSkip());
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|