using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sandbox.Arm;
using ULTRAKILL.Cheats;
using UltraSkins;
using UnityEngine;
using UnityEngine.UI;
[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("USGCColorOverride")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("USGC Color Override")]
[assembly: AssemblyTitle("USGCColorOverride")]
[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 USGCColorOverride
{
internal static class Extensions
{
public static void TryCopyValue<K, V>(this Dictionary<K, V> self, Dictionary<K, V> from, K key)
{
if (from.TryGetValue(key, out var value))
{
self.TryAdd(key, value);
}
}
public static bool TryGetComponentInParent<T>(this MonoBehaviour self, out T _comp)
{
T val = default(T);
((Component)self).TryGetComponent<T>(ref val);
_comp = val;
return _comp != null;
}
public static Color Clone(this Color self)
{
//IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
return new Color(self.r, self.g, self.b, self.a);
}
public static Color GetPixelFromTopLeft(this Texture2D self, int x, int y)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
return self.GetPixel(x, ((Texture)self).height - y - 1);
}
public static Color CloneModified(this Color self, float r = -1f, float g = -1f, float b = -1f, float a = -1f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
Color result = self.Clone();
if (r != -1f)
{
result.r = r;
}
if (g != -1f)
{
result.g = g;
}
if (b != -1f)
{
result.b = b;
}
if (a != -1f)
{
result.a = a;
}
return result;
}
internal static T[] Fill<T>(this T[] arr, T value)
{
Array.Fill(arr, value);
return arr;
}
internal static Color MultiplyHSV(this Color c, float h = 1f, float s = 1f, float v = 1f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(c, ref num, ref num2, ref num3);
return Color.HSVToRGB(h * num, s * num2, v * num3);
}
}
[Harmony]
internal class IconPatches
{
[HarmonyPatch(typeof(FistControl), "UpdateFistIcon")]
[HarmonyPostfix]
private static void PostUpdateFistIcon(FistControl __instance)
{
//IL_005c: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
Color pixelFromTopLeft = default(Color);
((Color)(ref pixelFromTopLeft))..ctor(0f, 0f, 0f, 0f);
switch (__instance.currentVarNum)
{
case 0:
{
if (Plugin.ColorOverrides.TryGetValue("T_Feedbacker_Palette", out var value2))
{
pixelFromTopLeft = value2.GetPixelFromTopLeft(0, 4);
}
break;
}
case 1:
{
if (Plugin.ColorOverrides.TryGetValue("v2_armtex_Palette", out var value3))
{
pixelFromTopLeft = value3.GetPixelFromTopLeft(2, 4);
}
break;
}
case 2:
{
if (Plugin.ColorOverrides.TryGetValue("T_GreenArm_Palette", out var value))
{
pixelFromTopLeft = value.GetPixelFromTopLeft(1, 4);
}
break;
}
}
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
__instance.fistIconColor = pixelFromTopLeft;
}
}
[HarmonyPatch(typeof(WeaponHUD), "UpdateImage")]
[HarmonyPostfix]
private static void PostUpdateImage(WeaponHUD __instance, Sprite icon, Sprite glowIcon, int variation)
{
//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)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
string key = UltraSkinsPatches.ComponentToKey(Object.FindObjectOfType<WeaponIcon>()) + "_Palette";
if (Plugin.ColorOverrides.TryGetValue(key, out var value))
{
Color pixelFromTopLeft = value.GetPixelFromTopLeft(variation, 4);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
((Graphic)__instance.img).color = pixelFromTopLeft;
((Graphic)__instance.glowImg).color = pixelFromTopLeft;
}
}
}
[HarmonyPatch(typeof(WeaponIcon), "UpdateIcon")]
[HarmonyPostfix]
private static void PostUpdateIcon(WeaponIcon __instance)
{
//IL_0031: 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_0038: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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_00ed: 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)
//IL_00fd: 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_0128: Unknown result type (might be due to invalid IL or missing references)
string key = UltraSkinsPatches.ComponentToKey(__instance) + "_Palette";
if (!Plugin.ColorOverrides.TryGetValue(key, out var value))
{
return;
}
bool flag = false;
Color pixelFromTopLeft = value.GetPixelFromTopLeft(__instance.variationColor, 0);
if (pixelFromTopLeft.a == 0f)
{
flag = true;
}
else
{
pixelFromTopLeft.a = 1f;
}
bool flag2 = false;
Color pixelFromTopLeft2 = value.GetPixelFromTopLeft(3, 2);
if (pixelFromTopLeft2.a == 0f)
{
flag2 = true;
}
else
{
pixelFromTopLeft2.a = 1f;
}
MaterialPropertyBlock val = new MaterialPropertyBlock();
Renderer[] variationColoredRenderers = __instance.variationColoredRenderers;
foreach (Renderer val2 in variationColoredRenderers)
{
if (!(((Object)val2).name.Contains("Spear") ? flag2 : flag))
{
Color val3 = (((Object)val2).name.Contains("Spear") ? pixelFromTopLeft2.Clone() : pixelFromTopLeft.Clone());
val2.GetPropertyBlock(val);
if (val2.sharedMaterial.HasProperty("_EmissiveColor"))
{
val.SetColor("_EmissiveColor", val3);
}
else
{
val.SetColor("_Color", val3);
}
val2.SetPropertyBlock(val);
}
}
Image[] variationColoredImages = __instance.variationColoredImages;
foreach (Image val4 in variationColoredImages)
{
((Graphic)val4).color = pixelFromTopLeft.Clone();
}
}
}
[Harmony]
internal class IndividualWeaponPatches
{
private static bool RevPierceReady = true;
private static float RevPierceCharge = 100f;
private static int RevPierceColor = 0;
private static int[] RevCoinColors;
private static int ShotColor = 0;
private static float ShotLerp = 0f;
private static float HammerSecondaryMeterColor = 0f;
private static float HammerLerp = 0f;
private static bool NailZapperWarningXColor = false;
private static float NailZapperTextLerp = 0f;
private static int NailZapperColor = 0;
private static bool NailZapperWarnColor = false;
private static bool RailShouldUpdatePostfix = false;
private static float RailFlashAmount = 0f;
private static float RocketLauncherCBCharge = 0f;
[HarmonyPatch(typeof(Revolver), "OnEnable")]
[HarmonyPostfix]
private static void RevPostEnable(Revolver __instance)
{
//IL_006b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
if (__instance.gunVariation != 0 && __instance.gunVariation != 2)
{
return;
}
string text = (__instance.altVersion ? "MinosRevolver" : "PistolNew");
if (!Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value))
{
return;
}
bool flag = true;
Color pixelFromTopLeft = value.GetPixelFromTopLeft(3, (__instance.gunVariation != 0) ? 1 : 0);
if (pixelFromTopLeft.a == 0f)
{
flag = false;
}
else
{
pixelFromTopLeft.a = 1f;
}
bool flag2 = true;
Color pixelFromTopLeft2 = value.GetPixelFromTopLeft(3, 2);
if (pixelFromTopLeft2.a == 0f)
{
flag2 = false;
}
else
{
pixelFromTopLeft2.a = 1f;
}
Transform val = ((Component)__instance).transform.Find("Revolver_Rerigged_" + (__instance.altVersion ? "Alternate" : "Standard"));
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Armature");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Upper Arm");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Forearm");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Hand");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Revolver_Bone");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
if (__instance.gunVariation == 0 && flag)
{
val = val.Find("ShootPoint" + (__instance.altVersion ? " (1)" : string.Empty));
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("ChargeEffect");
if (Object.op_Implicit((Object)(object)val))
{
Texture mainTexture = (Texture)(object)CreateColoredChargeOrb(pixelFromTopLeft, Plugin.t_charge, Plugin.t_charge_ID);
MeshRenderer val2 = default(MeshRenderer);
if (((Component)val).gameObject.TryGetComponent<MeshRenderer>(ref val2))
{
((Renderer)val2).material.mainTexture = mainTexture;
}
ParticleSystemRenderer val3 = default(ParticleSystemRenderer);
if (((Component)val).gameObject.TryGetComponent<ParticleSystemRenderer>(ref val3))
{
((Renderer)val3).material.mainTexture = mainTexture;
}
Light val4 = default(Light);
if (((Component)val).gameObject.TryGetComponent<Light>(ref val4))
{
val4.color = pixelFromTopLeft;
}
}
return;
}
val = val.Find("Canvas");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Panel");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
if (flag)
{
Image val5 = default(Image);
for (int i = 0; i < val.childCount; i++)
{
GameObject gameObject = ((Component)val.GetChild(i)).gameObject;
if (((Object)gameObject).name.Contains("Background") && gameObject.TryGetComponent<Image>(ref val5))
{
((Graphic)val5).color = pixelFromTopLeft;
}
}
}
Image val6 = default(Image);
if (((Component)val).TryGetComponent<Image>(ref val6) && flag2)
{
((Graphic)val6).color = pixelFromTopLeft2;
}
}
[HarmonyPatch(typeof(Revolver), "Update")]
[HarmonyPrefix]
private static void RevPreUpdate(Revolver __instance)
{
RevPierceReady = __instance.pierceReady;
RevPierceCharge = __instance.pierceCharge;
RevPierceColor = 0;
if (__instance.pierceReady)
{
return;
}
if (__instance.gunVariation == 0)
{
if (NoWeaponCooldown.NoCooldown)
{
RevPierceCharge = 100f;
}
float num = 1f;
if (__instance.altVersion)
{
num = 0.5f;
}
if (RevPierceCharge + 40f * Time.deltaTime < 100f)
{
RevPierceCharge += 40f * Time.deltaTime * num;
}
else
{
RevPierceCharge = 100f;
RevPierceReady = true;
}
if (RevPierceCharge < 50f)
{
RevPierceColor = 2;
}
else if (RevPierceCharge < 100f)
{
RevPierceColor = 1;
}
}
else if (RevPierceCharge + 480f * Time.deltaTime < 100f)
{
RevPierceCharge += 480f * Time.deltaTime;
}
else
{
RevPierceCharge = 100f;
RevPierceReady = true;
}
}
[HarmonyPatch(typeof(Revolver), "Update")]
[HarmonyPostfix]
private static void RevPostUpdate(Revolver __instance)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
string text = (__instance.altVersion ? "MinosRevolver" : "PistolNew");
if (Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value) && __instance.gunVariation == 0)
{
int y = 1;
switch (RevPierceColor)
{
case 1:
y = 2;
break;
case 2:
y = 3;
break;
}
Color pixelFromTopLeft = value.GetPixelFromTopLeft(0, y);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
__instance.screenProps.SetColor("_Color", pixelFromTopLeft);
}
((Renderer)__instance.screenMR).SetPropertyBlock(__instance.screenProps);
}
}
[HarmonyPatch(typeof(Revolver), "CheckCoinCharges")]
[HarmonyPrefix]
private static void RevPreCheckCoinCharges(Revolver __instance)
{
if (__instance.coinPanelsCharged == null || __instance.coinPanelsCharged.Length == 0)
{
__instance.coinPanelsCharged = new bool[__instance.coinPanels.Length];
}
RevCoinColors = new int[__instance.coinPanels.Length];
float num = ((__instance.gunVariation == 1) ? __instance.wc.rev1charge : __instance.wc.rev2charge);
for (int i = 0; i < __instance.coinPanels.Length; i++)
{
float num2 = 0f;
num2 = ((!__instance.altVersion || __instance.gunVariation != 2) ? (num / 100f - (float)i) : (num / 300f));
if (num2 < 1f)
{
RevCoinColors[i] = 2;
}
else
{
RevCoinColors[i] = 1;
}
}
}
[HarmonyPatch(typeof(Revolver), "CheckCoinCharges")]
[HarmonyPostfix]
private static void RevPostCheckCoinCharges(Revolver __instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_007b: Unknown result type (might be due to invalid IL or missing references)
string text = (__instance.altVersion ? "MinosRevolver" : "PistolNew");
if (!Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value))
{
return;
}
for (int i = 0; i < __instance.coinPanels.Length; i++)
{
Color pixelFromTopLeft = value.GetPixelFromTopLeft(__instance.gunVariation, RevCoinColors[i]);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
((Graphic)__instance.coinPanels[i]).color = pixelFromTopLeft;
}
}
}
[HarmonyPatch(typeof(Shotgun), "UpdateMeter")]
[HarmonyPrefix]
private static void PreShotUpdateMeter(Shotgun __instance)
{
if (__instance.variation == 1)
{
float num = __instance.timeToBeep;
if (num != 0f)
{
num = Mathf.MoveTowards(num, 0f, Time.deltaTime * 5f);
}
if (__instance.primaryCharge == 3)
{
if (num == 0f)
{
ShotColor = 0;
}
else if (num < 0.5f)
{
ShotColor = 1;
}
}
else
{
ShotColor = 4 - __instance.primaryCharge;
}
}
else if (!__instance.meterOverride)
{
if (__instance.grenadeForce > 0f)
{
ShotColor = 5;
ShotLerp = __instance.grenadeForce / 60f;
}
else if (__instance.variation == 0)
{
ShotColor = 6;
}
else if (MonoSingleton<WeaponCharges>.Instance.shoSawCharge == 1f)
{
ShotColor = 7;
}
else
{
ShotColor = 8;
}
}
}
[HarmonyPatch(typeof(Shotgun), "UpdateMeter")]
[HarmonyPostfix]
private static void PostShotUpdateMeter(Shotgun __instance)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ColorOverrides.TryGetValue("T_ShotgunNew_Palette", out var value))
{
return;
}
Color val = Color.black;
switch (ShotColor)
{
case 0:
val = value.GetPixelFromTopLeft(3, 1);
break;
case 1:
val = value.GetPixelFromTopLeft(3, 2);
break;
case 2:
val = value.GetPixelFromTopLeft(1, 3);
break;
case 3:
val = value.GetPixelFromTopLeft(1, 2);
break;
case 4:
val = value.GetPixelFromTopLeft(1, 1);
break;
case 5:
{
val = value.GetPixelFromTopLeft(__instance.variation, 1);
Color pixelFromTopLeft = value.GetPixelFromTopLeft(__instance.variation, 3);
if (val.a == 0f)
{
val = MonoSingleton<ColorBlindSettings>.Instance.variationColors[__instance.variation];
}
val.a = 1f;
if (pixelFromTopLeft.a == 0f)
{
((Color)(ref pixelFromTopLeft))..ctor(1f, 0.25f, 0.25f);
}
pixelFromTopLeft.a = 1f;
((Graphic)__instance.sliderFill).color = Color.Lerp(val, pixelFromTopLeft, ShotLerp);
return;
}
case 6:
val = value.GetPixelFromTopLeft(0, 1);
break;
case 7:
val = value.GetPixelFromTopLeft(2, 1);
break;
case 8:
val = value.GetPixelFromTopLeft(2, 2);
break;
}
if (val.a != 0f)
{
val.a = 1f;
((Graphic)__instance.sliderFill).color = val;
}
}
[HarmonyPatch(typeof(ColorBlindGet), "UpdateColor")]
[HarmonyPostfix]
private static void PostCBGUpdateColor(ColorBlindGet __instance)
{
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)__instance).name.Contains("Chainsaw") || !Plugin.ColorOverrides.TryGetValue("T_Chainsaw_Palette", out var value))
{
return;
}
int y = 1;
TrailRenderer val = null;
Light val2 = null;
if (Object.op_Implicit((Object)(object)((Component)__instance).transform.parent))
{
Nail val3 = default(Nail);
Chainsaw self = default(Chainsaw);
if (((Component)((Component)__instance).transform.parent).TryGetComponent<Nail>(ref val3))
{
y = 3;
if (((MonoBehaviour)(object)val3).TryGetComponentInParent<TrailRenderer>(out var _comp))
{
val = _comp;
}
Transform val4 = ((Component)val3).transform.Find("Point Light (1)");
Light val5 = default(Light);
if (Object.op_Implicit((Object)(object)val4) && ((Component)val4).gameObject.TryGetComponent<Light>(ref val5))
{
val2 = val5;
}
}
else if (((Component)((Component)__instance).transform.parent).TryGetComponent<Chainsaw>(ref self))
{
y = 2;
if (((MonoBehaviour)(object)self).TryGetComponentInParent<TrailRenderer>(out var _comp2))
{
val = _comp2;
}
}
}
Color pixelFromTopLeft = value.GetPixelFromTopLeft(2, y);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
if (!__instance.gotTarget)
{
__instance.GetTarget();
}
if (Object.op_Implicit((Object)(object)__instance.rend))
{
__instance.rend.GetPropertyBlock(__instance.block);
__instance.block.SetColor("_CustomColor1", pixelFromTopLeft);
__instance.rend.SetPropertyBlock(__instance.block);
}
if (Object.op_Implicit((Object)(object)val))
{
Color startColor = pixelFromTopLeft.Clone();
startColor.a = val.startColor.a;
val.startColor = startColor;
}
if (Object.op_Implicit((Object)(object)val2))
{
val2.color = pixelFromTopLeft;
}
}
}
[HarmonyPatch(typeof(ShotgunHammer), "UpdateMeter")]
[HarmonyPrefix]
private static void PreHammerUpdateMeter(ShotgunHammer __instance, bool forceUpdateTexture = false)
{
HammerLerp = 0f;
if (__instance.variation == 0)
{
float shoAltNadeCharge = MonoSingleton<WeaponCharges>.Instance.shoAltNadeCharge;
if (shoAltNadeCharge >= 1f)
{
HammerSecondaryMeterColor = 0f;
}
else
{
HammerSecondaryMeterColor = 1f;
}
}
else if (__instance.variation == 1)
{
float num = __instance.timeToBeep;
if (num != 0f)
{
num = Mathf.MoveTowards(num, 0f, Time.deltaTime * 5f);
}
float num2 = (float)__instance.primaryCharge / 3f;
if (__instance.primaryCharge == 3)
{
num2 = 1f;
if (num == 0f)
{
HammerSecondaryMeterColor = 2f;
}
else if (num < 0.5f)
{
HammerSecondaryMeterColor = 3f;
}
}
else if (__instance.primaryCharge == 1)
{
HammerSecondaryMeterColor = 4f;
}
else if (__instance.primaryCharge == 2)
{
HammerSecondaryMeterColor = 5f;
}
}
else if (__instance.variation == 2)
{
if (__instance.charging)
{
HammerSecondaryMeterColor = 6f;
HammerLerp = __instance.chargeForce / 60f;
}
else if (MonoSingleton<WeaponCharges>.Instance.shoSawCharge == 1f)
{
HammerSecondaryMeterColor = 7f;
}
else
{
HammerSecondaryMeterColor = 8f;
}
}
}
[HarmonyPatch(typeof(ShotgunHammer), "UpdateMeter")]
[HarmonyPostfix]
private static void PostHammerUpdateMeter(ShotgunHammer __instance, bool forceUpdateTexture = false)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0187: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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_00d5: 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_00e3: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ColorOverrides.TryGetValue("T_ImpactHammer_Palette", out var value))
{
return;
}
Color val = Color.black;
float hammerSecondaryMeterColor = HammerSecondaryMeterColor;
float num = hammerSecondaryMeterColor;
if (num != 0f)
{
if (num != 1f)
{
if (num != 2f)
{
if (num != 3f)
{
if (num != 4f)
{
if (num != 5f)
{
if (num == 6f)
{
val = value.GetPixelFromTopLeft(2, 1);
Color pixelFromTopLeft = value.GetPixelFromTopLeft(2, 3);
if (val.a == 0f)
{
val = MonoSingleton<ColorBlindSettings>.Instance.variationColors[__instance.variation];
}
val.a = 1f;
if (pixelFromTopLeft.a == 0f)
{
((Color)(ref pixelFromTopLeft))..ctor(1f, 0.25f, 0.25f);
}
pixelFromTopLeft.a = 1f;
((Graphic)__instance.secondaryMeter).color = Color.Lerp(val, pixelFromTopLeft, HammerLerp);
return;
}
if (num != 7f)
{
if (num == 8f)
{
val = value.GetPixelFromTopLeft(2, 2);
}
}
else
{
val = value.GetPixelFromTopLeft(2, 1);
}
}
else
{
val = value.GetPixelFromTopLeft(1, 3);
}
}
else
{
val = value.GetPixelFromTopLeft(1, 2);
}
}
else
{
val = value.GetPixelFromTopLeft(3, 2);
}
}
else
{
val = value.GetPixelFromTopLeft(3, 1);
}
}
else
{
val = value.GetPixelFromTopLeft(0, 2);
}
}
else
{
val = value.GetPixelFromTopLeft(0, 1);
}
if (val.a != 0f)
{
val.a = 1f;
((Graphic)__instance.secondaryMeter).color = val;
}
}
[HarmonyPatch(typeof(Nailgun), "Update")]
[HarmonyPostfix]
private static void NailPostUpdate(Nailgun __instance)
{
//IL_0055: 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_005c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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)
//IL_00c2: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
string text = (__instance.altVersion ? "SawbladeLauncher" : "NailgunNew");
if (Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value) && Object.op_Implicit((Object)(object)__instance.heatSlider))
{
Color val = value.GetPixelFromTopLeft(__instance.CorrectVariation(), 3);
if (val.a == 0f)
{
val = __instance.emptyColor;
}
val.a = 1f;
Color val2 = value.GetPixelFromTopLeft(3, 0);
if (val2.a == 0f)
{
val2 = __instance.fullColor;
}
val2.a = 1f;
((Graphic)__instance.sliderBg).color = Color.Lerp(val, val2, __instance.heatUp);
if (__instance.heatUp <= 0f && __instance.heatSinks < 1f)
{
((Graphic)__instance.sliderBg).color = new Color(0f, 0f, 0f, 0f);
}
}
}
[HarmonyPatch(typeof(Nailgun), "SetHeat")]
[HarmonyPostfix]
private static void NailPostSetHeat(Nailgun __instance, float heat)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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)
string text = (__instance.altVersion ? "SawbladeLauncher" : "NailgunNew");
if (!Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value))
{
return;
}
Color val = value.GetPixelFromTopLeft(3, 0);
if (val.a == 0f)
{
val = __instance.fullColor;
}
val.a = 1f;
if (Object.op_Implicit((Object)(object)__instance.heatSlider) && Object.op_Implicit((Object)(object)((Component)__instance.heatSlider).transform) && Object.op_Implicit((Object)(object)((Component)__instance.heatSlider).transform.Find("Fill Area")) && Object.op_Implicit((Object)(object)((Component)__instance.heatSlider).transform.Find("Fill Area").Find("Fill")))
{
Image component = ((Component)((Component)__instance.heatSlider).transform.Find("Fill Area").Find("Fill")).GetComponent<Image>();
if (Object.op_Implicit((Object)(object)component))
{
((Graphic)component).color = val;
}
}
}
[HarmonyPatch(typeof(Nailgun), "RefreshHeatSinkFill")]
[HarmonyPrefix]
private static void NailPreRefreshHeatSinkFill(Nailgun __instance)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < __instance.heatSinkImages.Length; i++)
{
((Graphic)__instance.heatSinkImages[i]).color = ((__instance.heatSinkFill < (float)(i + 1)) ? __instance.emptyColor : MonoSingleton<ColorBlindSettings>.Instance.variationColors[__instance.CorrectVariation()]);
}
}
[HarmonyPatch(typeof(Nailgun), "RefreshHeatSinkFill")]
[HarmonyPostfix]
private static void NailPostRefreshHeatSinkFill(Nailgun __instance)
{
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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_012b: Unknown result type (might be due to invalid IL or missing references)
string text = (__instance.altVersion ? "SawbladeLauncher" : "NailgunNew");
for (int i = 0; i < __instance.heatSinkImages.Length; i++)
{
if (!(__instance.heatSinkFill > (float)i))
{
continue;
}
int num = __instance.CorrectVariation();
Texture2D value2;
if (__instance.heatSinkFill >= (float)(i + 1))
{
if (Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value))
{
Color pixelFromTopLeft = value.GetPixelFromTopLeft(__instance.CorrectVariation(), 1);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
((Graphic)__instance.heatSinkImages[i]).color = pixelFromTopLeft;
}
}
}
else if (__instance.heatSinkFill < (float)(i + 1) && Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out value2))
{
Color pixelFromTopLeft2 = value2.GetPixelFromTopLeft(__instance.CorrectVariation(), 2);
if (pixelFromTopLeft2.a != 0f)
{
pixelFromTopLeft2.a = 1f;
((Graphic)__instance.heatSinkImages[i]).color = pixelFromTopLeft2;
}
}
}
if (Object.op_Implicit((Object)(object)__instance.ammoText) && Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value3))
{
Color pixelFromTopLeft3 = value3.GetPixelFromTopLeft(__instance.CorrectVariation(), 3);
if (pixelFromTopLeft3.a != 0f)
{
pixelFromTopLeft3.a = 1f;
((Graphic)__instance.ammoText).color = pixelFromTopLeft3;
}
}
}
[HarmonyPatch(typeof(Nailgun), "UpdateZapHud")]
[HarmonyPrefix]
private static void NailPreUpdateZapHud(Nailgun __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
NailZapperWarnColor = false;
if ((Object)(object)__instance.currentZapper == (Object)null)
{
RaycastHit val = default(RaycastHit);
EnemyIdentifierIdentifier val2 = default(EnemyIdentifierIdentifier);
if (Physics.Raycast(__instance.cc.GetDefaultPos(), ((Component)__instance.cc).transform.forward, ref val, float.PositiveInfinity, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3))) && !LayerMaskDefaults.IsMatchingLayer(((Component)((RaycastHit)(ref val)).collider).gameObject.layer, (LMD)1) && ((Component)((RaycastHit)(ref val)).collider).TryGetComponent<EnemyIdentifierIdentifier>(ref val2) && Object.op_Implicit((Object)(object)val2.eid) && !val2.eid.dead)
{
if (((RaycastHit)(ref val)).distance < __instance.zapper.maxDistance - 5f)
{
NailZapperColor = 0;
}
else
{
NailZapperColor = 1;
}
}
else
{
NailZapperColor = 2;
}
}
else if (__instance.currentZapper.distance > __instance.currentZapper.maxDistance || __instance.currentZapper.raycastBlocked)
{
NailZapperWarningXColor = __instance.currentZapper.breakTimer % 0.1f > 0.05f;
NailZapperColor = 3;
NailZapperWarnColor = true;
}
else
{
NailZapperTextLerp = (__instance.currentZapper.maxDistance - __instance.currentZapper.distance) / __instance.currentZapper.maxDistance;
NailZapperColor = 4;
}
}
[HarmonyPatch(typeof(Nailgun), "UpdateZapHud")]
[HarmonyPostfix]
private static void NailPostUpdateZapHud(Nailgun __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: 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_03cf: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00c6: 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_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_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: 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_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: 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_01fc: 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_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
string text = (__instance.altVersion ? "SawbladeLauncher" : "NailgunNew");
Color[] array = (Color[])(object)new Color[6]
{
Color.white,
MonoSingleton<ColorBlindSettings>.Instance.variationColors[2],
Color.gray,
Color.red,
Color.white,
Color.red
};
if (Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value))
{
Color pixelFromTopLeft = value.GetPixelFromTopLeft(2, 1);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
array[0] = pixelFromTopLeft.Clone();
}
pixelFromTopLeft = value.GetPixelFromTopLeft(2, 2);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
array[1] = pixelFromTopLeft.Clone();
}
pixelFromTopLeft = value.GetPixelFromTopLeft(2, 3);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
array[2] = pixelFromTopLeft.Clone();
}
pixelFromTopLeft = value.GetPixelFromTopLeft(3, 1);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
array[3] = pixelFromTopLeft.Clone();
}
pixelFromTopLeft = value.GetPixelFromTopLeft(3, 2);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
array[4] = pixelFromTopLeft.Clone();
}
pixelFromTopLeft = value.GetPixelFromTopLeft(3, 3);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
array[5] = pixelFromTopLeft.Clone();
}
Color val = default(Color);
((Color)(ref val))..ctor(1f, 0.2352f, 0.2353f);
pixelFromTopLeft = value.GetPixelFromTopLeft(3, 4);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
val = pixelFromTopLeft;
}
Image component = ((Component)((Component)__instance.zapMeter).transform.Find("Background")).gameObject.GetComponent<Image>();
((Graphic)component).color = val;
Image component2 = ((Component)__instance.distanceMeter.fillRect).gameObject.GetComponent<Image>();
((Graphic)component2).color = val.MultiplyHSV(1f, 1f, 0.5f);
Image component3 = ((Component)__instance.distanceMeter.handleRect).gameObject.GetComponent<Image>();
((Graphic)component3).color = val;
Image component4 = ((Component)((Component)__instance.distanceMeter).transform.Find("Handle (2)")).gameObject.GetComponent<Image>();
((Graphic)component4).color = val.MultiplyHSV(1f, 0.5f, 0.4f);
Image component5 = ((Component)((Component)__instance.distanceMeter).transform.Find("Handle (3)")).gameObject.GetComponent<Image>();
((Graphic)component5).color = val.MultiplyHSV(1f, 1f, 0.4f);
}
switch (NailZapperColor)
{
case 0:
((Graphic)__instance.statusText).color = array[0];
break;
case 1:
((Graphic)__instance.statusText).color = array[1];
break;
case 2:
((Graphic)__instance.statusText).color = array[2];
break;
case 3:
((Graphic)__instance.statusText).color = array[1];
break;
case 4:
((Graphic)__instance.statusText).color = Color.Lerp(array[3], array[0], NailZapperTextLerp);
break;
}
if (NailZapperWarnColor)
{
((Graphic)__instance.warningX).color = (NailZapperWarningXColor ? array[5] : array[4]);
}
}
[HarmonyPatch(typeof(Zapper), "Update")]
[HarmonyPostfix]
private static void NailPostZapperUpdate(Zapper __instance)
{
//IL_0085: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_0143: 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_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
GunControl instance = MonoSingleton<GunControl>.Instance;
GameObject val = instance.slot3.Find((GameObject obj) => IsZapper(obj));
string text = "NailgunNew";
if (Object.op_Implicit((Object)(object)val) && val.GetComponent<Nailgun>().altVersion)
{
text = "SawbladeLauncher";
}
if (Plugin.ColorOverrides.TryGetValue("T_" + text + "_Palette", out var value))
{
Color val2 = value.GetPixelFromTopLeft(2, 0);
if (val2.a == 0f)
{
val2 = Color.red;
}
val2.a = 1f;
Color val3 = default(Color);
((Color)(ref val3))..ctor(0.5f, 0.5f, 0.5f);
if (__instance.breakTimer > 0f)
{
val3 = ((__instance.breakTimer % 0.1f > 0.05f) ? Color.black : Color.white);
}
else if (__instance.distance > __instance.maxDistance - 10f)
{
val3 = Color.Lerp(val2, val3, (__instance.maxDistance - __instance.distance) / 10f);
}
__instance.lr.startColor = val3;
__instance.lr.endColor = val3;
}
}
private static bool IsZapper(GameObject obj)
{
Nailgun val = default(Nailgun);
if (obj.TryGetComponent<Nailgun>(ref val))
{
return val.variation == 2;
}
return false;
}
[HarmonyPatch(typeof(Railcannon), "OnEnable")]
[HarmonyPostfix]
private static void PostRailcannonEnable(Railcannon __instance)
{
//IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
if (__instance.variation != 2 || !Plugin.ColorOverrides.TryGetValue("T_Railcannon_Palette", out var value))
{
return;
}
bool flag = true;
Color pixelFromTopLeft = value.GetPixelFromTopLeft(3, 3);
if (pixelFromTopLeft.a == 0f)
{
flag = false;
}
else
{
pixelFromTopLeft.a = 1f;
}
bool flag2 = true;
Color pixelFromTopLeft2 = value.GetPixelFromTopLeft(3, 4);
if (pixelFromTopLeft2.a == 0f)
{
flag2 = false;
}
else
{
pixelFromTopLeft2.a = 1f;
}
Transform val = ((Component)__instance).transform.Find("Railcannon");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Armature");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("Base");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
val = val.Find("FullCharge");
if (Object.op_Implicit((Object)(object)val))
{
Transform val2 = val.Find("charge2");
SpriteRenderer val3 = default(SpriteRenderer);
if (Object.op_Implicit((Object)(object)val2) && flag2 && ((Component)val2).gameObject.TryGetComponent<SpriteRenderer>(ref val3))
{
Texture2D val4 = CreateColoredChargeOrb(pixelFromTopLeft2, Plugin.t_charge2, Plugin.t_charge2_ID);
val3.sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f));
}
Transform val5 = val.Find("Particle System (1)");
ParticleSystem val6 = default(ParticleSystem);
if (Object.op_Implicit((Object)(object)val5) && flag && ((Component)val5).gameObject.TryGetComponent<ParticleSystem>(ref val6))
{
MainModule main = val6.main;
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(pixelFromTopLeft);
}
}
}
[HarmonyPatch(typeof(Railcannon), "Update")]
[HarmonyPostfix]
private static void PreRailcannonUpdate(Railcannon __instance)
{
float num = __instance.altCharge;
if (__instance.wid.delay > 0f && num < __instance.wc.raicharge)
{
num = __instance.wc.raicharge;
}
float raicharge = __instance.wc.raicharge;
if (__instance.wid.delay > 0f)
{
raicharge = num;
}
RailShouldUpdatePostfix = __instance.wc.raicharge >= 5f || NoWeaponCooldown.NoCooldown;
}
[HarmonyPatch(typeof(Railcannon), "Update")]
[HarmonyPostfix]
private static void PostRailcannonUpdate(Railcannon __instance)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0048: Expected I4, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
if (RailShouldUpdatePostfix && Plugin.ColorOverrides.TryGetValue("T_Railcannon_Palette", out var value))
{
int y = 0;
WeaponVariant val = (WeaponVariant)__instance.variation;
WeaponVariant val2 = val;
switch ((int)val2)
{
case 0:
y = 0;
break;
case 1:
y = 1;
break;
case 2:
y = 2;
break;
}
Color pixelFromTopLeft = value.GetPixelFromTopLeft(3, y);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
__instance.fullChargeLight.color = pixelFromTopLeft;
MainModule main = __instance.fullChargeParticles.main;
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(pixelFromTopLeft);
}
}
}
[HarmonyPatch(typeof(Railcannon), "SetMaterialIntensity")]
[HarmonyPostfix]
private static void SetMaterialIntensity(Railcannon __instance, float newIntensity, bool isRecharging)
{
//IL_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ColorOverrides.TryGetValue("T_Railcannon_Palette", out var value))
{
return;
}
Color pixelFromTopLeft = value.GetPixelFromTopLeft(__instance.variation, 0);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
((Renderer)__instance.body).GetPropertyBlock(__instance.propBlock);
__instance.propBlock.SetColor("_EmissiveColor", pixelFromTopLeft);
((Renderer)__instance.body).SetPropertyBlock(__instance.propBlock);
for (int i = 0; i < __instance.pips.Length; i++)
{
SkinnedMeshRenderer val = __instance.pips[i];
((Renderer)val).GetPropertyBlock(__instance.propBlock);
__instance.propBlock.SetColor("_EmissiveColor", pixelFromTopLeft);
((Renderer)val).SetPropertyBlock(__instance.propBlock);
}
}
}
[HarmonyPatch(typeof(RailcannonMeter), "Update")]
[HarmonyPrefix]
private static void RailMeterPreUpdate(RailcannonMeter __instance)
{
if (((Behaviour)__instance.self).enabled || __instance.miniVersion.activeSelf)
{
RailFlashAmount = __instance.flashAmount;
if (MonoSingleton<WeaponCharges>.Instance.raicharge > 4f && !__instance.hasFlashed && Time.timeScale > 0f)
{
RailFlashAmount = 1f;
}
}
}
[HarmonyPatch(typeof(RailcannonMeter), "Update")]
[HarmonyPostfix]
private static void RailMeterPostUpdate(RailcannonMeter __instance)
{
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//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_0179: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
if ((!((Behaviour)__instance.self).enabled && !__instance.miniVersion.activeSelf) || !Plugin.ColorOverrides.TryGetValue("T_Railcannon_Palette", out var value))
{
return;
}
if (MonoSingleton<WeaponCharges>.Instance.raicharge > 4f)
{
Color val = value.GetPixelFromTopLeft(LastRailVariation(), 1);
if (val.a == 0f)
{
val = MonoSingleton<ColorBlindSettings>.Instance.railcannonFullColor;
}
val.a = 1f;
Color val2 = value.GetPixelFromTopLeft(LastRailVariation(), 3);
if (val2.a == 0f)
{
val2 = Color.white;
}
val2.a = 1f;
if (RailFlashAmount > 0f)
{
val = Color.Lerp(val, val2, RailFlashAmount);
}
Image[] trueMeters = __instance.trueMeters;
foreach (Image val3 in trueMeters)
{
if ((Object)(object)val3 != (Object)(object)__instance.colorlessMeter)
{
((Graphic)val3).color = val;
}
}
return;
}
Color pixelFromTopLeft = value.GetPixelFromTopLeft(LastRailVariation(), 2);
if (pixelFromTopLeft.a != 0f)
{
pixelFromTopLeft.a = 1f;
Image[] trueMeters2 = __instance.trueMeters;
foreach (Image val4 in trueMeters2)
{
((Graphic)val4).color = pixelFromTopLeft;
}
}
}
private static int LastRailVariation()
{
GunControl instance = MonoSingleton<GunControl>.Instance;
if (instance.slot4.Count == 0)
{
return 0;
}
Railcannon val = default(Railcannon);
if (instance.currentWeapon.TryGetComponent<Railcannon>(ref val))
{
return val.variation;
}
int index = 0;
if ((instance.variationMemory & instance.retainedVariations.TryGetValue(3, out var value)) && value >= 0 && value < instance.slot4.Count)
{
index = value;
}
Railcannon val2 = default(Railcannon);
if (instance.slot4[index].TryGetComponent<Railcannon>(ref val2))
{
return val2.variation;
}
return 0;
}
[HarmonyPatch(typeof(RocketLauncher), "Update")]
[HarmonyPrefix]
private static void PreRocketLauncherUpdate(RocketLauncher __instance)
{
RocketLauncherCBCharge = Mathf.MoveTowards(__instance.cbCharge, 1f, Time.deltaTime);
}
[HarmonyPatch(typeof(RocketLauncher), "Update")]
[HarmonyPostfix]
private static void PostRocketLauncherUpdate(RocketLauncher __instance)
{
//IL_0022: 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_0028: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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_00bc: 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_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_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ColorOverrides.TryGetValue("T_RocketLauncher_Palette", out var value))
{
return;
}
Color val = value.GetPixelFromTopLeft(__instance.variation, 1);
if (val.a == 0f)
{
val = MonoSingleton<ColorBlindSettings>.Instance.variationColors[__instance.variation];
}
val.a = 1f;
float num = 1f;
Color val2 = value.GetPixelFromTopLeft(__instance.variation, 2);
if (__instance.variation == 1)
{
if (val2.a == 0f)
{
val2 = Color.red;
}
val2.a = 1f;
if (RocketLauncherCBCharge > 0f)
{
val = Color.Lerp(val, val2, RocketLauncherCBCharge);
}
else if (MonoSingleton<WeaponCharges>.Instance.rocketCannonballCharge < 1f)
{
num = 0.5f;
}
}
else if (__instance.variation == 2)
{
if (val2.a == 0f)
{
val2 = Color.gray;
}
val2.a = 1f;
if (!__instance.firingNapalm && MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel < 0.25f)
{
val = val2;
}
}
for (int i = 0; i < __instance.variationColorables.Length; i++)
{
((Graphic)__instance.variationColorables[i]).color = val.CloneModified(-1f, -1f, -1f, __instance.colorablesTransparencies[i] * num);
}
}
public static Texture2D CreateColoredChargeOrb(Color color, Texture2D t_ch, Texture2D t_ID)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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)
Texture2D val = new Texture2D(32, 32);
for (int i = 0; i < ((Texture)val).width; i++)
{
for (int j = 0; j < ((Texture)val).height; j++)
{
Color val2 = color.Clone();
val2.a = t_ID.GetPixel(i, j).b;
Color pixel = t_ch.GetPixel(i, j);
if (pixel.a != 0f)
{
val2 = (val2 + pixel * (1f - val2.a)) / (val2.a + pixel.a * (1f - val2.a));
val2.a = pixel.a;
}
val.SetPixel(i, j, val2);
}
}
val.Apply();
return val;
}
}
[BepInPlugin("USGCColorOverride", "USGC Color Override", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static Dictionary<string, Texture2D> ColorOverrides;
internal const int EmissivesRow = 0;
internal const int ExtrasRow = 1;
internal const int ExtrasRow2 = 2;
internal const int ExtrasRow3 = 3;
internal const int IconRow = 4;
internal static Texture2D t_charge;
internal static Texture2D t_charge_ID;
internal static Texture2D t_charge2;
internal static Texture2D t_charge2_ID;
private void Awake()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
ColorOverrides = new Dictionary<string, Texture2D>();
t_charge = LoadTexture2D("charge.png");
t_charge_ID = LoadTexture2D("charge_ID.png");
t_charge2 = LoadTexture2D("charge2.png");
t_charge2_ID = LoadTexture2D("charge2_ID.png");
Harmony val = new Harmony("USGCColorOverride");
val.PatchAll();
Logger.LogInfo((object)"Plugin USGCColorOverride is loaded!");
}
private Texture2D LoadTexture2D(string fn)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("USGCColorOverride.Resources." + fn);
byte[] array = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array, 0, array.Length);
Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
ImageConversion.LoadImage(val, array, false);
return val;
}
}
internal struct Size
{
public int width;
public int height;
public Size(int w, int h)
{
width = w;
height = h;
}
}
[Harmony]
internal class UltraSkinsPatches
{
private static string[] ColorOverrideStrings = new string[16]
{
"T_PistolNew", "T_MinosRevolver", "T_ShotgunNew", "T_Chainsaw", "T_ImpactHammer", "T_NailgunNew", "T_SawbladeLauncher", "T_Railcannon", "T_RocketLauncher", "T_MainArm",
"T_Feedbacker", "v2_armtex", "T_GreenArm", "T_Washer", "T_Vacuum", "T_MainArm_White"
};
private static Color lineRendererColor = new Color(0.251f, 0.251f, 0.251f, 1f);
private static Size expectedSize = new Size(4, 5);
[HarmonyPatch(typeof(ULTRASKINHand), "LoadTextures")]
[HarmonyPostfix]
private static void PostLoadTextures(ref string __result)
{
if (__result != "Success")
{
return;
}
Plugin.ColorOverrides.Clear();
string[] colorOverrideStrings = ColorOverrideStrings;
foreach (string text in colorOverrideStrings)
{
string text2 = text + "_Palette";
if (ULTRASKINHand.autoSwapCache.TryGetValue(text2, out var value))
{
if (value.width == expectedSize.width && value.height == expectedSize.height)
{
Plugin.ColorOverrides.TryAdd(text2, (Texture2D)(object)((value is Texture2D) ? value : null));
continue;
}
Plugin.Logger.LogWarning((object)$"Failed to load palette {text2}.png. Texture size {value.width}x{value.height} does not match expected size {expectedSize.width}x{expectedSize.height}");
}
}
}
[HarmonyPatch(typeof(ULTRASKINHand), "GetVarationColor")]
[HarmonyPostfix]
private static void PostGetVariationColor(ref Color __result, TextureOverWatch TOW)
{
//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_0127: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: 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_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Invalid comparison between Unknown and I4
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
Color test = __result;
bool flag = false;
bool flag2 = false;
if (((Object)((Component)TOW).gameObject).name == "RightArm")
{
WeaponIcon componentInParent = ((Component)TOW).GetComponentInParent<WeaponIcon>();
int variationColor = componentInParent.variationColor;
int num;
switch (ComponentToKey((MonoBehaviour)(object)componentInParent, ref variationColor))
{
default:
num = 2;
break;
case "T_Washer":
num = 1;
break;
case "T_MinosRevolver":
case "T_PistolNew":
num = 0;
break;
}
int y = num;
if (Plugin.ColorOverrides.TryGetValue("T_MainArm_Palette", out var value))
{
test = value.GetPixelFromTopLeft(componentInParent.variationColor, y);
flag = true;
}
}
else if (Object.op_Implicit((Object)(object)((Component)TOW).GetComponentInParent<WeaponIcon>()))
{
WeaponIcon componentInParent2 = ((Component)TOW).GetComponentInParent<WeaponIcon>();
int variationColor2 = componentInParent2.variationColor;
string key = ComponentToKey((MonoBehaviour)(object)componentInParent2, ref variationColor2) + "_Palette";
if (Plugin.ColorOverrides.TryGetValue(key, out var value2))
{
test = value2.GetPixelFromTopLeft(variationColor2, 0);
flag = true;
}
}
else if (Object.op_Implicit((Object)(object)((Component)TOW).GetComponentInParent<Punch>()))
{
Punch componentInParent3 = ((Component)TOW).GetComponentInParent<Punch>();
FistType type = componentInParent3.type;
FistType val = type;
Texture2D value4;
if ((int)val != 0)
{
if ((int)val == 1 && Plugin.ColorOverrides.TryGetValue("v2_armtex_Palette", out var value3))
{
test = value3.GetPixelFromTopLeft(2, 0);
}
}
else if (Plugin.ColorOverrides.TryGetValue("T_Feedbacker_Palette", out value4))
{
test = value4.GetPixelFromTopLeft(0, 0);
}
flag2 = true;
}
else if (Object.op_Implicit((Object)(object)((Component)TOW).GetComponentInParent<HookArm>()))
{
HookArm componentInParent4 = ((Component)TOW).GetComponentInParent<HookArm>();
LineRenderer componentInParent5 = ((Component)componentInParent4).GetComponentInParent<LineRenderer>();
if (Plugin.ColorOverrides.TryGetValue("T_GreenArm_Palette", out var value5))
{
test = value5.GetPixelFromTopLeft(1, 0);
Color self = Color.black;
SetIfOpaque(ref self, value5.GetPixelFromTopLeft(1, 1), 1f, lineRendererColor);
componentInParent5.startColor = self;
SetIfOpaque(ref self, value5.GetPixelFromTopLeft(1, 2), 1f, lineRendererColor);
componentInParent5.endColor = self;
}
else
{
componentInParent5.startColor = lineRendererColor.Clone();
componentInParent5.endColor = lineRendererColor.Clone();
}
}
SetIfOpaque(ref __result, test, 1f);
if (flag)
{
if (((MonoBehaviour)(object)TOW).TryGetComponentInParent<WeaponIcon>(out var _comp))
{
_comp.UpdateIcon();
}
}
else if (flag2)
{
MonoSingleton<FistControl>.Instance.UpdateFistIcon();
}
}
public static string ComponentToKey(WeaponIcon WPI)
{
int variationColor = 0;
return ComponentToKey((MonoBehaviour)(object)WPI, ref variationColor);
}
public static string ComponentToKey(MonoBehaviour WPI, ref int variationColor)
{
if (WPI.TryGetComponentInParent<Revolver>(out var _comp))
{
if (variationColor == 0)
{
variationColor = 1;
}
else if (variationColor == 1)
{
variationColor = 0;
}
return _comp.altVersion ? "T_MinosRevolver" : "T_PistolNew";
}
if (WPI.TryGetComponentInParent<Shotgun>(out var _))
{
return "T_ShotgunNew";
}
if (WPI.TryGetComponentInParent<ShotgunHammer>(out var _))
{
return "T_ImpactHammer";
}
if (WPI.TryGetComponentInParent<Nailgun>(out var _comp4))
{
return _comp4.altVersion ? "T_SawbladeLauncher" : "T_NailgunNew";
}
if (WPI.TryGetComponentInParent<Railcannon>(out var _))
{
return "T_Railcannon";
}
if (WPI.TryGetComponentInParent<RocketLauncher>(out var _))
{
return "T_RocketLauncher";
}
if (WPI.TryGetComponentInParent<Washer>(out var _) || (WPI.TryGetComponentInParent<WeaponIdentifier>(out var _comp8) && ((Object)_comp8).name.Contains("Washer")))
{
return "T_Washer";
}
if (WPI.TryGetComponentInParent<Vacuum>(out var _) || (WPI.TryGetComponentInParent<WeaponIdentifier>(out var _comp10) && ((Object)_comp10).name.Contains("Vacuum")))
{
return "T_Vacuum";
}
if (WPI.TryGetComponentInParent<SandboxArm>(out var _))
{
return "T_MainArm_White";
}
return string.Empty;
}
public static void SetIfOpaque(ref Color self, Color test, float newOpacity = -1f, Color? other = null, float newOpacity2 = -1f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (test.a > 0f)
{
Color val = test.Clone();
if (newOpacity != -1f)
{
val.a = newOpacity;
}
self = val;
}
else if (other.HasValue)
{
Color val2 = other.Value.Clone();
if (newOpacity2 != -1f)
{
val2.a = newOpacity2;
}
self = val2;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "USGCColorOverride";
public const string PLUGIN_NAME = "USGC Color Override";
public const string PLUGIN_VERSION = "1.0.0";
}
}