using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.Utils;
using Rewired.Utils;
using RoR2;
using UnityEngine;
using UnityEngine.SceneManagement;
[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HighContrastEnemies")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+07ec65656d515ec8afd82f69b54f6a2e9c345b45")]
[assembly: AssemblyProduct("HighContrastEnemies")]
[assembly: AssemblyTitle("HighContrastEnemies")]
[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 HighContrastEnemies
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("swuff.HighContrastEnemies", "HighContrastEnemies", "1.0.0")]
public class HighContrastEnemies : BaseUnityPlugin
{
public const string PluginGUID = "swuff.HighContrastEnemies";
public const string PluginAuthor = "swuff";
public const string PluginName = "HighContrastEnemies";
public const string PluginVersion = "1.0.0";
public List<Highlight> highlightsAddedByTheModIHateThisButBetterSafeThanSorryOmfg = new List<Highlight>();
public static Dictionary<string, Color32> StageColorDict = new Dictionary<string, Color32>();
public static Dictionary<string, string> EnemyOverrideDict = new Dictionary<string, string>();
public static ConfigEntry<string> UniversalEnemies { get; set; }
public static ConfigEntry<bool> IncludeAllies { get; set; }
public static ConfigEntry<bool> IncludePlayers { get; set; }
public static ConfigEntry<bool> OnlyEnemies { get; set; }
public static ConfigEntry<bool> OverridePlayerColorWithBodyColor { get; set; }
public static ConfigEntry<float> OutlineThickness { get; set; }
public static ConfigEntry<string> MonoColor { get; set; }
public static ConfigEntry<string> BlueStages { get; set; }
public static ConfigEntry<string> CyanStages { get; set; }
public static ConfigEntry<string> GreenStages { get; set; }
public static ConfigEntry<string> RedStages { get; set; }
public static ConfigEntry<string> WhiteStages { get; set; }
public static ConfigEntry<string> YellowStages { get; set; }
public static ConfigEntry<string> PinkStages { get; set; }
public static ConfigEntry<string> PurpleStages { get; set; }
public static ConfigEntry<string> Custom1 { get; set; }
public static ConfigEntry<string> Custom1Stages { get; set; }
public static ConfigEntry<string> Custom2 { get; set; }
public static ConfigEntry<string> Custom2Stages { get; set; }
public static ConfigEntry<string> Custom3 { get; set; }
public static ConfigEntry<string> Custom3Stages { get; set; }
public void Awake()
{
MakeConfig();
Hooks();
ColorSetup();
}
public void MakeConfig()
{
Custom1 = ((BaseUnityPlugin)this).Config.Bind<string>("Custom Outline Colors", "Custom Color 1", "#FFFFFFAA", "A custom outline color value in hex format (#RRGGBB / #RRGGBBAA). DEFAULT: Half-transparent white (#FFFFFFAA)");
Custom2 = ((BaseUnityPlugin)this).Config.Bind<string>("Custom Outline Colors", "Custom Color 2", "", "A custom outline color value in hex format (#RRGGBB / #RRGGBBAA).");
Custom3 = ((BaseUnityPlugin)this).Config.Bind<string>("Custom Outline Colors", "Custom Color 3", "", "A custom outline color value in hex format (#RRGGBB / #RRGGBBAA).");
OutlineThickness = ((BaseUnityPlugin)this).Config.Bind<float>("General Settings", "Outline Strength", 1f, "The strength of the outline to apply to monsters.");
MonoColor = ((BaseUnityPlugin)this).Config.Bind<string>("General Settings", "Outline Color", "PerStage", "The color of outline to use for monsters, universally.\nAcceptable entries:\n\"PerStage\",\"Blue\",\"Green\",\"Red\",\"Yellow\",\"Cyan\",\"Pink\",\"Purple\",\"White\",\"Custom1\",\"Custom2\",\"Custom3\"");
BlueStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Blue Stages", "moon,moon2,itmoon,meridian,solutionalhaunt", "Stages in which enemies should receive a blue outline, if per-stage setting is used.");
CyanStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Cyan Stages", "sulfurpools,goolake,helminthroost,dampcavesimple,itgoolake,ancientloft,ironalluvium,ironalluvium2,itancientloft,lemuriantemple,repurposedcrater,wispgraveyard", "Stages in which enemies should receive a cyan outline, if per-stage setting is used.");
GreenStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Green Stages", "village,villagenight,", "Stages in which enemies should receive a green outline, if per-stage setting is used.");
RedStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Red Stages", "frozenwall,itfrozenwall,snowyforest,nest,habitatfall,limbo", "Stages in which enemies should receive a red outline, if per-stage setting is used.");
WhiteStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "White Stages", "artifactworld,artifactworld01,artifactworld02,artifactworld03,arena,voidstage,voidraid,voidoutro,goldshores", "Stages in which enemies should receive a white outline, if per-stage setting is used.");
YellowStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Yellow Stages", "blackbeach,blackbeach2,conduitcanyon,skymeadow,itskymeadow", "Stages in which enemies should receive a yellow outline, if per-stage setting is used.");
PinkStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Pink Stages", "golemplains,golemplains2,rootjungle,foggyswamp,habitat,village,villagenight,FBLScene", "Stages in which enemies should receive a pink outline, if per-stage setting is used.");
PurpleStages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Purple Stages", "lakes,lakesnight,shipgraveyard", "Stages in which enemies should receive a purple outline, if per-stage setting is used.");
Custom1Stages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Custom Color 1 Stages", "", "Stages in which enemies should use Custom Color 1.");
Custom2Stages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Custom Color 2 Stages", "", "Stages in which enemies should use Custom Color 2.");
Custom3Stages = ((BaseUnityPlugin)this).Config.Bind<string>("Per-Stage Outline Settings", "Custom Color 3 Stages", "", "Stages in which enemies should use Custom Color 3.");
OnlyEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Specific Highlights", "Use Only Specified Highlights", false, "If only bodies from the list of 'Enemies to Outline' should be highlighted.");
UniversalEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Specific Highlights", "Enemies to Outline", "MimicBody,#00000000", "Overrides to ensure a monster always has a specific outline color. e.g.:\nLemurianBody,#FFFFFFFF;MimicBody,#00000000");
IncludeAllies = ((BaseUnityPlugin)this).Config.Bind<bool>("Ally Highlights", "Highlight Allies", false, "If only bodies from the list of 'Enemies to Outline' should be highlighted.");
IncludePlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Ally Highlights", "Highlight Players", false, "If players specifically should be highlighted.");
OverridePlayerColorWithBodyColor = ((BaseUnityPlugin)this).Config.Bind<bool>("Ally Highlights", "Use Body Color", true, "If player bodies should override their highlight color with their body color.");
}
public void ColorSetup()
{
//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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_0038: 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_005f: 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_0086: 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)
//IL_00b8: 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_00d8: 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_010e: Unknown result type (might be due to invalid IL or missing references)
RegisterStageColors(BlueStages, Color32.op_Implicit(Color.blue));
RegisterStageColors(GreenStages, Color32.op_Implicit(Color.green));
RegisterStageColors(CyanStages, Color32.op_Implicit(Color.cyan));
RegisterStageColors(RedStages, Color32.op_Implicit(Color.red));
RegisterStageColors(WhiteStages, Color32.op_Implicit(Color.white));
RegisterStageColors(PinkStages, new Color32(byte.MaxValue, (byte)105, (byte)180, byte.MaxValue));
RegisterStageColors(PurpleStages, new Color32((byte)128, (byte)0, (byte)128, byte.MaxValue));
RegisterStageColors(YellowStages, Color32.op_Implicit(Color.yellow));
RegisterStageColors(Custom1Stages, HexToColor(Custom1.Value));
RegisterStageColors(Custom2Stages, HexToColor(Custom2.Value));
RegisterStageColors(Custom3Stages, HexToColor(Custom3.Value));
}
public void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
CharacterBody.OnDeathStart += new hook_OnDeathStart(CharacterBody_OnDeathStart);
CharacterModel.OnSkinApplied += new hook_OnSkinApplied(CharacterModel_OnSkinApplied);
}
private void PauseStopController_Pause(orig_Pause orig, PauseStopController self, bool shouldPause)
{
orig.Invoke(self, shouldPause);
if (!shouldPause)
{
return;
}
foreach (Highlight item in highlightsAddedByTheModIHateThisButBetterSafeThanSorryOmfg)
{
item.isOn = false;
((Behaviour)item).enabled = false;
}
}
private void PauseStopController_PauseStop(orig_PauseStop orig, PauseStopController self, PauseMessage pauseMessage)
{
orig.Invoke(self, pauseMessage);
foreach (Highlight item in highlightsAddedByTheModIHateThisButBetterSafeThanSorryOmfg)
{
item.isOn = true;
((Behaviour)item).enabled = true;
}
}
private void CharacterModel_OnSkinApplied(orig_OnSkinApplied orig, CharacterModel self, int skinIndex)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0049: Invalid comparison between Unknown and I4
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Invalid comparison between Unknown and I4
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: 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_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, skinIndex);
if ((Object)(object)self.body == (Object)null || (Object)(object)self.body.master == (Object)null)
{
return;
}
TeamIndex teamIndex = self.body.master.teamIndex;
if ((int)teamIndex != 2 && (int)teamIndex != 3 && (int)teamIndex != 4 && !IncludeAllies.Value && (!self.body.isPlayerControlled || !IncludePlayers.Value))
{
return;
}
Highlight val = ((Component)self.body).gameObject.AddComponent<Highlight>();
highlightsAddedByTheModIHateThisButBetterSafeThanSorryOmfg.Add(val);
List<Renderer> targetRendererList = val.GetTargetRendererList();
targetRendererList.Clear();
RendererInfo[] baseRendererInfos = self.baseRendererInfos;
foreach (RendererInfo val2 in baseRendererInfos)
{
if (!val2.ignoreOverlays)
{
targetRendererList.Add(val2.renderer);
}
}
if (targetRendererList.Count > 0)
{
Color customColor = Color32.op_Implicit(GetOutlineColor());
if (EnemyOverrideDict.ContainsKey(((Object)self.body.master.bodyPrefab).name) && EnemyOverrideDict.TryGetValue(((Object)self.body.master.bodyPrefab).name, out var value))
{
customColor = Color32.op_Implicit(HexToColor(value));
}
if (self.body.isPlayerControlled && OverridePlayerColorWithBodyColor.Value)
{
customColor = self.body.bodyColor;
}
((Behaviour)val).enabled = true;
val.CustomColor = customColor;
val.highlightColor = (HighlightColor)3;
val.strength = OutlineThickness.Value;
val.isOn = true;
val.SetTargetRendererList(targetRendererList);
}
if (OnlyEnemies.Value && !EnemyOverrideDict.ContainsKey(((Object)self.body.master.bodyPrefab).name))
{
((Behaviour)val).enabled = false;
val.isOn = false;
}
}
private void CharacterBody_OnDeathStart(orig_OnDeathStart orig, CharacterBody self)
{
orig.Invoke(self);
Highlight[] components = ((Component)self).gameObject.GetComponents<Highlight>();
foreach (Highlight val in components)
{
if (highlightsAddedByTheModIHateThisButBetterSafeThanSorryOmfg.Contains(val))
{
highlightsAddedByTheModIHateThisButBetterSafeThanSorryOmfg.Remove(val);
Object.Destroy((Object)(object)val);
}
}
}
public Color32 GetOutlineColor()
{
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
switch (MonoColor.Value)
{
case "PerStage":
{
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (StageColorDict.TryGetValue(name, out var value))
{
return value;
}
Debug.Log((object)("GetOutlineColor : Failed to find correct color for scene " + name + "; defaulting to white."));
return Color32.op_Implicit(Color.white);
}
case "Blue":
return Color32.op_Implicit(Color.blue);
case "Cyan":
return Color32.op_Implicit(Color.cyan);
case "Green":
return Color32.op_Implicit(Color.green);
case "Red":
return Color32.op_Implicit(Color.red);
case "White":
return Color32.op_Implicit(Color.white);
case "Yellow":
return Color32.op_Implicit(Color.yellow);
case "Pink":
return new Color32(byte.MaxValue, (byte)105, (byte)180, byte.MaxValue);
case "Purple":
return new Color32((byte)128, (byte)0, (byte)128, byte.MaxValue);
case "Custom1":
return HexToColor(Custom1.Value);
case "Custom2":
return HexToColor(Custom2.Value);
case "Custom3":
return HexToColor(Custom3.Value);
default:
Debug.LogWarning((object)("GetOutlineColor : Failed to find color type " + MonoColor.Value + "!! Defaulting to white."));
return Color32.op_Implicit(Color.white);
}
}
public static Color32 HexToColor(string hex)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
if (Utility.IsNullOrWhiteSpace(hex))
{
Debug.Log((object)("HexToColor : Failed to make color from entry \"" + hex + "\""));
return Color32.op_Implicit(Color.white);
}
if (hex.StartsWith("#"))
{
hex = hex.Substring(1);
}
byte b = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
byte b2 = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
byte b3 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
byte b4 = byte.MaxValue;
if (hex.Length >= 8)
{
b4 = byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
}
return new Color32(b, b2, b3, b4);
}
public void RegisterStageColors(ConfigEntry<string> stageList, Color32 color)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(stageList.Value))
{
return;
}
string[] array = stageList.Value.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
string text2 = text.Trim();
if (!string.IsNullOrEmpty(text2))
{
StageColorDict[text2] = color;
}
}
}
public void RegisterEnemyColors(ConfigEntry<string> enemyList, Color32 color)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(enemyList.Value))
{
return;
}
string[] array = enemyList.Value.Split(';');
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(',');
Color32 val = HexToColor(array3[1]);
if (!string.IsNullOrEmpty(array3[0]) && !string.IsNullOrEmpty(array3[1]) && !ExtensionMethods.IsNullOrDestroyed((object)val))
{
EnemyOverrideDict[array3[0]] = array3[1];
}
}
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}