using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Windows.Forms;
using BepInEx;
using BepInEx.Logging;
using FirstMod.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FirstMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("FirstMod")]
[assembly: AssemblyCopyright("Copyright © HP 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4f25ac1c-1979-47e3-8aae-72dbc7ad0c2c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FirstMod
{
[BepInPlugin("POOPMAN.RICKSPICKLES", "RICKSPICKLES", "1.0.0")]
public class FirstMod : BaseUnityPlugin
{
private const string modGUID = "POOPMAN.RICKSPICKLES";
private const string modName = "RICKSPICKLES";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("POOPMAN.RICKSPICKLES");
public static FirstMod instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("POOPMAN.RICKSPICKLES");
mls.LogInfo((object)"I have awaken");
harmony.PatchAll(typeof(FirstMod));
harmony.PatchAll(typeof(OnlyGoldBars));
harmony.PatchAll(typeof(ScanPatch));
}
}
}
namespace FirstMod.Patches
{
public class FlashButton : LcInputActions
{
[InputAction("<Keyboard>/f", Name = "Flashlight")]
public InputAction InputKey { get; set; }
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class Input
{
public static FirstMod firstModInstance = FirstMod.instance;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void jumpPatch(ref bool ___isSprinting, ref Transform ___playerEye, ref bool ___isInHangarShipRoom)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if (!___isInHangarShipRoom)
{
Vector3 eulerAngles = ___playerEye.eulerAngles;
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class ItemList
{
public static FirstMod firstModInstance = FirstMod.instance;
[HarmonyPatch("LoadShipGrabbableItems")]
[HarmonyPostfix]
private static void listItems(ref AllItemsList ___allItemsList)
{
firstModInstance.mls.LogInfo((object)"I HAVE RUN");
for (int i = 0; i < ___allItemsList.itemsList.Count; i++)
{
firstModInstance.mls.LogInfo((object)___allItemsList.itemsList[i].itemName);
}
}
}
internal class Canvas : Form
{
public Canvas()
{
((Control)this).DoubleBuffered = true;
}
}
internal class MapWindow
{
private Vector2 Screensize;
private string Title;
private Canvas Window;
private Thread GameThread;
public int GameState = 0;
private Vector2 Scale = new Vector2(50f, 50f);
private Vector2 Position = new Vector2(25f, 25f);
private float Heading = 270f;
private Brush Visual;
private Rectangle Player;
public MapWindow(Vector2 Screensize, string Title)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
this.Screensize = Screensize;
this.Title = Title;
Visual = (Brush)new SolidBrush(Color.White);
Player = new Rectangle((int)Position.X, (int)Position.Y, (int)Scale.X, (int)Scale.Y);
Canvas canvas = new Canvas();
((Form)canvas).Size = new Size((int)this.Screensize.X, (int)this.Screensize.Y);
((Control)canvas).Text = this.Title;
Window = canvas;
((Control)Window).Paint += new PaintEventHandler(Window_Paint);
GameThread = new Thread(GameLoop);
GameThread.Start();
Application.Run((Form)(object)Window);
}
public void Move()
{
Position.X += 1f;
}
private void Update(Graphics window)
{
GraphicsState val = window.Save();
window.TranslateTransform(Position.X + Scale.X / 2f, Position.Y + Scale.Y / 2f);
window.RotateTransform(Heading);
window.TranslateTransform(0f - (Position.X + Scale.X / 2f), 0f - (Position.Y + Scale.Y / 2f));
window.FillRectangle(Visual, Position.X, Position.Y, Scale.X, Scale.Y);
window.Restore(val);
}
private void Window_Paint(object sender, PaintEventArgs e)
{
Graphics graphics = e.Graphics;
graphics.Clear(Color.Black);
try
{
Update(graphics);
}
catch
{
}
}
private void GameLoop()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
GameState = 1;
while (GameState == 1)
{
try
{
((Control)Window).BeginInvoke((Delegate)(MethodInvoker)delegate
{
((Control)Window).Refresh();
});
Thread.Sleep(6);
}
catch
{
}
}
}
}
[HarmonyPatch(typeof(RoundManager))]
internal class OnlyGoldBars
{
public static FirstMod firstModInstance = FirstMod.instance;
[HarmonyPatch("LoadNewLevel")]
[HarmonyPrefix]
private static bool Only_Gold_Bars(ref SelectableLevel newLevel)
{
bool flag = false;
try
{
foreach (SpawnableItemWithRarity item in newLevel.spawnableScrap)
{
firstModInstance.mls.LogInfo((object)item.spawnableItem.itemName);
item.rarity = 0;
if (item.spawnableItem.itemName == "Jar of pickles")
{
firstModInstance.mls.LogInfo((object)"FOUND PICKLES");
item.spawnableItem.minValue = 100;
item.spawnableItem.maxValue = 5000;
flag = true;
}
}
}
catch (Exception)
{
}
return true;
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void infiniteSprintPatch(ref float ___sprintMeter)
{
___sprintMeter = 1f;
}
}
[HarmonyPatch(typeof(HUDManager))]
internal class ScanPatch
{
public static FirstMod firstModInstance = FirstMod.instance;
private static TextMeshProUGUI _textMesh;
[HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")]
[HarmonyPostfix]
private static void PrintScanNodesName(ref RectTransform[] ___scanElements)
{
for (int i = 0; i < ___scanElements.Length; i++)
{
TextMeshProUGUI[] componentsInChildren = ((Component)___scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>();
if (componentsInChildren.Length > 1 && ((TMP_Text)componentsInChildren[0]).text == "Jar of pickles")
{
((TMP_Text)componentsInChildren[0]).text = "Ricks' Pickles";
}
}
}
}
}