44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
namespace Harmony.XUiC_TraderItemEntryPatches
|
|
{
|
|
[HarmonyPatch(typeof(XUiC_TraderItemEntry))]
|
|
[HarmonyPatch("GetBindingValue")]
|
|
public class GetBindingValuePatch
|
|
{
|
|
public static void Postfix(XUiC_TraderItemEntry __instance, bool __result, ref string value, string bindingName)
|
|
{
|
|
if (bindingName == "itemtypeicon")
|
|
{
|
|
if (RebirthUtilities.ScenarioSkip() && __instance.item != null && !__instance.item.IsEmpty())
|
|
{
|
|
ItemValue itemValue = __instance.item.itemValue;
|
|
|
|
if (itemValue != null &&
|
|
itemValue.HasMetadata("bonus") &&
|
|
itemValue.HasMetadata("level") &&
|
|
itemValue.HasMetadata("type") &&
|
|
itemValue.HasMetadata("active"))
|
|
{
|
|
value = (string)itemValue.GetMetadata("bonus");
|
|
}
|
|
}
|
|
}
|
|
else if (bindingName == "hasitemtypeicon")
|
|
{
|
|
if (RebirthUtilities.ScenarioSkip() && __instance.item != null && !__instance.item.IsEmpty())
|
|
{
|
|
ItemValue itemValue = __instance.item.itemValue;
|
|
|
|
if (itemValue != null &&
|
|
itemValue.HasMetadata("bonus") &&
|
|
itemValue.HasMetadata("level") &&
|
|
itemValue.HasMetadata("type") &&
|
|
itemValue.HasMetadata("active"))
|
|
{
|
|
value = "true";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|