using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using ContentSettings.API;
using ContentSettings.API.Settings;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreColors.Patches;
using UnityEngine;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ViViKo.MoreColors")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("MoreColors")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyInformationalVersion("1.5.1")]
[assembly: AssemblyProduct("MoreColors")]
[assembly: AssemblyTitle("ViViKo.MoreColors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.1.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 MoreColors
{
[ContentWarningPlugin("ViViKo.MoreColors", "MoreColors", true)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("ViViKo.MoreColors", "MoreColors", "1.5.1")]
public class MoreColors : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("ViViKo.MoreColors");
public static MoreColors Instance;
public bool applyToSuit;
public List<Color> colors = new List<Color>(47)
{
HexToUnity(0f, 0f, 0f),
HexToUnity(255f, 255f, 255f),
HexToUnity(255f, 0f, 0f),
HexToUnity(0f, 255f, 0f),
HexToUnity(0f, 0f, 255f),
HexToUnity(255f, 255f, 0f),
HexToUnity(0f, 255f, 255f),
HexToUnity(255f, 0f, 255f),
HexToUnity(192f, 192f, 192f),
HexToUnity(128f, 128f, 128f),
HexToUnity(128f, 0f, 0f),
HexToUnity(128f, 128f, 0f),
HexToUnity(0f, 128f, 0f),
HexToUnity(128f, 0f, 128f),
HexToUnity(0f, 128f, 128f),
HexToUnity(0f, 0f, 128f),
HexToUnity(255f, 99f, 71f),
HexToUnity(127f, 255f, 0f),
HexToUnity(184f, 134f, 11f),
HexToUnity(0f, 250f, 154f),
HexToUnity(47f, 79f, 79f),
HexToUnity(175f, 238f, 238f),
HexToUnity(106f, 90f, 205f),
HexToUnity(188f, 143f, 143f),
HexToUnity(230f, 230f, 250f),
HexToUnity(176f, 196f, 222f),
HexToUnity(139f, 69f, 19f),
HexToUnity(255f, 192f, 203f),
HexToUnity(136f, 176f, 75f),
HexToUnity(247f, 202f, 201f),
HexToUnity(146f, 168f, 209f),
HexToUnity(149f, 82f, 81f),
HexToUnity(181f, 101f, 167f),
HexToUnity(0f, 155f, 119f),
HexToUnity(221f, 65f, 36f),
HexToUnity(214f, 80f, 118f),
HexToUnity(68f, 184f, 172f),
HexToUnity(239f, 192f, 80f),
HexToUnity(91f, 94f, 166f),
HexToUnity(155f, 35f, 53f),
HexToUnity(223f, 207f, 190f),
HexToUnity(85f, 180f, 176f),
HexToUnity(225f, 93f, 68f),
HexToUnity(127f, 205f, 205f),
HexToUnity(188f, 36f, 60f),
HexToUnity(195f, 68f, 122f),
HexToUnity(152f, 180f, 212f)
};
public PlayerCustomizer customizer;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll();
SettingsLoader.RegisterSetting("ViViKo Mods", "MoreColors", (Setting)(object)new SuitColorSetting());
Logger.LogInfo((object)"Plugin MoreColors v1.5.1 is loaded!");
}
public static Color HexToUnity(float r, float g, float b)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
return new Color(r / 255f, g / 255f, b / 255f, 1f);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ViViKo.MoreColors";
public const string PLUGIN_NAME = "MoreColors";
public const string PLUGIN_VERSION = "1.5.1";
}
}
namespace MoreColors.Patches
{
[HarmonyPatch(typeof(BedBoss))]
public class BedBossPatch
{
[HarmonyPatch("Awake")]
[HarmonyPrefix]
private static void AwakePatch(BedBoss __instance)
{
List<Material> materials = __instance.materials.ToList();
Material oldMaterial = __instance.materials[0];
MoreColors.Instance.colors.ForEach(delegate(Color color)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
Material val = Object.Instantiate<Material>(oldMaterial);
val.color = color;
materials.Add(val);
});
__instance.materials = materials.ToArray();
}
}
[HarmonyPatch(typeof(PlayerCustomizer))]
public class PlayerCustomizerPatch
{
[HarmonyPatch("Awake")]
[HarmonyPrefix]
private static void AwakePatch(PlayerCustomizer __instance)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_005f: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0104: 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_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: 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)
MoreColors.Instance.customizer = __instance;
Transform transform = __instance.colorsRoot.transform;
transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y - 30f, transform.localPosition.z);
GridLayoutGroup component = __instance.colorsRoot.GetComponent<GridLayoutGroup>();
component.cellSize = new Vector2(90f, 90f);
component.spacing = new Vector2(2f, 2f);
component.constraint = (Constraint)1;
component.constraintCount = 6;
((LayoutGroup)component).childAlignment = (TextAnchor)0;
Transform val = transform.parent.Find("Back");
val.localPosition = new Vector3(val.localPosition.x, val.localPosition.y - 50f, val.localPosition.z);
Transform val2 = transform.parent.Find("Apply");
val2.localPosition = new Vector3(val2.localPosition.x, val2.localPosition.y - 50f, val2.localPosition.z);
Transform val3 = transform.parent.Find("Hats");
val3.localPosition = new Vector3(val3.localPosition.x, val3.localPosition.y + 100f, val3.localPosition.z);
__instance.colorsToPickFrom.AddRange(MoreColors.Instance.colors);
}
}
public class SuitColorSetting : BoolSetting, ICustomSetting, IExposedSetting
{
public override void ApplyValue()
{
MoreColors.Instance.applyToSuit = ((BoolSetting)this).Value;
}
public string GetDisplayName()
{
return "Face Color applies to suit";
}
protected override bool GetDefaultValue()
{
return true;
}
}
[HarmonyPatch(typeof(PlayerVisor))]
public class PlayerVisorPatch
{
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static void UpdatePatch(PlayerVisor __instance)
{
//IL_005b: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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)
//IL_0094: 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_00da: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.m_player == (Object)null || (Object)(object)__instance.m_material == (Object)null || !__instance.hue.IsSome || !__instance.visorColor.IsNone)
{
return;
}
try
{
Color val = MoreColors.Instance.customizer.colorsToPickFrom[__instance.visorColorIndex];
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(__instance.m_material.GetColor("_Color"), ref num, ref num2, ref num3);
__instance.visorColor = Optionable<Color>.Some(Color.HSVToRGB(__instance.hue.Value, num2, num3));
__instance.m_material.SetColor("_Color", val);
if (MoreColors.Instance.applyToSuit)
{
SkinnedMeshRenderer[] componentsInChildren = ((Component)((Component)__instance).transform.GetChild(1)).GetComponentsInChildren<SkinnedMeshRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Renderer)componentsInChildren[i]).material.color = val;
}
}
}
catch
{
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}