first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using NitroxClient.GameLogic;
using NitroxModel.Helper;
using UnityEngine;
namespace NitroxPatcher.Patches.Dynamic;
public sealed partial class Equipment_RemoveItem_Patch : NitroxPatch, IDynamicPatch
{
public static readonly MethodInfo TARGET_METHOD = Reflect.Method((Equipment t) => t.RemoveItem(default(string), default(bool), default(bool)));
public static readonly OpCode INJECTION_OPCODE = OpCodes.Stloc_1;
public static IEnumerable<CodeInstruction> Transpiler(MethodBase original, IEnumerable<CodeInstruction> instructions)
{
foreach (CodeInstruction instruction in instructions)
{
yield return instruction;
if (instruction.opcode.Equals(INJECTION_OPCODE))
{
/*
* Multiplayer.Logic.EquipmentSlots.Unequip(pickupable, this.owner, slot)
*/
yield return TranspilerHelper.LocateService<EquipmentSlots>();
yield return new CodeInstruction(OpCodes.Ldloc_0);
yield return new CodeInstruction(OpCodes.Callvirt, Reflect.Property((InventoryItem t) => t.item).GetMethod);
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Call, Reflect.Property((Equipment t) => t.owner).GetMethod);
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Callvirt, Reflect.Method((EquipmentSlots t) => t.BroadcastUnequip(default(Pickupable), default(GameObject), default(string))));
}
}
}
}