using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("StealInShop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StealInShop")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("634f7cfe-b5ad-46c2-89fd-b61224a48025")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StealInShop;
[BepInPlugin("com.repo.kr.StealInShop", "StealInShop", "1.0.0")]
public class ModBehaviour : BaseUnityPlugin
{
public enum CustomNetworkEvents
{
RequestInstantiateRoomObject = 100
}
[HarmonyPatch(typeof(LoadBalancingClient))]
public class LoadBalancingClient_path
{
[HarmonyPatch("OnEvent")]
[HarmonyPostfix]
private static void OnEvent_Postfix(EventData photonEvent)
{
if (PhotonNetwork.IsMasterClient && photonEvent.Code == 100)
{
object[] array = (object[])photonEvent.CustomData;
string text = (string)array[0];
StatsManager.instance.ItemPurchase(text);
}
}
}
[HarmonyPatch(typeof(InventoryUI), "Update")]
public class InventoryUI_path
{
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Call && list[i].operand is MethodInfo methodInfo && methodInfo.Name == "RunIsShop")
{
Debug.Log((object)"find RunIsShop");
list.Insert(i, new CodeInstruction(OpCodes.Ret, (object)null));
break;
}
}
return list;
}
}
[HarmonyPatch(typeof(RunManager))]
public static class RunManager_path
{
[HarmonyPatch("ChangeLevel")]
[HarmonyPrefix]
private static void ChangeLevel_Prefix()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
foreach (KeyValuePair<int, ItemAttributes> item2 in playerInventorySpot)
{
ItemAttributes value = item2.Value;
Transform transform = ((Component)Camera.main).transform;
Vector3 val = transform.position + transform.forward * 2f;
Item item = value.item;
if (SemiFunc.IsMultiplayer())
{
object[] array = new object[3]
{
((Object)item).name,
item.prefab.ResourcePath,
val
};
PhotonNetwork.RaiseEvent((byte)100, (object)array, new RaiseEventOptions
{
Receivers = (ReceiverGroup)2
}, SendOptions.SendReliable);
}
else
{
StatsManager.instance.ItemPurchase(((Object)item).name);
}
Log.LogInfo((object)("steal item name:" + ((Object)item).name));
}
playerInventorySpot.Clear();
}
}
[HarmonyPatch(typeof(InventorySpot))]
public class InventorySpot_path
{
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static void Update_Prefix(InventorySpot __instance)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
if (!__instance.IsOccupied() && SemiFunc.RunIsShop() && ((SemiFunc.InputDown((InputKey)19) && __instance.inventorySpotIndex == 0) || (SemiFunc.InputDown((InputKey)20) && __instance.inventorySpotIndex == 1) || (SemiFunc.InputDown((InputKey)21) && __instance.inventorySpotIndex == 2)) && PhysGrabber.instance.grabbed)
{
FieldInfo field = typeof(PhysGrabber).GetField("grabbedPhysGrabObject", BindingFlags.Instance | BindingFlags.NonPublic);
PhysGrabObject val = (PhysGrabObject)field.GetValue(PhysGrabber.instance);
ItemAttributes component = ((Component)val).GetComponent<ItemAttributes>();
if (playerInventorySpot.ContainsKey(__instance.inventorySpotIndex))
{
playerInventorySpot[__instance.inventorySpotIndex] = component;
}
else
{
playerInventorySpot.Add(__instance.inventorySpotIndex, component);
}
}
}
}
private Harmony harmony;
private static ManualLogSource Log;
private static Dictionary<int, ItemAttributes> playerInventorySpot = new Dictionary<int, ItemAttributes>();
private void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
harmony = new Harmony("com.repo.kr.StealInShop");
harmony.PatchAll();
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"StealInShop enble");
}
}