using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atomicrops.Game.Data;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SharedLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RerollGuns")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RerollGuns")]
[assembly: AssemblyTitle("RerollGuns")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Template
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "RerollGuns";
public const string PLUGIN_NAME = "RerollGuns";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RerollGuns
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "pauli.plugin.RerollGuns";
public const string PLUGIN_NAME = "RerollGuns";
public const string PLUGIN_VERSION = "1.0.0";
}
[BepInPlugin("pauli.plugin.RerollGuns", "RerollGuns", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Log;
private void Awake()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"RerollGuns 1.0.0 is loaded!");
Harmony val = new Harmony("pauli.plugin.RerollGuns");
val.PatchAll();
}
}
public class MyUpdateComponent : MonoBehaviour
{
private GunShop gunShopComponent;
private int rerollCost = 0;
private GameObject explorerShop;
public int GetRerollCost()
{
return rerollCost;
}
public void SetRerollCost(int newCost)
{
rerollCost = newCost;
}
public void SetGunShopComponent(GunShop gunShop)
{
gunShopComponent = gunShop;
}
private void Update()
{
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyUp((KeyCode)114) && (Object)(object)gunShopComponent != (Object)null && SingletonScriptableObject<GameData>.I.Day.Get() > SingletonScriptableObject<GameData>.I.DidPurchaseGunOnDay && SingletonScriptableObject<GameData>.I.Money.Get() >= rerollCost)
{
SingletonScriptableObject<GameData>.I.Money.Add(-rerollCost);
rerollCost = (int)((double)rerollCost * 1.2);
gunShopComponent.Restock();
if ((Object)(object)explorerShop == (Object)null)
{
explorerShop = GameObject.Find("__MOVE_but_BE_CAREFUL__/ExplorerShop");
}
if ((Object)(object)explorerShop != (Object)null)
{
Vector2 val = Vector2.op_Implicit(explorerShop.transform.position + new Vector3(1f, 1f, 0f));
InGameText.StaticCost("Press \"R\" to reroll.", rerollCost.ToString(), val, (CostType)0);
}
else
{
Debug.LogError((object)"ExplorerShop GameObject not found.");
}
}
}
}
[HarmonyPatch(typeof(GunShop), "Awake")]
internal class GunShop_Awake_Patch
{
private static void Postfix(GunShop __instance)
{
GameObject gameObject = ((Component)__instance).gameObject;
MyUpdateComponent myUpdateComponent = gameObject.GetComponent<MyUpdateComponent>();
if ((Object)(object)myUpdateComponent == (Object)null)
{
myUpdateComponent = gameObject.AddComponent<MyUpdateComponent>();
}
myUpdateComponent.SetGunShopComponent(__instance);
myUpdateComponent.SetRerollCost(100 + 50 * SingletonScriptableObject<GameData>.I.Day.Get());
}
}
[HarmonyPatch(typeof(TownManager), "_refreshTownToggler")]
internal class TownManager_RefreshTownToggler_Patch
{
private static void Postfix()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("__MOVE_but_BE_CAREFUL__/ExplorerShop");
if ((Object)(object)val != (Object)null)
{
int num = 100 + 50 * SingletonScriptableObject<GameData>.I.Day.Get();
Vector2 val2 = Vector2.op_Implicit(val.transform.position + new Vector3(1f, 1f, 0f));
InGameText.StaticCost("Press \"R\" to reroll.", num.ToString(), val2, (CostType)0);
}
else
{
Debug.LogError((object)"ExplorerShop GameObject not found.");
}
}
}
}