60 lines
2.5 KiB
C#
60 lines
2.5 KiB
C#
namespace Harmony.XUiC_CraftingInfoWindowPatches
|
|
{
|
|
[HarmonyPatch(typeof(XUiC_CraftingInfoWindow))]
|
|
[HarmonyPatch("GetBindingValue")]
|
|
public class GetBindingValuePatch
|
|
{
|
|
public static void Postfix(XUiC_CraftingInfoWindow __instance, ref string value, string bindingName)
|
|
{
|
|
if (bindingName == "durabilitytext")
|
|
{
|
|
if (__instance.recipe != null && __instance.recipe.GetOutputItemClass().ShowQualityBar)
|
|
{
|
|
if (__instance.recipe.GetName() == "meleeToolAxeT1IronFireaxe" || __instance.recipe.GetName() == "meleeToolAxeT2SteelAxe")
|
|
{
|
|
if (__instance.selectedCraftingTier > 5)
|
|
{
|
|
__instance.selectedCraftingTier = 5;
|
|
}
|
|
value = __instance.durabilitytextFormatter.Format(__instance.selectedCraftingTier);
|
|
}
|
|
}
|
|
}
|
|
else if (bindingName == "durabilitycolor")
|
|
{
|
|
if (__instance.recipe != null && __instance.recipe.GetOutputItemClass().ShowQualityBar)
|
|
{
|
|
if (__instance.recipe.GetName() == "meleeToolAxeT1IronFireaxe" || __instance.recipe.GetName() == "meleeToolAxeT2SteelAxe")
|
|
{
|
|
int craftingTier = __instance.selectedCraftingTier;
|
|
|
|
if (__instance.selectedCraftingTier > 5)
|
|
{
|
|
craftingTier = 5;
|
|
}
|
|
|
|
Color32 _v1_1 = (Color32)Color.white;
|
|
_v1_1 = (Color32)QualityInfo.GetTierColor(craftingTier);
|
|
value = __instance.durabilitycolorFormatter.Format(_v1_1);
|
|
}
|
|
}
|
|
}
|
|
else if (bindingName == "enableaddquality")
|
|
{
|
|
if (__instance.recipe != null && __instance.recipe.GetOutputItemClass().ShowQualityBar)
|
|
{
|
|
if (__instance.recipe.GetName() == "meleeToolAxeT1IronFireaxe" || __instance.recipe.GetName() == "meleeToolAxeT2SteelAxe")
|
|
{
|
|
int craftingTier = __instance.selectedCraftingTier;
|
|
|
|
if (__instance.selectedCraftingTier == 5)
|
|
{
|
|
value = "false";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|