using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Dungeonator;
using Gunfiguration;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Newtonsoft.Json;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("JollyCoop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JollyCoop")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("825bc8e2-2faf-496c-803c-3f3e31eba1a0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace JollyCoop;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("kleirof.etg.jollycoop", "Jolly Coop", "1.3.4")]
public class JollyCoopModule : BaseUnityPlugin
{
public const string GUID = "kleirof.etg.jollycoop";
public const string NAME = "Jolly Coop";
public const string VERSION = "1.3.4";
public const string TEXT_COLOR = "#00CED1";
public static JollyCoopModule instance;
public OutlineColorManager outlineColorManager;
public void Start()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
instance = this;
ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
new Harmony("kleirof.etg.jollycoop").PatchAll();
}
public void GMStart(GameManager g)
{
Log("Jolly Coop v1.3.4 started successfully.", "#00CED1");
outlineColorManager = new OutlineColorManager();
JollyCoopManager.InitializeGunfig();
}
public static void Log(string text, string color = "FFFFFF")
{
ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
}
}
internal class JollyCoopManager
{
internal static Gunfig gunfig = null;
internal const string jollyCoopOnStr = "Jolly Coop On";
internal const string itemDistribLockStr = "Item Distribution Lock";
internal const string chestItemDoubledStr = "Chest Item Doubled";
internal const string roomItemDropIncStr = "Room Item Drop Increace";
internal const string masterIndependentStr = "Master Round Independent";
internal const string normalBossRewardDoubledStr = "Normal Boss Reward Doubled";
internal const string extraEnemyHealthStr = "Extra Enemy Health";
internal const string extraEnemyProjectileSpeedStr = "Extra Enemy Projectile Speed";
internal const string increasePlayerOneSpeedOutOfCombatStr = "Increase 1P Speed Out Of Combat";
internal const string increasePlayerTwoSpeedOutOfCombatStr = "Increase 2P Speed Out Of Combat";
internal const string playerOneVibrationStr = "1P Vibration";
internal const string playerTwoVibrationStr = "2P Vibration";
internal const string playerOneOutlineStr = "1P Outline";
internal const string playerTwoOutlineStr = "2P Outline";
private const string m_onStr = "<color=#7FFFD4>on</color>";
private const string m_offStr = "<color=#DAA520>off</color>";
private static string[] extraEnemyHealthStrings = new string[6] { "<color=#8B4513>0</color>", "<color=#6495ED>0.1</color>", "<color=#3CB371>0.2</color>", "<color=#FF0000>0.3</color>", "<color=#808080>-0.2</color>", "<color=#C0C0C0>-0.1</color>" };
private static int extraEnemyHealthIndex;
private static List<string> extraEnemyHealthStringList = new List<string> { "@8B45130", "@6495ED0.1", "@3CB3710.2", "@FF00000.3", "@808080-0.2", "@C0C0C0-0.1" };
private static string[] extraEnemyProjectileSpeedStrings = new string[6] { "<color=#8B4513>0</color>", "<color=#6495ED>0.02</color>", "<color=#3CB371>0.04</color>", "<color=#FF0000>0.06</color>", "<color=#808080>-0.04</color>", "<color=#C0C0C0>-0.02</color>" };
private static int extraEnemyProjectileSpeedIndex;
private static List<string> extraEnemyProjectileSpeedStringList = new List<string> { "@8B45130", "@6495ED0.02", "@3CB3710.04", "@FF00000.06", "@808080-0.04", "@C0C0C0-0.02" };
private static readonly Dictionary<string, int> ExtraEnemyHealthLookup = new Dictionary<string, int>
{
{ "@8B45130", 0 },
{ "@6495ED0.1", 1 },
{ "@3CB3710.2", 2 },
{ "@FF00000.3", 3 },
{ "@808080-0.2", 4 },
{ "@C0C0C0-0.1", 5 },
{ "0", 0 },
{ "0.1", 1 },
{ "0.2", 2 },
{ "0.3", 3 },
{ "-0.2", 4 },
{ "-0.1", 5 }
};
private static readonly Dictionary<string, int> ExtraEnemyProjectileSpeedLookup = new Dictionary<string, int>
{
{ "@8B45130", 0 },
{ "@6495ED0.02", 1 },
{ "@3CB3710.04", 2 },
{ "@FF00000.06", 3 },
{ "@808080-0.04", 4 },
{ "@C0C0C0-0.02", 5 },
{ "0", 0 },
{ "0.02", 1 },
{ "0.04", 2 },
{ "0.06", 3 },
{ "-0.04", 4 },
{ "-0.02", 5 }
};
private static List<string> outlineColorDisplayNames = new List<string>();
private static Dictionary<string, string> outlineColorLookupDict = new Dictionary<string, string>();
public static float EnemyHealth
{
get
{
if (!gunfig.Enabled("Jolly Coop On"))
{
return 1.4f;
}
float num = 1.4f;
if (gunfig.Enabled("Chest Item Doubled"))
{
num += 0.1f;
}
if (gunfig.Enabled("Room Item Drop Increace"))
{
num += 0.075f;
}
if (gunfig.Enabled("Master Round Independent"))
{
num += 0.1f;
}
if (gunfig.Enabled("Normal Boss Reward Doubled"))
{
num += 0.025f;
}
num += (float)((extraEnemyHealthIndex > 3) ? (extraEnemyHealthIndex - 6) : extraEnemyHealthIndex) * 0.1f;
if (!(num < 1.4f))
{
return num;
}
return 1.4f;
}
}
public static float EnemyProjectileSpeed
{
get
{
if (!gunfig.Enabled("Jolly Coop On"))
{
return 0.95f;
}
float num = 0.95f;
if (gunfig.Enabled("Chest Item Doubled"))
{
num += 0.02f;
}
if (gunfig.Enabled("Room Item Drop Increace"))
{
num += 0.005f;
}
if (gunfig.Enabled("Master Round Independent"))
{
num += 0.02f;
}
if (gunfig.Enabled("Normal Boss Reward Doubled"))
{
num += 0.005f;
}
num += (float)((extraEnemyProjectileSpeedIndex > 3) ? (extraEnemyProjectileSpeedIndex - 6) : extraEnemyProjectileSpeedIndex) * 0.02f;
if (!(num < 0.95f))
{
return num;
}
return 0.95f;
}
}
public static float ItemRecyclingPrice
{
get
{
if (!gunfig.Enabled("Jolly Coop On"))
{
return 1f;
}
float num = 1f;
if (gunfig.Enabled("Chest Item Doubled"))
{
num *= 0.6f;
}
return num;
}
}
internal static void InitializeGunfig()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Invalid comparison between Unknown and I4
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Invalid comparison between Unknown and I4
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Invalid comparison between Unknown and I4
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Invalid comparison between Unknown and I4
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Invalid comparison between Unknown and I4
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Invalid comparison between Unknown and I4
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Invalid comparison between Unknown and I4
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Invalid comparison between Unknown and I4
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Invalid comparison between Unknown and I4
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Invalid comparison between Unknown and I4
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Invalid comparison between Unknown and I4
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Invalid comparison between Unknown and I4
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Invalid comparison between Unknown and I4
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Invalid comparison between Unknown and I4
//IL_0363: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Invalid comparison between Unknown and I4
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Invalid comparison between Unknown and I4
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Invalid comparison between Unknown and I4
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_042e: Invalid comparison between Unknown and I4
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_046c: Invalid comparison between Unknown and I4
//IL_049a: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Invalid comparison between Unknown and I4
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Invalid comparison between Unknown and I4
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Unknown result type (might be due to invalid IL or missing references)
//IL_050e: Invalid comparison between Unknown and I4
//IL_0555: Unknown result type (might be due to invalid IL or missing references)
//IL_055c: Invalid comparison between Unknown and I4
//IL_0574: Unknown result type (might be due to invalid IL or missing references)
//IL_0563: Unknown result type (might be due to invalid IL or missing references)
//IL_058d: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Invalid comparison between Unknown and I4
//IL_05df: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Invalid comparison between Unknown and I4
//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_0620: Invalid comparison between Unknown and I4
//IL_0641: Unknown result type (might be due to invalid IL or missing references)
//IL_0648: Invalid comparison between Unknown and I4
//IL_0669: Unknown result type (might be due to invalid IL or missing references)
//IL_0670: Invalid comparison between Unknown and I4
//IL_0691: Unknown result type (might be due to invalid IL or missing references)
//IL_0698: Invalid comparison between Unknown and I4
//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
//IL_06bf: Invalid comparison between Unknown and I4
//IL_0704: Unknown result type (might be due to invalid IL or missing references)
//IL_070b: Invalid comparison between Unknown and I4
BuildDisplayAndLookupData();
gunfig = Gunfig.Get(GunfigHelpers.WithColor("Jolly Coop", Color.white));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 ×= (1.4 + 以下所有之和)", Color.green) : GunfigHelpers.WithColor("Enemy Health ×= (1.4 + sum of all below)", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("(1.4是合作模式原本的数值)", Color.green) : GunfigHelpers.WithColor("(1.4 is the original value in coop)", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 ×= (0.95 + 以下所有之和)", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed ×= (0.95 + sum of all below)", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("(0.95是合作模式原本的数值)", Color.green) : GunfigHelpers.WithColor("(0.95 is the original value in coop)", Color.green));
gunfig.AddToggle("Jolly Coop On", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "开启Jolly Coop" : "Jolly Coop On", (Action<string, string>)null, (Update)1);
gunfig.AddLabel(" ");
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("无负面作用", Color.green) : GunfigHelpers.WithColor("No negative effects", Color.green));
gunfig.AddToggle("Item Distribution Lock", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "物品分发锁" : "Item Distribution Lock", (Action<string, string>)null, (Update)1);
gunfig.AddLabel(" ");
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.1", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.1", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.02", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.02", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("物品回收价格 ×= 0.6", Color.green) : GunfigHelpers.WithColor("Item Recycling Price ×= 0.6", Color.green));
gunfig.AddToggle("Chest Item Doubled", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "箱子双倍物品" : "Chest Item Doubled", (Action<string, string>)null, (Update)1);
gunfig.AddLabel(" ");
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.075", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.075", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.005", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.005", Color.green));
gunfig.AddToggle("Room Item Drop Increace", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "房间掉落增加" : "Room Item Drop Increace", (Action<string, string>)null, (Update)1);
gunfig.AddLabel(" ");
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.1", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.1", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.02", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.02", Color.green));
gunfig.AddToggle("Master Round Independent", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "胜者之弹独立" : "Master Round Independent", (Action<string, string>)null, (Update)1);
gunfig.AddLabel(" ");
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.025", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.025", Color.green));
gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.005", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.005", Color.green));
gunfig.AddToggle("Normal Boss Reward Doubled", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "Boss普通奖励双倍" : "Normal Boss Reward Doubled", (Action<string, string>)null, (Update)1);
gunfig.AddLabel(" ");
Gunfig obj = gunfig.AddSubMenu(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("手动平衡", Color.cyan) : GunfigHelpers.WithColor("Manual Balance", Color.cyan));
obj.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量不低于1.4", Color.red) : GunfigHelpers.WithColor("Enemy health not less than 1.4", Color.red));
string text = (((int)GameManager.Options.CurrentLanguage == 11) ? "额外敌人血量增量" : "Extra Enemy Health");
obj.AddScrollBox("Extra Enemy Health", extraEnemyHealthStringList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdateExtraEnemyHealth(optionValue);
}, (List<string>)null, (Update)1);
UpdateExtraEnemyHealth(null);
obj.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人子弹速度不低于0.95", Color.red) : GunfigHelpers.WithColor("Enemy Projectile Speed not less than 0.95", Color.red));
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "额外敌人子弹速度" : "Extra Enemy Projectile Speed");
obj.AddScrollBox("Extra Enemy Projectile Speed", extraEnemyProjectileSpeedStringList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdateExtraEnemyProjectileSpeed(optionValue);
}, (List<string>)null, (Update)1);
UpdateExtraEnemyProjectileSpeed(null);
Gunfig obj2 = gunfig.AddSubMenu(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("合作独立设置", Color.yellow) : GunfigHelpers.WithColor("Coop Independent Settings", Color.yellow));
obj2.AddToggle("Increase 1P Speed Out Of Combat", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "非战斗模式下1P速度加快" : "Increase 1P Speed Out Of Combat", (Action<string, string>)null, (Update)1);
obj2.AddToggle("Increase 2P Speed Out Of Combat", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "非战斗模式下2P速度加快" : "Increase 2P Speed Out Of Combat", (Action<string, string>)null, (Update)1);
obj2.AddToggle("1P Vibration", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "1P震动" : "1P Vibration", (Action<string, string>)null, (Update)1);
obj2.AddToggle("2P Vibration", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "2P震动" : "2P Vibration", (Action<string, string>)null, (Update)1);
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "1P轮廓" : "1P Outline");
obj2.AddScrollBox("1P Outline", outlineColorDisplayNames, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerOneCursorModulation(optionValue);
}, (List<string>)null, (Update)1);
text = (((int)GameManager.Options.CurrentLanguage == 11) ? "2P轮廓" : "2P Outline");
obj2.AddScrollBox("2P Outline", outlineColorDisplayNames, text, (Action<string, string>)delegate(string optionKey, string optionValue)
{
UpdatePlayerTwoCursorModulation(optionValue);
}, (List<string>)null, (Update)1);
ETGModConsole.Log((object)"<color=#FFFACD>Enter 'jollycoop' to see Jolly Coop status. Switch options in Mod Config.</color>", false);
ListStatus();
ETGModConsole.Commands.AddGroup("jollycoop", (Action<string[]>)delegate
{
ListStatus();
});
ETGModConsole.Commands.GetGroup("jollycoop").AddUnit("status", (Action<string[]>)delegate
{
ListStatus();
});
UpdatePlayerOneCursorModulation();
UpdatePlayerTwoCursorModulation();
}
private static void ListStatus()
{
ETGModConsole.Log((object)("Jolly Coop is " + (gunfig.Enabled("Jolly Coop On") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
ETGModConsole.Log((object)(" Item Distribution Lock " + (gunfig.Enabled("Item Distribution Lock") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
ETGModConsole.Log((object)(" Chest Item Doubled " + (gunfig.Enabled("Chest Item Doubled") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
ETGModConsole.Log((object)(" Room Item Drop Increase " + (gunfig.Enabled("Room Item Drop Increace") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
ETGModConsole.Log((object)(" Master Master Independent " + (gunfig.Enabled("Master Round Independent") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
ETGModConsole.Log((object)(" Normal Boss Reward Doubled " + (gunfig.Enabled("Normal Boss Reward Doubled") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
ETGModConsole.Log((object)(" Extra Enemy Health " + extraEnemyHealthStrings[extraEnemyHealthIndex]), false);
ETGModConsole.Log((object)(" Extra Enemy Projectile Speed " + extraEnemyProjectileSpeedStrings[extraEnemyProjectileSpeedIndex]), false);
ETGModConsole.Log((object)"<color=#00CED1>In coop:</color>", false);
ETGModConsole.Log((object)("<color=#FFFACD> -- Enemy Health multiplies </color>" + EnemyHealth.ToString("F3")), false);
ETGModConsole.Log((object)("<color=#FFFACD> -- Enemy Projectile Speed multiplies </color>" + EnemyProjectileSpeed.ToString("F3")), false);
ETGModConsole.Log((object)("<color=#FFFACD> -- Item Recycling Price multiplies </color>" + ItemRecyclingPrice.ToString("F3")), false);
}
private static void UpdateExtraEnemyHealth(string value)
{
if (value == null)
{
value = gunfig.Value("Extra Enemy Health");
}
if (!ExtraEnemyHealthLookup.TryGetValue(value, out var value2))
{
value2 = 0;
}
extraEnemyHealthIndex = value2;
}
private static void UpdateExtraEnemyProjectileSpeed(string value)
{
if (value == null)
{
value = gunfig.Value("Extra Enemy Projectile Speed");
}
if (!ExtraEnemyProjectileSpeedLookup.TryGetValue(value, out var value2))
{
value2 = 0;
}
extraEnemyProjectileSpeedIndex = value2;
}
public static void AddItem(Chest c)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Invalid comparison between Unknown and I4
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Invalid comparison between Unknown and I4
//IL_00f9: 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_0099: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Invalid comparison between Unknown and I4
if (!gunfig.Enabled("Jolly Coop On") || !gunfig.Enabled("Chest Item Doubled") || (int)GameManager.Instance.CurrentGameType != 1)
{
return;
}
int count = c.contents.Count;
for (int i = 0; i < count; i++)
{
if ((int)c.contents[i].quality == 4 || (int)c.contents[i].quality == 3 || (int)c.contents[i].quality == 2 || (int)c.contents[i].quality == 1 || (int)c.contents[i].quality == 5)
{
RewardManager rewardManager = GameManager.Instance.RewardManager;
GenericLootTable val = ((c.contents[i] is Gun) ? rewardManager.GunsLootTable : rewardManager.ItemsLootTable);
PickupObject val2 = rewardManager.GetItemForPlayer(GameManager.Instance.SecondaryPlayer, val, c.contents[i].quality, (List<GameObject>)null, false, (Random)null, false, (List<GameObject>)null, false, (RewardSource)0).GetComponent<PickupObject>();
if ((Object)(object)val2 == (Object)(object)c.contents[i])
{
val2 = Object.Instantiate<PickupObject>(c.contents[i]);
}
c.contents.Add(val2);
JollyCoopPatches.playerOneExclusiveLoots.Add(val2);
JollyCoopPatches.playerTwoExclusiveLoots.Add(c.contents[i]);
}
else if (c.contents[i] is PassiveItem)
{
PickupObject val2 = Object.Instantiate<PickupObject>(c.contents[i]);
c.contents.Add(val2);
JollyCoopPatches.playerOneExclusiveLoots.Add(val2);
JollyCoopPatches.playerTwoExclusiveLoots.Add(c.contents[i]);
}
else if (!(c.contents[i] is KeyBulletPickup))
{
c.contents.Add(c.contents[i]);
}
}
}
public static IEnumerator SpawnChest(Vector3 v, RoomHandler room)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
yield return (object)new WaitForSeconds(0.45f);
Chest val = Chest.Spawn(GameManager.Instance.RewardManager.A_Chest, v, room, true);
val.IsRainbowChest = true;
val.BecomeRainbowChest();
JollyCoopPatches.playerOneExclusiveChests.Add(val);
}
private static void UpdatePlayerOneCursorModulation(string value = null)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (value == null)
{
value = gunfig.Value("1P Outline");
}
if (!outlineColorLookupDict.TryGetValue(value, out var value2))
{
value2 = null;
}
JollyCoopPatches.playerOneOutlineColor = OutlineColorManager.instance.GetOutlineColorByName(value2);
}
private static void UpdatePlayerTwoCursorModulation(string value = null)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (value == null)
{
value = gunfig.Value("2P Outline");
}
if (!outlineColorLookupDict.TryGetValue(value, out var value2))
{
value2 = null;
}
JollyCoopPatches.playerTwoOutlineColor = OutlineColorManager.instance.GetOutlineColorByName(value2);
}
public static void BuildDisplayAndLookupData()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
outlineColorDisplayNames.Clear();
outlineColorLookupDict.Clear();
foreach (string outlineColorName in OutlineColorManager.instance.OutlineColorNameList)
{
if (OutlineColorManager.instance.RegisteredOutlineColors.TryGetValue(outlineColorName, out var value))
{
string text = GunfigHelpers.WithColor(outlineColorName, value.color);
outlineColorDisplayNames.Add(text);
outlineColorLookupDict[text] = outlineColorName;
if (!outlineColorLookupDict.ContainsKey(outlineColorName))
{
outlineColorLookupDict[outlineColorName] = outlineColorName;
}
}
}
}
}
public static class JollyCoopPatches
{
[HarmonyPatch(typeof(Chest), "Open")]
public class OpenPatchClass
{
[HarmonyILManipulator]
public static void OpenPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<PlayerController>(x, "TriggerItemAcquisition")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.EmitCall<OpenPatchClass>("OpenPatchCall");
}
}
private static void OpenPatchCall(Chest self)
{
if (!self.IsRainbowChest)
{
JollyCoopManager.AddItem(self);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class HandleSynergyGambleChestPatchClass
{
[HarmonyILManipulator]
public static void HandleSynergyGambleChestPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<PlayerController>(x, "TriggerItemAcquisition")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.EmitCall<HandleSynergyGambleChestPatchClass>("HandleSynergyGambleChestPatchCall");
}
}
private static void HandleSynergyGambleChestPatchCall(object selfObject)
{
JollyCoopManager.AddItem(GetFieldInEnumerator<Chest>(selfObject, "this"));
}
}
[HarmonyPatch(typeof(Chest), "OnBroken")]
public class OnBrokenPatchClass
{
[HarmonyILManipulator]
public static void OnBrokenPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
for (int i = 0; i < 6; i++)
{
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<Chest>(x, "PresentItem")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.EmitCall<JollyCoopManager>("AddItem");
}
val.Index += 3;
}
}
}
[HarmonyPatch(typeof(RoomHandler), "HandleRoomClearReward")]
public class HandleRoomClearRewardPatchClass
{
[HarmonyILManipulator]
public static void HandleRoomClearRewardPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Ble_Un)
}))
{
val.EmitCall<HandleRoomClearRewardPatchClass>("HandleRoomClearRewardPatchCall");
}
}
private static float HandleRoomClearRewardPatchCall(float orig)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Room Item Drop Increace") && (int)GameManager.Instance.CurrentGameType == 1)
{
return orig * 1.5f;
}
return orig;
}
}
[HarmonyPatch(typeof(RoomHandler), "HandleBossClearReward")]
public class HandleBossClearRewardPatchClass
{
[HarmonyILManipulator]
public static void HandleBossClearRewardPatch(ILContext ctx)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
ILCursor crs = new ILCursor(ctx);
if (TheNthTime(() => crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Brfalse)
}), 7))
{
crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_1");
}
crs.Index = 0;
if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 2)
}), 5))
{
crs.Emit(OpCodes.Ldloca_S, (byte)2);
crs.Emit(OpCodes.Ldloc_S, (byte)12);
crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_2");
}
crs.Index = 0;
if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStfld<CellData>(x, "isOccupied")
}), 3))
{
crs.Emit(OpCodes.Ldarg_0);
crs.Emit(OpCodes.Ldloca_S, (byte)2);
crs.Emit(OpCodes.Ldloc_S, (byte)10);
crs.Emit(OpCodes.Ldloc_S, (byte)13);
crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_3");
}
crs.Index = 0;
if (TheNthTime(() => crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Brfalse)
}), 12))
{
crs.Emit(OpCodes.Ldarg_0);
crs.Emit(OpCodes.Ldloca_S, (byte)2);
crs.Emit(OpCodes.Ldloc_S, (byte)10);
crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_4");
}
crs.Index = 0;
if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStfld<RewardPedestal>(x, "MimicGuid")
}))
{
crs.Emit(OpCodes.Ldloc_S, (byte)18);
crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_5");
}
}
private static bool HandleBossClearRewardPatchCall_1(bool orig)
{
return true;
}
private static void HandleBossClearRewardPatchCall_2(ref IntVector2 orig, bool flag2)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0043: Invalid comparison between Unknown and I4
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
orig -= IntVector2.Left;
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
{
orig += IntVector2.Left;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Master Round Independent") && GameManager.Instance.Dungeon.BossMasteryTokenItemId >= 0 && (int)GameManager.Instance.CurrentGameType == 1)
{
if (!playerOneHasTakenDamageInThisRoom && !playerOneHasGivenMasteryToken)
{
playerOneHasGivenMasteryToken = true;
for (int i = 0; i < playerOneSpawnMasterFlags.Length; i++)
{
playerOneSpawnMasterFlags[i] = true;
}
orig += IntVector2.Left;
}
if (!playerTwoHasTakenDamageInThisRoom && !playerTwoHasGivenMasteryToken)
{
playerTwoHasGivenMasteryToken = true;
for (int j = 0; j < playerTwoSpawnMasterFlags.Length; j++)
{
playerTwoSpawnMasterFlags[j] = true;
}
orig += IntVector2.Left;
}
}
else if (flag2)
{
orig += IntVector2.Left;
}
}
private static void HandleBossClearRewardPatchCall_3(RoomHandler self, ref IntVector2 intVector, RewardPedestal component, RewardPedestal rewardPedestal)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
{
Dungeon dungeon = GameManager.Instance.Dungeon;
intVector += new IntVector2(2, 0);
RewardPedestal val = RewardPedestal.Spawn(component, intVector, self);
val.SpawnsTertiarySet = false;
val.IsBossRewardPedestal = true;
val.lootTable.lootTable = self.OverrideBossRewardTable;
val.RegisterChestOnMinimap(self);
dungeon.data[intVector].isOccupied = true;
dungeon.data[intVector + IntVector2.Right].isOccupied = true;
dungeon.data[intVector + IntVector2.Up].isOccupied = true;
dungeon.data[intVector + IntVector2.One].isOccupied = true;
if (JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
playerTwoExclusivePedestals.Add(rewardPedestal);
playerOneExclusivePedestals.Add(val);
}
}
}
private static bool HandleBossClearRewardPatchCall_4(bool orig, RoomHandler self, ref IntVector2 intVector, RewardPedestal component)
{
//IL_0005: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameManager.Instance.CurrentGameType == 0)
{
return orig;
}
if (!JollyCoopManager.gunfig.Enabled("Jolly Coop On") || !JollyCoopManager.gunfig.Enabled("Master Round Independent"))
{
return orig;
}
if (playerTwoSpawnMasterFlags[0])
{
playerTwoSpawnMasterFlags[0] = false;
Dungeon dungeon = GameManager.Instance.Dungeon;
if (!playerOneHasTakenDamageInThisRoom)
{
intVector += new IntVector2(4, 0);
}
else
{
GameStatsManager.Instance.RegisterStatChange((TrackedStats)94, 1f);
PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer;
int masteryTokensCollectedThisRun = primaryPlayer.MasteryTokensCollectedThisRun;
primaryPlayer.MasteryTokensCollectedThisRun = masteryTokensCollectedThisRun + 1;
dungeon.HasGivenMasteryToken = true;
intVector += new IntVector2(2, 0);
}
RewardPedestal val = RewardPedestal.Spawn(component, intVector, self);
dungeon.data[intVector].isOccupied = true;
dungeon.data[intVector + IntVector2.Right].isOccupied = true;
dungeon.data[intVector + IntVector2.Up].isOccupied = true;
dungeon.data[intVector + IntVector2.One].isOccupied = true;
val.SpawnsTertiarySet = false;
val.contents = PickupObjectDatabase.GetById(dungeon.BossMasteryTokenItemId);
val.MimicGuid = null;
if (!playerOneHasTakenDamageInThisRoom)
{
intVector -= new IntVector2(4, 0);
}
if (JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
playerOneExclusivePedestals.Add(val);
}
}
return playerOneSpawnMasterFlags[0];
}
private static void HandleBossClearRewardPatchCall_5(RewardPedestal rewardPedestal3)
{
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On"))
{
playerOneSpawnMasterFlags[0] = false;
if (JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
playerTwoExclusivePedestals.Add(rewardPedestal3);
}
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class SpawnBehavior_CRPatchClass
{
[HarmonyILManipulator]
public static void SpawnBehavior_CRPatch(ILContext ctx)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
ILCursor crs = new ILCursor(ctx);
if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, -3f)
}))
{
crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_1");
}
crs.Index = 0;
if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 2f)
}))
{
crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_2");
}
crs.Index = 0;
if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f)
}), 4))
{
crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_3");
}
crs.Index = 0;
if (crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<RewardPedestal>(x, "DetermineContents")
}))
{
crs.Emit(OpCodes.Ldarg_0);
crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_4");
}
}
private static float SpawnBehavior_CRPatchCall_1(float orig)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
orig = -4f;
int num = 0;
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && (int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled"))
{
num++;
}
if (playerOneSpawnMasterFlags[1])
{
playerOneSpawnMasterFlags[1] = false;
num++;
}
if (playerTwoSpawnMasterFlags[1])
{
playerTwoSpawnMasterFlags[1] = false;
num++;
}
if (num != 3)
{
orig += 1f;
}
return orig;
}
private static float SpawnBehavior_CRPatchCall_2(float orig)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
orig = 1f;
int num = 0;
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && (int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled"))
{
num++;
}
if (playerOneSpawnMasterFlags[2])
{
playerOneSpawnMasterFlags[2] = false;
num++;
}
if (playerTwoSpawnMasterFlags[2])
{
playerTwoSpawnMasterFlags[2] = false;
num++;
}
orig += (float)num * 2f;
if (num != 3)
{
orig += 1f;
}
return orig;
}
private static float SpawnBehavior_CRPatchCall_3(float orig)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Invalid comparison between Unknown and I4
int num = 0;
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && (int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled"))
{
num++;
}
if (playerOneSpawnMasterFlags[3])
{
playerOneSpawnMasterFlags[3] = false;
num++;
}
if (playerTwoSpawnMasterFlags[3])
{
playerTwoSpawnMasterFlags[3] = false;
num++;
}
orig += (float)num * 1f;
return orig;
}
private static PlayerController SpawnBehavior_CRPatchCall_4(PlayerController orig, object selfObject)
{
if (playerOneExclusivePedestals.Contains(GetFieldInEnumerator<RewardPedestal>(selfObject, "this")))
{
return GameManager.Instance.SecondaryPlayer;
}
return orig;
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class RegeneratePatchClass
{
[HarmonyILManipulator]
public static void RegeneratePatch(ILContext ctx)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
MethodInfo methodInfo = AccessTools.Method(typeof(Vector3?), "get_Value", (Type[])null, (Type[])null);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)methodInfo)
}))
{
val.EmitCall<RegeneratePatchClass>("RegeneratePatchCall_1");
}
val.Index = 0;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Chest>(x, "BecomeRainbowChest")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldloc, 10);
val.Emit(OpCodes.Ldloc, 15);
val.EmitCall<RegeneratePatchClass>("RegeneratePatchCall_2");
}
}
private static Vector3 RegeneratePatchCall_1(Vector3 orig)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
//IL_002f: 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)
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Chest Item Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
{
return orig - new Vector3(4f, 0f, 0f);
}
return orig;
}
private static void RegeneratePatchCall_2(object selfObject, Vector3? vector, Chest firstChest)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Chest Item Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
{
playerTwoExclusiveChests.Add(firstChest);
Vector3? val = vector;
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(4f, 0f, 0f);
Vector3? val3 = (val.HasValue ? new Vector3?(val.GetValueOrDefault() + val2) : null);
Dungeon fieldInEnumerator = GetFieldInEnumerator<Dungeon>(selfObject, "this");
((MonoBehaviour)fieldInEnumerator).StartCoroutine(JollyCoopManager.SpawnChest(val3.Value, fieldInEnumerator.data.Entrance));
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class get_BaseLevelHealthModifierPatchClass
{
[HarmonyILManipulator]
public static void get_BaseLevelHealthModifierPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameManager>(x, "COOP_ENEMY_HEALTH_MULTIPLIER")
}))
{
val.EmitCall<get_BaseLevelHealthModifierPatchClass>("get_BaseLevelHealthModifierPatchCall");
}
}
private static float get_BaseLevelHealthModifierPatchCall(float orig)
{
return JollyCoopManager.EnemyHealth;
}
}
[HarmonyPatch(typeof(HealthHaver), "Start")]
public class HealthHaverStartPatchClass
{
[HarmonyILManipulator]
public static void HealthHaverStartPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameManager>(x, "COOP_ENEMY_HEALTH_MULTIPLIER")
}))
{
val.EmitCall<HealthHaverStartPatchClass>("HealthHaverStartPatchCall");
}
}
private static float HealthHaverStartPatchCall(float orig)
{
return JollyCoopManager.EnemyHealth;
}
}
[HarmonyPatch(typeof(Projectile), "UpdateEnemyBulletSpeedMultiplier")]
public class UpdateEnemyBulletSpeedMultiplierPatchClass
{
[HarmonyILManipulator]
public static void UpdateEnemyBulletSpeedMultiplierPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameManager>(x, "COOP_ENEMY_PROJECTILE_SPEED_MULTIPLIER")
}))
{
val.EmitCall<UpdateEnemyBulletSpeedMultiplierPatchClass>("UpdateEnemyBulletSpeedMultiplierPatchCall");
}
}
private static float UpdateEnemyBulletSpeedMultiplierPatchCall(float orig)
{
return JollyCoopManager.EnemyProjectileSpeed;
}
}
[HarmonyPatch(typeof(LootEngine), "SpewLoot", new Type[]
{
typeof(List<GameObject>),
typeof(Vector3)
})]
public class SpewLootPatchClass
{
[HarmonyILManipulator]
public static void SpewLootPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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)
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 5)
}))
{
val.Emit(OpCodes.Ldloc_3);
val.Emit(OpCodes.Ldloc_S, (byte)5);
val.Emit(OpCodes.Ldarg_0);
val.EmitCall<SpewLootPatchClass>("SpewLootPatchCall");
}
}
private static void SpewLootPatchCall(int index, GameObject gameObject, List<GameObject> list)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerOneExclusiveLoots.Contains(list[index].gameObject.GetComponent<PickupObject>()))
{
playerOneExclusiveLoots.Remove(list[index].gameObject.GetComponent<PickupObject>());
playerOneExclusivePickups.Add(gameObject.GetComponent<PickupObject>(), GameManager.Instance.SecondaryPlayer.CurrentRoom == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(gameObject.transform.position, (VectorConversions)2)));
}
if (playerTwoExclusiveLoots.Contains(list[index].gameObject.GetComponent<PickupObject>()))
{
playerTwoExclusiveLoots.Remove(list[index].gameObject.GetComponent<PickupObject>());
playerTwoExclusivePickups.Add(gameObject.GetComponent<PickupObject>(), GameManager.Instance.PrimaryPlayer.CurrentRoom == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(gameObject.transform.position, (VectorConversions)2)));
}
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Set_IsLoadingLevelPatchClass
{
[HarmonyPrefix]
public static void Set_IsLoadingLevelPrefix(bool value)
{
if (value)
{
playerOneExclusivePickups.Clear();
playerTwoExclusivePickups.Clear();
playerOneExclusiveLoots.Clear();
playerTwoExclusiveLoots.Clear();
playerOneExclusivePedestals.Clear();
playerTwoExclusivePedestals.Clear();
playerOneExclusiveChests.Clear();
playerTwoExclusiveChests.Clear();
playerOneHasGivenMasteryToken = false;
playerTwoHasGivenMasteryToken = false;
playerOneHasTakenDamageInThisRoom = false;
playerTwoHasTakenDamageInThisRoom = false;
Array.Clear(playerOneSpawnMasterFlags, 0, playerOneSpawnMasterFlags.Length);
Array.Clear(playerTwoSpawnMasterFlags, 0, playerTwoSpawnMasterFlags.Length);
}
}
}
[HarmonyPatch(typeof(PassiveItem), "Interact")]
public class PassiveItemInteractPatchClass
{
[HarmonyPrefix]
public static bool InteractPrefix(PickupObject __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
if (playerTwoExclusivePickups.ContainsKey(__instance))
{
playerTwoExclusivePickups.Remove(__instance);
}
if (playerOneExclusivePickups.ContainsKey(__instance))
{
playerOneExclusivePickups.Remove(__instance);
}
return true;
}
}
[HarmonyPatch(typeof(PassiveItem), "GetRidOfMinimapIcon")]
public class PassiveItemGetRidOfMinimapIconPatchClass
{
[HarmonyPostfix]
public static void GetRidOfMinimapIconPostfix(PickupObject __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType == 1)
{
if (playerTwoExclusivePickups.ContainsKey(__instance))
{
playerTwoExclusivePickups.Remove(__instance);
}
if (playerOneExclusivePickups.ContainsKey(__instance))
{
playerOneExclusivePickups.Remove(__instance);
}
}
}
}
[HarmonyPatch(typeof(PassiveItem), "OnEnteredRange")]
public class PassiveItemOnEnteredRangePatchClass
{
[HarmonyPrefix]
public static bool OnEnteredRangePrefix(PickupObject __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(Gun), "Interact")]
public class GunInteractPatchClass
{
[HarmonyPrefix]
public static bool InteractPrefix(PickupObject __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
if (playerTwoExclusivePickups.ContainsKey(__instance))
{
playerTwoExclusivePickups.Remove(__instance);
}
if (playerOneExclusivePickups.ContainsKey(__instance))
{
playerOneExclusivePickups.Remove(__instance);
}
return true;
}
}
[HarmonyPatch(typeof(Gun), "GetRidOfMinimapIcon")]
public class GunGetRidOfMinimapIconPatchClass
{
[HarmonyPostfix]
public static void GetRidOfMinimapIconPostfix(PickupObject __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType == 1)
{
if (playerTwoExclusivePickups.ContainsKey(__instance))
{
playerTwoExclusivePickups.Remove(__instance);
}
if (playerOneExclusivePickups.ContainsKey(__instance))
{
playerOneExclusivePickups.Remove(__instance);
}
}
}
}
[HarmonyPatch(typeof(Gun), "OnEnteredRange")]
public class GunOnEnteredRangePatchClass
{
[HarmonyPrefix]
public static bool OnEnteredRangePrefix(PickupObject __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(PlayerItem), "Interact")]
public class PlayerItemInteractPatchClass
{
[HarmonyPrefix]
public static bool InteractPrefix(PickupObject __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
if (playerTwoExclusivePickups.ContainsKey(__instance))
{
playerTwoExclusivePickups.Remove(__instance);
}
if (playerOneExclusivePickups.ContainsKey(__instance))
{
playerOneExclusivePickups.Remove(__instance);
}
return true;
}
}
[HarmonyPatch(typeof(PlayerItem), "GetRidOfMinimapIcon")]
public class PlayerItemGetRidOfMinimapIconPatchClass
{
[HarmonyPostfix]
public static void GetRidOfMinimapIconPostfix(PickupObject __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType == 1)
{
if (playerTwoExclusivePickups.ContainsKey(__instance))
{
playerTwoExclusivePickups.Remove(__instance);
}
if (playerOneExclusivePickups.ContainsKey(__instance))
{
playerOneExclusivePickups.Remove(__instance);
}
}
}
}
[HarmonyPatch(typeof(PlayerItem), "OnEnteredRange")]
public class PlayerItemOnEnteredRangePatchClass
{
[HarmonyPrefix]
public static bool OnEnteredRangePrefix(PickupObject __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(RoomHandler), "PlayerEnter")]
public class PlayerEnterPatchClass
{
[HarmonyPostfix]
public static void PlayerEnterPostfix(RoomHandler __instance, PlayerController playerEntering)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: 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)
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return;
}
if ((Object)(object)playerEntering == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
playerOneHasTakenDamageInThisRoom = false;
List<PickupObject> list = new List<PickupObject>();
foreach (PickupObject key in playerTwoExclusivePickups.Keys)
{
if (!playerTwoExclusivePickups[key] && __instance == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(((BraveBehaviour)key).transform.position, (VectorConversions)2)))
{
list.Add(key);
}
}
{
foreach (PickupObject item in list)
{
playerTwoExclusivePickups[item] = true;
}
return;
}
}
playerTwoHasTakenDamageInThisRoom = false;
List<PickupObject> list2 = new List<PickupObject>();
foreach (PickupObject key2 in playerOneExclusivePickups.Keys)
{
if (!playerOneExclusivePickups[key2] && __instance == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(((BraveBehaviour)key2).transform.position, (VectorConversions)2)))
{
list2.Add(key2);
}
}
foreach (PickupObject item2 in list2)
{
playerOneExclusivePickups[item2] = true;
}
}
}
[HarmonyPatch(typeof(PickupObject), "ShouldBeTakenByRat")]
public class ShouldBeTakenByRatClass
{
[HarmonyPrefix]
public static bool ShouldBeTakenByRatPrefix(PickupObject __instance, ref bool __result)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (playerTwoExclusivePickups.TryGetValue(__instance, out var value) || playerOneExclusivePickups.TryGetValue(__instance, out value))
{
if (!value)
{
__result = false;
return false;
}
return true;
}
return true;
}
}
[HarmonyPatch(typeof(PlayerController), "Damaged")]
public class DamagedPatchClass
{
[HarmonyPrefix]
public static void DamagedPrefix(PlayerController __instance)
{
if ((Object)(object)__instance == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
playerOneHasTakenDamageInThisRoom = true;
}
else
{
playerTwoHasTakenDamageInThisRoom = true;
}
}
}
[HarmonyPatch(typeof(RewardPedestal), "Interact")]
public class RewardPedestalInteractPatchClass
{
[HarmonyPrefix]
public static bool RewardPedestalInteractPrefix(RewardPedestal __instance, PlayerController player)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePedestals.Contains(__instance) && (Object)(object)player == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePedestals.Contains(__instance) && (Object)(object)player == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
if (playerTwoExclusivePedestals.Contains(__instance))
{
playerTwoExclusivePedestals.Remove(__instance);
}
if (playerOneExclusivePedestals.Contains(__instance))
{
playerOneExclusivePedestals.Remove(__instance);
}
return true;
}
}
[HarmonyPatch(typeof(RewardPedestal), "OnEnteredRange")]
public class RewardPedestalOnEnteredRangePatchClass
{
[HarmonyPrefix]
public static bool RewardPedestalOnEnteredRangePrefix(RewardPedestal __instance, PlayerController interactor)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1)
{
return true;
}
if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
{
if (playerTwoExclusivePedestals.Contains(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
{
return false;
}
if (playerOneExclusivePedestals.Contains(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
{
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(Chest), "SpewContentsOntoGround")]
public class SpewContentsOntoGroundPatchClass
{
[HarmonyPrefix]
public static void SpewContentsOntoGroundPrefix(Chest __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1 || !JollyCoopManager.gunfig.Enabled("Jolly Coop On") || !JollyCoopManager.gunfig.Enabled("Item Distribution Lock") || !JollyCoopManager.gunfig.Enabled("Chest Item Doubled"))
{
return;
}
if (playerTwoExclusiveChests.Contains(__instance))
{
foreach (PickupObject content in __instance.contents)
{
playerTwoExclusiveLoots.Add(content);
}
playerTwoExclusiveChests.Remove(__instance);
}
if (!playerOneExclusiveChests.Contains(__instance))
{
return;
}
foreach (PickupObject content2 in __instance.contents)
{
playerOneExclusiveLoots.Add(content2);
}
playerOneExclusiveChests.Remove(__instance);
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class HandleSoldItemPatchClass
{
[HarmonyILManipulator]
public static void HandleSoldItemPatch(ILContext ctx)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
ILCursor crs = new ILCursor(ctx);
AccessTools.Method(typeof(Vector3?), "get_Value", (Type[])null, (Type[])null);
if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<tk2dBaseSprite>(x, "get_WorldCenter")
}), 2))
{
crs.Emit(OpCodes.Ldarg_0);
crs.EmitCall<HandleSoldItemPatchClass>("HandleSoldItemPatchCall");
}
}
private static void HandleSoldItemPatchCall(object selfObject)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Chest Item Doubled"))
{
int fieldInEnumerator = GetFieldInEnumerator<int>(selfObject, "sellPrice");
SetFieldInEnumerator(selfObject, "sellPrice", (int)((float)fieldInEnumerator * JollyCoopManager.ItemRecyclingPrice));
}
}
}
[HarmonyPatch(typeof(PlayerController), "Update")]
public class PlayerControllerUpdatePatchClass
{
[HarmonyILManipulator]
public static void PlayerControllerUpdatePatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameOptions>(x, "IncreaseSpeedOutOfCombat")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.EmitCall<PlayerControllerUpdatePatchClass>("PlayerControllerUpdatePatchCall");
}
}
private static bool PlayerControllerUpdatePatchCall(bool orig, PlayerController self)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1 || !JollyCoopManager.gunfig.Enabled("Jolly Coop On"))
{
return orig;
}
if (self.IsPrimaryPlayer)
{
return JollyCoopManager.gunfig.Enabled("Increase 1P Speed Out Of Combat");
}
return JollyCoopManager.gunfig.Enabled("Increase 2P Speed Out Of Combat");
}
[HarmonyPostfix]
public static void PlayerControllerUpdatePostfix(PlayerController __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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)
//IL_0040: 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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Invalid comparison between Unknown and I4
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Invalid comparison between Unknown and I4
try
{
if ((int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Jolly Coop On"))
{
if (!IsPlayerValid(__instance))
{
return;
}
Color val = (__instance.IsPrimaryPlayer ? playerOneOutlineColor : playerTwoOutlineColor);
if (!(__instance.outlineColor == val))
{
tk2dBaseSprite val2 = ((__instance != null) ? ((BraveBehaviour)__instance).sprite : null);
if (!((Object)(object)val2 == (Object)null))
{
SpriteOutlineManager.RemoveOutlineFromSprite(val2, true);
__instance.outlineColor = val;
SpriteOutlineManager.AddOutlineToSprite(val2, __instance.outlineColor, 0.1f, 0f, (OutlineType)((int)__instance.characterIdentity == 9));
}
}
}
else
{
if (!IsPlayerValid(__instance))
{
return;
}
Color black = Color.black;
if (__instance.outlineColor == black)
{
return;
}
tk2dBaseSprite val3 = ((__instance != null) ? ((BraveBehaviour)__instance).sprite : null);
if (!((Object)(object)val3 == (Object)null))
{
SpriteOutlineManager.RemoveOutlineFromSprite(val3, true);
if (!__instance.IsGhost)
{
__instance.outlineColor = black;
SpriteOutlineManager.AddOutlineToSprite(val3, __instance.outlineColor, 0.1f, 0f, (OutlineType)((int)__instance.characterIdentity == 9));
}
}
}
}
catch
{
}
}
private static bool IsPlayerValid(PlayerController player)
{
if (!Object.op_Implicit((Object)(object)player) || ((GameActor)player).IsGone)
{
return false;
}
if (!((Behaviour)((BraveBehaviour)player).specRigidbody).enabled || ((BraveBehaviour)player).specRigidbody.GetPixelCollider((ColliderType)2) == null)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(BraveInput), "LateUpdate")]
public class BraveInputLateUpdatePatchClass
{
[HarmonyILManipulator]
public static void BraveInputLateUpdatePatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameOptions>(x, "RumbleEnabled")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.EmitCall<BraveInputLateUpdatePatchClass>("BraveInputLateUpdatePatchCall");
}
}
private static bool BraveInputLateUpdatePatchCall(bool orig, BraveInput self)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)GameManager.Instance.CurrentGameType != 1 || !JollyCoopManager.gunfig.Enabled("Jolly Coop On"))
{
return orig;
}
if (self.m_playerID == 0)
{
return JollyCoopManager.gunfig.Enabled("1P Vibration");
}
return JollyCoopManager.gunfig.Enabled("2P Vibration");
}
}
[HarmonyPatch(typeof(PlayerController), "HandleGunEquipInternal")]
public class HandleGunEquipInternalPatchClass
{
[HarmonyILManipulator]
public static void HandleGunEquipInternalPatch(ILContext ctx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(ctx);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerController>(x, "outlineColor")
}))
{
val.EmitCall<HandleGunEquipInternalPatchClass>("HandleGunEquipInternalPatchCall");
}
}
private static Color HandleGunEquipInternalPatchCall(Color orig)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return Color.black;
}
}
private static bool[] playerOneSpawnMasterFlags = new bool[4];
private static bool[] playerTwoSpawnMasterFlags = new bool[4];
internal static bool playerOneHasTakenDamageInThisRoom = false;
internal static bool playerTwoHasTakenDamageInThisRoom = false;
internal static bool playerOneHasGivenMasteryToken = false;
internal static bool playerTwoHasGivenMasteryToken = false;
internal static Dictionary<PickupObject, bool> playerOneExclusivePickups = new Dictionary<PickupObject, bool>();
internal static List<PickupObject> playerOneExclusiveLoots = new List<PickupObject>();
internal static Dictionary<PickupObject, bool> playerTwoExclusivePickups = new Dictionary<PickupObject, bool>();
internal static List<PickupObject> playerTwoExclusiveLoots = new List<PickupObject>();
internal static List<RewardPedestal> playerOneExclusivePedestals = new List<RewardPedestal>();
internal static List<RewardPedestal> playerTwoExclusivePedestals = new List<RewardPedestal>();
internal static List<Chest> playerOneExclusiveChests = new List<Chest>();
internal static List<Chest> playerTwoExclusiveChests = new List<Chest>();
public static Color playerOneOutlineColor = OutlineColorManager.defaultOutlineColor;
public static Color playerTwoOutlineColor = OutlineColorManager.defaultOutlineColor;
public static void EmitCall<T>(this ILCursor iLCursor, string methodName, Type[] parameters = null, Type[] generics = null)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
MethodInfo methodInfo = AccessTools.Method(typeof(T), methodName, parameters, generics);
iLCursor.Emit(OpCodes.Call, (MethodBase)methodInfo);
}
public static T GetFieldInEnumerator<T>(object instance, string fieldNamePattern)
{
return (T)instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.Name.Contains("$" + fieldNamePattern) || f.Name.Contains("<" + fieldNamePattern + ">"))
.GetValue(instance);
}
public static void SetFieldInEnumerator<T>(object instance, string fieldNamePattern, T value)
{
instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.Name.Contains("$" + fieldNamePattern) || f.Name.Contains("<" + fieldNamePattern + ">"))
.SetValue(instance, value);
}
public static bool TheNthTime(this Func<bool> predict, int n = 1)
{
for (int i = 0; i < n; i++)
{
if (!predict())
{
return false;
}
}
return true;
}
}
public class OutlineColorManager
{
private class OutlineColorDataFile
{
[Serializable]
public class OutlineColorEntry
{
public string name = "";
public float[] outline_color = new float[0];
}
public List<OutlineColorEntry> outline_colors = new List<OutlineColorEntry>();
}
public class OutlineColorItem
{
public string name;
public Color color;
}
public static OutlineColorManager instance;
private List<string> outlineColorNameList = new List<string>();
private Dictionary<string, OutlineColorItem> registeredOutlineColors = new Dictionary<string, OutlineColorItem>();
public string folderPath;
public static readonly Color defaultOutlineColor = Color.black;
public List<string> OutlineColorNameList => outlineColorNameList;
public Dictionary<string, OutlineColorItem> RegisteredOutlineColors => registeredOutlineColors;
public OutlineColorManager()
{
folderPath = ETGMod.FolderPath((BaseUnityPlugin)(object)JollyCoopModule.instance);
instance = this;
LoadAllOutlineColorData();
}
private void LoadDefaultOutlineColorData()
{
//IL_001a: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
AddOutlineColor("black", new Color(0f, 0f, 0f, 1f));
AddOutlineColor("red", new Color(1f, 0f, 0f, 1f));
AddOutlineColor("green", new Color(0f, 1f, 0f, 1f));
AddOutlineColor("blue", new Color(0f, 0f, 1f, 1f));
AddOutlineColor("yellow", new Color(1f, 1f, 0f, 1f));
AddOutlineColor("cyan", new Color(0f, 1f, 1f, 1f));
AddOutlineColor("magenta", new Color(1f, 0f, 1f, 1f));
AddOutlineColor("white", new Color(1f, 1f, 1f, 1f));
AddOutlineColor("orange", new Color(1f, 0.5f, 0f, 1f));
AddOutlineColor("purple", new Color(0.5f, 0f, 0.5f, 1f));
AddOutlineColor("pink", new Color(1f, 0.75f, 0.8f, 1f));
AddOutlineColor("brown", new Color(0.65f, 0.16f, 0.16f, 1f));
AddOutlineColor("gray", new Color(0.5f, 0.5f, 0.5f, 1f));
}
public void LoadAllOutlineColorData()
{
outlineColorNameList.Clear();
registeredOutlineColors.Clear();
LoadDefaultOutlineColorData();
string[] files = Directory.GetFiles(folderPath, "*.jcprofile", SearchOption.AllDirectories);
Debug.Log((object)$"找到 {files.Length} 个 .jcprofile 文件。Find {files.Length} jcprofile files.");
string[] array = files;
foreach (string text in array)
{
try
{
OutlineColorDataFile outlineColorDataFile = JsonConvert.DeserializeObject<OutlineColorDataFile>(File.ReadAllText(text));
if (outlineColorDataFile == null)
{
Debug.LogWarning((object)("无法解析 JSON 文件: " + text + "。Unable to parse JSON file: " + text + "."));
}
else
{
ProcessOutlineColorFile(outlineColorDataFile, text);
}
}
catch (Exception ex)
{
Debug.LogError((object)("加载文件失败 " + text + ": " + ex.Message + "。Failed to load file " + text + ": " + ex.Message + "."));
}
}
Debug.Log((object)$"加载轮廓颜色: {outlineColorNameList.Count} 个。Load outline colors: {outlineColorNameList.Count}.");
}
private void ProcessOutlineColorFile(OutlineColorDataFile data, string filePath)
{
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
if (data.outline_colors == null)
{
Debug.LogWarning((object)("文件没有 outline_colors 字段: " + filePath + "。The file does not have an outline_comors field: " + filePath + "."));
return;
}
Color color = default(Color);
foreach (OutlineColorDataFile.OutlineColorEntry outline_color in data.outline_colors)
{
if (outline_color == null)
{
Debug.LogWarning((object)("轮廓颜色配置条目为 null,文件: " + filePath + "。Outline color configuration entry is null, file: " + filePath + "."));
}
else if (string.IsNullOrEmpty(outline_color.name))
{
Debug.LogWarning((object)("轮廓颜色配置缺少名称,文件: " + filePath + "。The contour color configuration is missing a name, file: " + filePath + "."));
}
else if (outline_color.outline_color == null || outline_color.outline_color.Length < 3)
{
Debug.LogWarning((object)("轮廓颜色配置格式错误: " + outline_color.name + ",需要3个RGB值,文件: " + filePath + "。Outline color configuration format error: " + outline_color.name + ", requires 3 RGB values, file: " + filePath + "."));
}
else
{
((Color)(ref color))..ctor(Mathf.Clamp01(outline_color.outline_color[0]), Mathf.Clamp01(outline_color.outline_color[1]), Mathf.Clamp01(outline_color.outline_color[2]), 1f);
AddOutlineColor(outline_color.name, color);
}
}
}
private string GetUniqueName<T>(Dictionary<string, T> dict, string baseName)
{
if (!dict.ContainsKey(baseName))
{
return baseName;
}
int num = 0;
string text = baseName + "_";
bool flag = false;
foreach (string key in dict.Keys)
{
if (!(key == baseName) && key.StartsWith(text) && int.TryParse(key.Substring(text.Length), out var result))
{
flag = true;
if (result > num)
{
num = result;
}
}
}
if (!flag)
{
return baseName + "_1";
}
return $"{baseName}_{num + 1}";
}
public Color GetOutlineColorByName(string name)
{
//IL_0003: 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_001a: Unknown result type (might be due to invalid IL or missing references)
if (name == null)
{
return defaultOutlineColor;
}
if (registeredOutlineColors.TryGetValue(name, out var value))
{
return value.color;
}
return defaultOutlineColor;
}
public bool AddOutlineColor(string name, Color color)
{
//IL_002c: 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)
if (string.IsNullOrEmpty(name))
{
return false;
}
string uniqueName = GetUniqueName(registeredOutlineColors, name);
registeredOutlineColors[uniqueName] = new OutlineColorItem
{
name = uniqueName,
color = color
};
if (!outlineColorNameList.Contains(uniqueName))
{
outlineColorNameList.Add(uniqueName);
}
return true;
}
}