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.Crops;
using Atomicrops.Game.Data;
using Atomicrops.Game.EnemySystem;
using Atomicrops.Game.ParamsSystem;
using Atomicrops.Game.Player;
using Atomicrops.Game.SellableSystem;
using BepInEx;
using BepInEx.Logging;
using CustomParams;
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("CustomItemPack1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomItemPack1")]
[assembly: AssemblyTitle("CustomItemPack1")]
[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 = "CustomItemPack1";
public const string PLUGIN_NAME = "CustomItemPack1";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace CustomItemPack1
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "pauli.plugin.CustomItemPack1";
public const string PLUGIN_NAME = "CustomItemPack1";
public const string PLUGIN_VERSION = "2.0.0";
}
[BepInPlugin("pauli.plugin.CustomItemPack1", "CustomItemPack1", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Log;
private void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin pauli.plugin.CustomItemPack1 is loaded!");
CreateItems();
new Harmony("pauli.plugin.CustomItemPack1").PatchAll();
}
public void CreateItems()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Expected O, but got Unknown
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Expected O, but got Unknown
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Expected O, but got Unknown
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Expected O, but got Unknown
Upgrade val = new Upgrade("Clubber", "Feelin' Farmy? +2% Luck for every Farming Stat, -1% for every Fighting Stat.\n(Luck may not update right away)", "Clubber.png", Assembly.GetExecutingAssembly());
val.AddCustomParam((Action)ClubberState.BoostLuck, (Action)ClubberState.Cleanup);
val.AddUpgradeToLootPool("Main");
Upgrade val2 = new Upgrade("Deervil's Contract", "10 Cashews on every kill", "DeervilContract.png", Assembly.GetExecutingAssembly());
val2.AddCustomParam((Action)DeervilContractState.EnableDoSouls, (Action)DeervilContractState.Cleanup);
val2.AddUpgradeToLootPool("GoldenChest");
Upgrade val3 = new Upgrade("Delicacy", "Everything will be worth 1.5x Cashews. All future crops planted will die instantly upon being eaten or burned", "Delicacy.png", Assembly.GetExecutingAssembly());
val3.AddCustomParam((Action)DelicacyState.EnableActivateOneHealth, (Action)DelicacyState.Cleanup);
val3.AddUpgradeToLootPool("DeerShop");
Upgrade val4 = new Upgrade("Dope Shades", "So chill. When you get a friend, get two", "DopeShades.png", Assembly.GetExecutingAssembly());
val4.AddCustomParam((Action)DopeShadesState.EnableDoDopeShades, (Action)DopeShadesState.Cleanup);
val4.AddUpgradeToLootPool("GoldenChest");
Upgrade val5 = new Upgrade("Mushroom Melange", "When you eat a Mushroom, get the effects of every mushroom.", "MushroomMelange.png", Assembly.GetExecutingAssembly());
val5.AddCustomParam((Action)MushroomMelangeState.EnableMushroomMelange, (Action)MushroomMelangeState.Cleanup);
val5.AddUpgradeToLootPool("GoldenChest");
Upgrade val6 = new Upgrade("Necrootmancy", "Makes enemies soil their pants", "Necrootmancy.png", Assembly.GetExecutingAssembly());
val6.AddCustomParam((Action)NecrootmancyState.EnableDoNecrootmancy, (Action)NecrootmancyState.Cleanup);
val6.AddUpgradeToLootPool("GoldenChest");
Upgrade val7 = new Upgrade("Superabundance", "To hell with moderation. +100% Deervil Curse chance.", "Superabundance.png", Assembly.GetExecutingAssembly());
val7.AddCustomParam((Action)SuperabundanceState.BoostDeervilCurse, (Action)SuperabundanceState.Cleanup);
val7.AddUpgradeToLootPool("DeerShop");
Upgrade val8 = new Upgrade("Wilderberries", "You'll always have time for berry picking now!\n+10 seconds every time you pick a berry.", "Wilderberries.png", Assembly.GetExecutingAssembly());
val8.AddCustomParam((Action)WilderberriesState.EnableTimeOnForageable, (Action)WilderberriesState.Cleanup);
val8.AddUpgradeToLootPool("Main");
}
}
public static class ClubberState
{
public static int FarmingStat { get; set; }
public static int FightingStat { get; set; }
public static void BoostLuck()
{
FarmingStat = SingletonScriptableObject<GameData>.I.FarmingStat.Get();
FightingStat = SingletonScriptableObject<GameData>.I.FightingStat.Get();
PlayerParams player = LiveParams.Player;
player.Luck += (float)FarmingStat * 0.02f - (float)FightingStat * 0.01f;
}
public static void Cleanup()
{
PlayerParams player = LiveParams.Player;
player.Luck -= (float)FarmingStat * 0.02f - (float)FightingStat * 0.01f;
FarmingStat = 0;
FightingStat = 0;
}
}
[HarmonyPatch(typeof(UpgradeProcs_1_6), "OnOnEnemyKilled")]
public class DeervilContractState
{
public static bool DoSouls { get; set; }
public static void EnableDoSouls()
{
DoSouls = true;
}
public static void Cleanup()
{
DoSouls = false;
}
private static void Postfix(UpgradeProcs_1_6 __instance, object arg1, EnemyControllerEventArgs arg2)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
if (DoSouls)
{
Vector2 anchor = arg2.Enemy.GetAgent().GetAnchor((AgentAnchors)0);
SellableModel val = new SellableModel
{
Def = __instance.GhostSellable,
QualityLevel = 0
};
if (!FinalBossUtils.DoCropGun())
{
SingletonScriptableObject<GameData>.I.Sellables.Add(val, false, default(Vector2), (CropModel)null);
SingletonScriptableObject<GameData>.I.Money.Add(SellableUtils.GetMoneyValue(val));
SimplePool.Spawn(__instance.GhostMediumPrefab, Vector2.op_Implicit(anchor + __instance.GhostMediumSpawnOffset), Quaternion.identity);
}
else if ((Object)(object)SingletonSceneScope<FinalBossCropGun>.I != (Object)null)
{
SingletonSceneScope<FinalBossCropGun>.I.Fire(val, (CropModel)null, anchor);
}
}
}
}
public static class DelicacyState
{
public static bool ActivateOneHealth { get; set; }
public static void EnableActivateOneHealth()
{
ActivateOneHealth = true;
}
public static void Cleanup()
{
ActivateOneHealth = false;
}
}
[HarmonyPatch(typeof(CropModel), "GetMaxHealth")]
internal class CropModel_GetMaxHealth_Patch
{
private static bool Prefix(CropModel __instance, ref float __result)
{
if (DelicacyState.ActivateOneHealth)
{
__result = 1f;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(SellableUtils), "GetMoneyValue", new Type[] { typeof(SellableModel) })]
internal class SellableUtils_GetMoneyValue_Patch
{
private static void Postfix(ref int __result, SellableModel model)
{
if (DelicacyState.ActivateOneHealth)
{
float num = (float)__result * 1.5f;
__result = (int)Math.Floor(num);
}
}
}
[HarmonyPatch(typeof(FriendsCollection), "_add")]
public static class DopeShadesState
{
public static readonly Vector2 offset = new Vector2(0.0001f, 0.0001f);
public static Vector2 lastPos = new Vector2(float.MinValue, float.MinValue);
public static readonly float SomeSmallThreshold = 0.1f;
public static bool DoDopeShades { get; set; } = false;
public static void EnableDoDopeShades()
{
DoDopeShades = true;
}
public static void Cleanup()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
lastPos = new Vector2(float.MinValue, float.MinValue);
DoDopeShades = false;
}
private static void Postfix(FriendsCollection __instance, FriendModel model, bool doSpawnAtPos, ref Vector2 pos, AddParams_ addParams)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_007b: 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_0085: Unknown result type (might be due to invalid IL or missing references)
if (DoDopeShades && Vector2.Distance(pos, lastPos) > SomeSmallThreshold && pos != lastPos)
{
lastPos = pos;
MethodInfo methodInfo = AccessTools.Method(typeof(FriendsCollection), "_add", (Type[])null, (Type[])null);
methodInfo.Invoke(__instance, new object[4]
{
(object)new FriendModel(model.Def),
doSpawnAtPos,
pos + offset,
addParams
});
}
else
{
lastPos = pos;
}
}
}
[HarmonyPatch(typeof(MushroomManager), "Eat", new Type[] { typeof(MushroomDef) })]
public static class MushroomMelangeState
{
public static bool DoMushroomMelange { get; set; }
public static void EnableMushroomMelange()
{
DoMushroomMelange = true;
}
public static void Cleanup()
{
DoMushroomMelange = false;
}
private static bool Prefix(MushroomManager __instance, MushroomDef def)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
if (DoMushroomMelange)
{
__instance.EatSound.PlayOneShotAtVolumeAndPitch(Vector2.op_Implicit(((Component)SingletonSceneScope<SoundListener>.I).transform.position), 1f, __instance.EatSoundPitch);
def.StartSound.PlayOneShotAtVolumeAndPitch(Vector2.op_Implicit(((Component)SingletonSceneScope<SoundListener>.I).transform.position), 1f, def.StartSoundPitch);
InGameText.FloatUpFromPlayer("DELICIOUS!", false, default(Vector2));
if (SingletonScriptableObject<GameData>.I.ActionItems.GetCount() > 0)
{
__instance.EatRechargeMush();
}
__instance.EatBerserkMush();
__instance.EatFertMush();
__instance.EatSpeedMush();
Fx.PlayOnAgent(__instance.TimeFx, ((Component)SingletonSceneScope<PlayerComp>.I).gameObject, __instance.TimeFxOffset, (AgentAnchors)0);
__instance.EatTimeMush();
return false;
}
return true;
}
}
[HarmonyPatch(typeof(MushroomManager), "CanEat")]
internal class MushroomManage_CanEat_Patch
{
private static bool Prefix(ref bool __result, MushroomDef def)
{
if (MushroomMelangeState.DoMushroomMelange)
{
__result = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(UpgradeProcs_1_6), "OnOnEnemyKilled")]
public static class NecrootmancyState
{
public static bool DoNecrootmancy { get; set; }
public static GameObject RootFighter { get; set; }
public static void EnableDoNecrootmancy()
{
if ((Object)(object)RootFighter == (Object)null)
{
GameObject val = GameObject.Find("UpgradesController");
FarmTaskUpgradeProcs component = val.GetComponent<FarmTaskUpgradeProcs>();
RootFighter = component.RootFighter;
}
DoNecrootmancy = true;
}
public static void Cleanup()
{
DoNecrootmancy = false;
}
private static void Postfix(UpgradeProcs_1_6 __instance, object arg1, EnemyControllerEventArgs arg2)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0049: Unknown result type (might be due to invalid IL or missing references)
if (DoNecrootmancy && (int)arg2.Source == 3)
{
Vector2 anchor = arg2.Enemy.GetAgent().GetAnchor((AgentAnchors)0);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(anchor.x, anchor.y, 0f);
SimplePool.Spawn(RootFighter, val, Quaternion.identity);
}
}
}
[HarmonyPatch(typeof(UpgradeProcs_1_6), "OnEnable")]
public static class SuperabundanceState
{
public static bool EnableSuperabundance;
public static void BoostDeervilCurse()
{
EnableSuperabundance = true;
PlayerParams player = LiveParams.Player;
player.DeervilCurse += 1f;
}
public static void Cleanup()
{
if (EnableSuperabundance)
{
PlayerParams player = LiveParams.Player;
player.DeervilCurse -= 1f;
EnableSuperabundance = false;
}
}
private static void Postfix(UpgradeProcs_1_6 __instance)
{
Traverse.Create((object)__instance).Field("_molesSpawned").SetValue((object)(-10000));
}
}
[HarmonyPatch(typeof(PlayerUpgradeActionsHandler), "SellablesOnOnChange")]
public static class WilderberriesState
{
public static bool TimeOnForageable { get; set; }
public static void EnableTimeOnForageable()
{
TimeOnForageable = true;
}
public static void Cleanup()
{
TimeOnForageable = false;
}
private static void Postfix(PlayerUpgradeActionsHandler __instance, SellableEventArgs args)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (TimeOnForageable && args.Model.Def.IsForageable)
{
DayNightUtils.AddTime(10f);
InGameText.FloatUpFromPlayer("+10 seconds", false, default(Vector2));
}
}
}
}