Files
zzz_REBIRTH__Utils/Harmony/Harmony_Inventory.cs
2025-06-04 16:44:53 +09:30

43 lines
1.5 KiB
C#

namespace Harmony.InventoryRebirth
{
internal class InventoryPatches
{
[HarmonyPatch(typeof(Inventory))]
[HarmonyPatch("PUBLIC_SLOTS")]
[HarmonyPatch(MethodType.Getter)]
public static class PUBLIC_SLOTSPatch
{
public static void Postfix(Inventory __instance, ref int __result
)
{
__result = 20;
}
}
[HarmonyPatch(typeof(Inventory))]
[HarmonyPatch("updateHoldingItem")]
public class updateHoldingItem
{
public static bool Prefix(Inventory __instance,
global::EntityAlive ___entity
)
{
//Log.Out("InventoryPatches-updateHoldingItem START");
if (___entity is EntityPlayer)
{
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
if (primaryPlayer != null && primaryPlayer.entityId == ___entity.entityId)
{
//Log.Out("InventoryPatches-updateHoldingItem ___entity: " + ___entity.EntityName);
RebirthUtilities.checkCraftingProgression(__instance, ___entity);
RebirthVariables.isCraftableItem = RebirthUtilities.IsCraftableItem();
}
}
return true;
}
}
}
}