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 ArtifactOfBlindness.Artifact;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering.PostProcessing;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ArtifactOfBlindness")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtifactOfBlindness")]
[assembly: AssemblyTitle("ArtifactOfBlindness")]
[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 ArtifactOfBlindness
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("HIFU.ArtifactOfBlindness", "ArtifactOfBlindness", "1.2.0")]
public class Main : BaseUnityPlugin
{
public const string PluginGUID = "HIFU.ArtifactOfBlindness";
public const string PluginAuthor = "HIFU";
public const string PluginName = "ArtifactOfBlindness";
public const string PluginVersion = "1.2.0";
public static AssetBundle artifactofblindness;
public static ManualLogSource ABLogger;
public static ConfigEntry<bool> disclaimer1;
public static ConfigEntry<bool> disclaimer2;
public static ConfigEntry<float> moveSpeedBuff;
public static ConfigEntry<float> attackSpeedBuff;
public static ConfigEntry<float> cooldownReductionBuff;
public static ConfigEntry<float> percentRegenBuff;
public static ConfigEntry<float> flatRegenBuff;
public static ConfigEntry<float> mithrixMultiplier;
public static ConfigEntry<bool> enableFog;
public static ConfigEntry<bool> enableDoF;
public static ConfigEntry<bool> enableVignette;
public static ConfigEntry<bool> enableAberration;
public static ConfigEntry<bool> enableGrain;
public static ConfigEntry<float> fogRadius;
public static ConfigEntry<bool> fogIndicator;
public static ConfigEntry<Color> fogIndicatorColor;
public static ConfigEntry<Color> fogColorStart;
public static ConfigEntry<Color> fogColorMid;
public static ConfigEntry<Color> fogColorEnd;
public static ConfigEntry<float> fogIntensity;
public static ConfigEntry<bool> everyoneGlow;
public static ConfigEntry<Color> glowColor;
public static ConfigEntry<float> glowIntensity;
public static ConfigEntry<float> glowRadius;
public static ConfigEntry<float> depthOfFieldStrength;
public void Awake()
{
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0417: Expected O, but got Unknown
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_0422: Unknown result type (might be due to invalid IL or missing references)
//IL_042d: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_044f: Expected O, but got Unknown
//IL_044a: Unknown result type (might be due to invalid IL or missing references)
//IL_0454: Expected O, but got Unknown
//IL_045a: Unknown result type (might be due to invalid IL or missing references)
//IL_045f: Unknown result type (might be due to invalid IL or missing references)
//IL_046a: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_0480: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Expected O, but got Unknown
//IL_0487: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Expected O, but got Unknown
//IL_0497: Unknown result type (might be due to invalid IL or missing references)
//IL_049c: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Expected O, but got Unknown
//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Expected O, but got Unknown
//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: Expected O, but got Unknown
//IL_0501: Unknown result type (might be due to invalid IL or missing references)
//IL_050b: Expected O, but got Unknown
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_0516: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_052c: Unknown result type (might be due to invalid IL or missing references)
//IL_0537: Unknown result type (might be due to invalid IL or missing references)
//IL_0543: Expected O, but got Unknown
//IL_053e: Unknown result type (might be due to invalid IL or missing references)
//IL_0548: Expected O, but got Unknown
//IL_054e: Unknown result type (might be due to invalid IL or missing references)
//IL_0553: Unknown result type (might be due to invalid IL or missing references)
//IL_055e: Unknown result type (might be due to invalid IL or missing references)
//IL_0569: Unknown result type (might be due to invalid IL or missing references)
//IL_0574: Unknown result type (might be due to invalid IL or missing references)
//IL_0580: Expected O, but got Unknown
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0585: Expected O, but got Unknown
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Expected O, but got Unknown
//IL_059b: Unknown result type (might be due to invalid IL or missing references)
//IL_05a5: Expected O, but got Unknown
//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Expected O, but got Unknown
//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
//IL_05c5: Expected O, but got Unknown
//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
//IL_05d5: Expected O, but got Unknown
//IL_05db: Unknown result type (might be due to invalid IL or missing references)
//IL_05e5: Expected O, but got Unknown
//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0606: Unknown result type (might be due to invalid IL or missing references)
//IL_0611: Unknown result type (might be due to invalid IL or missing references)
//IL_061d: Expected O, but got Unknown
//IL_0618: Unknown result type (might be due to invalid IL or missing references)
//IL_0622: Expected O, but got Unknown
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_062d: Unknown result type (might be due to invalid IL or missing references)
//IL_0639: Expected O, but got Unknown
//IL_0634: Unknown result type (might be due to invalid IL or missing references)
//IL_063e: Expected O, but got Unknown
//IL_0644: Unknown result type (might be due to invalid IL or missing references)
//IL_0649: Unknown result type (might be due to invalid IL or missing references)
//IL_0655: Expected O, but got Unknown
//IL_0650: Unknown result type (might be due to invalid IL or missing references)
//IL_065a: Expected O, but got Unknown
//IL_0660: Unknown result type (might be due to invalid IL or missing references)
//IL_0665: Unknown result type (might be due to invalid IL or missing references)
//IL_0671: Expected O, but got Unknown
//IL_066c: Unknown result type (might be due to invalid IL or missing references)
//IL_0676: Expected O, but got Unknown
//IL_067c: Unknown result type (might be due to invalid IL or missing references)
//IL_0681: Unknown result type (might be due to invalid IL or missing references)
//IL_068d: Expected O, but got Unknown
//IL_0688: Unknown result type (might be due to invalid IL or missing references)
//IL_0692: Expected O, but got Unknown
//IL_0698: Unknown result type (might be due to invalid IL or missing references)
//IL_069d: Unknown result type (might be due to invalid IL or missing references)
//IL_06a9: Expected O, but got Unknown
//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
//IL_06ae: Expected O, but got Unknown
//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
//IL_06da: Unknown result type (might be due to invalid IL or missing references)
//IL_06e6: Expected O, but got Unknown
//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
//IL_06eb: Expected O, but got Unknown
//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0702: Expected O, but got Unknown
//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0707: Expected O, but got Unknown
//IL_070d: Unknown result type (might be due to invalid IL or missing references)
//IL_0712: Unknown result type (might be due to invalid IL or missing references)
//IL_071e: Expected O, but got Unknown
//IL_0719: Unknown result type (might be due to invalid IL or missing references)
//IL_0723: Expected O, but got Unknown
//IL_0729: Unknown result type (might be due to invalid IL or missing references)
//IL_072e: Unknown result type (might be due to invalid IL or missing references)
//IL_0739: Unknown result type (might be due to invalid IL or missing references)
//IL_0744: Unknown result type (might be due to invalid IL or missing references)
//IL_074f: Unknown result type (might be due to invalid IL or missing references)
//IL_075b: Expected O, but got Unknown
//IL_0756: Unknown result type (might be due to invalid IL or missing references)
//IL_0760: Expected O, but got Unknown
//IL_0766: Unknown result type (might be due to invalid IL or missing references)
//IL_076b: Unknown result type (might be due to invalid IL or missing references)
//IL_0776: Unknown result type (might be due to invalid IL or missing references)
//IL_0781: Unknown result type (might be due to invalid IL or missing references)
//IL_078c: Unknown result type (might be due to invalid IL or missing references)
//IL_0798: Expected O, but got Unknown
//IL_0793: Unknown result type (might be due to invalid IL or missing references)
//IL_079d: Expected O, but got Unknown
//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
//IL_07be: Unknown result type (might be due to invalid IL or missing references)
//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
//IL_07d5: Expected O, but got Unknown
//IL_07d0: Unknown result type (might be due to invalid IL or missing references)
//IL_07da: Expected O, but got Unknown
ABLogger = ((BaseUnityPlugin)this).Logger;
artifactofblindness = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("ArtifactOfBlindness.dll", "artifactofblindness"));
disclaimer1 = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats", "_Important!", true, "Each player should have the same config to minimize bugs.");
moveSpeedBuff = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Movement Speed Buff", 1.5f, "Decimal. Default is 1.5");
attackSpeedBuff = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Attack Speed Buff", 0.35f, "Decimal. Default is 0.35");
cooldownReductionBuff = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Cooldown Reduction Buff", 0.35f, "Decimal. Default is 0.35");
percentRegenBuff = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Percent Regen Buff", 0.01f, "Decimal. Default is 0.01");
flatRegenBuff = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Flat Regen Buff", 5f, "Default is 5");
mithrixMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Mithrix Stats Multiplier", 0.5f, "Decimal. Default is 0.5");
fogRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Fog Radius", 30f, "Default is 30");
disclaimer2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "_Important!", true, "Each player should have the same config to minimize bugs.");
enableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Enable Fog?", true, "Default is true");
enableDoF = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Enable Depth of Field?", true, "Default is true");
enableVignette = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Enable Vignette?", true, "Default is true");
enableAberration = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Enable Chromatic Aberration?", true, "Default is true");
enableGrain = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Enable Grain?", true, "Default is true");
fogIndicator = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Show Fog Radius Indicator?", true, "Default is false");
fogIndicatorColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "Fog Radius Indicator Color", new Color(16f / 51f, 21f / 85f, 0.23921569f, 0.24313726f), "RGBA / 255. Default is 0.3137254902, 0.2470588235, 0.2392156863, 0.2431372549 or RGBA 80, 63, 61, 62 in Risk of Options.");
fogColorStart = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "Fog Color Start", new Color(0.1764706f, 0.1764706f, 0.20784314f, 0.64705884f), "The color close to your camera in RGBA / 255. Default is 0.17647058823, 0.17647058823, 0.20784313725, 0.64705882352 or RGBA 45, 45, 53, 165 in Risk of Options.");
fogColorMid = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "Fog Color Mid", new Color(0.17254902f, 0.17254902f, 0.21960784f, 1f), "The color between the close and far points from your camera in RGBA / 255. Default is 0.1725490196, 0.1725490196, 0.21960784313, 1 or RGBA 44, 44, 56, 255 in Risk of Options.");
fogColorEnd = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "Fog Color End", new Color(0.17254902f, 0.17254902f, 0.21960784f, 1f), "The color far from your camera in RGBA / 255. Default is 0.1725490196, 0.1725490196, 0.21960784313, 1 or RGBA 44, 44, 56, 255 in Risk of Options.");
fogIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Fog Intensity", 0.99f, "Default is 0.99");
everyoneGlow = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Make all allies glow?", true, "Default is false");
glowColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Visual", "Glow Color", new Color(1f, 1f, 1f, 1f), "RGBA / 255. Default is 1, 1, 1, 1 or RGBA 255, 255, 255, 255 in Risk of Options.");
glowIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Glow Intensity", 0.2f, "Default is 0.3");
glowRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Glow Radius", 13f, "Default is 13");
depthOfFieldStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Depth of Field Strength", 69f, "Default is 69");
ModSettingsManager.SetModIcon(artifactofblindness.LoadAsset<Sprite>("Assets/ArtifactOfBlindness/texArtifactOfBlindnessEnabled.png"));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(disclaimer1));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(moveSpeedBuff, new StepSliderConfig
{
min = 0f,
max = 3f,
increment = 0.1f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(attackSpeedBuff, new StepSliderConfig
{
min = 0f,
max = 2f,
increment = 0.05f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(cooldownReductionBuff, new StepSliderConfig
{
min = 0f,
max = 1f,
increment = 0.05f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(percentRegenBuff, new StepSliderConfig
{
min = 0f,
max = 0.1f,
increment = 0.01f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(flatRegenBuff, new StepSliderConfig
{
min = 0f,
max = 30f,
increment = 1f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(mithrixMultiplier, new StepSliderConfig
{
min = 0f,
max = 2f,
increment = 0.05f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(disclaimer2));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableFog));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableDoF));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableVignette));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableAberration));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableGrain));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(fogRadius, new StepSliderConfig
{
min = 0f,
max = 100f,
increment = 1f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(fogIndicator, new CheckBoxConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new ColorOption(fogIndicatorColor, new ColorOptionConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new ColorOption(fogColorStart, new ColorOptionConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new ColorOption(fogColorMid, new ColorOptionConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new ColorOption(fogColorEnd, new ColorOptionConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(fogIntensity, new StepSliderConfig
{
min = 0f,
max = 1f,
increment = 0.01f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(everyoneGlow, new CheckBoxConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new ColorOption(glowColor, new ColorOptionConfig
{
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(glowIntensity, new StepSliderConfig
{
min = 0f,
max = 5f,
increment = 0.1f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(glowRadius, new StepSliderConfig
{
min = 0f,
max = 100f,
increment = 1f,
restartRequired = false
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(depthOfFieldStrength, new StepSliderConfig
{
min = 0f,
max = 200f,
increment = 1f,
restartRequired = false
}));
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase))
select type;
foreach (Type item in enumerable)
{
ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item);
artifactBase.Init(((BaseUnityPlugin)this).Config);
}
}
}
}
namespace ArtifactOfBlindness.Artifact
{
public abstract class ArtifactBase<T> : ArtifactBase where T : ArtifactBase<T>
{
public static T Instance { get; private set; }
public ArtifactBase()
{
if (Instance != null)
{
throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ArtifactBase was instantiated twice");
}
Instance = this as T;
}
}
public abstract class ArtifactBase
{
public ArtifactDef ArtifactDef;
public abstract string ArtifactName { get; }
public abstract string ArtifactLangTokenName { get; }
public abstract string ArtifactDescription { get; }
public abstract Sprite ArtifactEnabledIcon { get; }
public abstract Sprite ArtifactDisabledIcon { get; }
public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription);
}
protected void CreateArtifact()
{
ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
ArtifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
ArtifactDef.smallIconSelectedSprite = ArtifactEnabledIcon;
ArtifactDef.smallIconDeselectedSprite = ArtifactDisabledIcon;
ContentAddition.AddArtifactDef(ArtifactDef);
}
public abstract void Hooks();
}
internal class ArtifactOfBlindness : ArtifactBase<ArtifactOfBlindness>
{
public static RampFog fog;
public static ChromaticAberration ab;
public static DepthOfField dof;
public static Grain grain;
public static Vignette vn;
public static GameObject ppHolder;
public static BuffDef regenBuff;
public static BuffDef speedBuff;
public static BuffDef aspdBuff;
private static readonly string[] blacklistedScenes = new string[15]
{
"artifactworld", "crystalworld", "eclipseworld", "infinitetowerworld", "intro", "loadingbasic", "lobby", "logbook", "mysteryspace", "outro",
"PromoRailGunner", "PromoVoidSurvivor", "splash", "title", "voidoutro"
};
public static GameObject indicator;
public override string ArtifactName => "Artifact of Blindness";
public override string ArtifactLangTokenName => "HIFU_ArtifactOfBlindness";
public override string ArtifactDescription => "Severely reduce ally vision. Enemies gain increased attack speed, movement speed, regeneration and decreased cooldowns outside of any ally's vision.";
public override Sprite ArtifactEnabledIcon => Main.artifactofblindness.LoadAsset<Sprite>("Assets/ArtifactOfBlindness/texArtifactOfBlindnessEnabled.png");
public override Sprite ArtifactDisabledIcon => Main.artifactofblindness.LoadAsset<Sprite>("Assets/ArtifactOfBlindness/texArtifactOfBlindnessDisabled.png");
public override void Init(ConfigFile config)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_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_0093: 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_00c7: 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_00f9: Expected O, but got Unknown
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
indicator = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/NearbyDamageBonus/NearbyDamageBonusIndicator.prefab").WaitForCompletion(), "Fog Visual", true);
Transform val = indicator.transform.Find("Radius, Spherical");
val.localScale = new Vector3(Main.fogRadius.Value * 2f, Main.fogRadius.Value * 2f, Main.fogRadius.Value * 2f);
Material val2 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/NearbyDamageBonus/matNearbyDamageBonusRangeIndicator.mat").WaitForCompletion());
Texture2D val3 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/PerlinNoise.png").WaitForCompletion();
val2.SetTexture("_MainTex", (Texture)(object)val3);
val2.SetTexture("_Cloud1Tex", (Texture)(object)val3);
val2.SetColor("_TintColor", Main.fogIndicatorColor.Value);
((Renderer)((Component)val).GetComponent<MeshRenderer>()).material = val2;
PrefabAPI.RegisterNetworkPrefab(indicator);
ppHolder = new GameObject("HIFU_ArtifactOfBlindnessPP");
Object.DontDestroyOnLoad((Object)(object)ppHolder);
ppHolder.layer = LayerIndex.postProcess.intVal;
ppHolder.AddComponent<HIFU_ArtifactOfBlindnessPostProcessingController>();
PostProcessVolume val4 = ppHolder.AddComponent<PostProcessVolume>();
Object.DontDestroyOnLoad((Object)(object)val4);
val4.isGlobal = true;
val4.weight = 0f;
val4.priority = float.MaxValue;
PostProcessProfile val5 = ScriptableObject.CreateInstance<PostProcessProfile>();
Object.DontDestroyOnLoad((Object)(object)val5);
((Object)val5).name = "HIFU_ArtifactOfBlindness";
fog = val5.AddSettings<RampFog>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)fog).enabled).value = Main.enableFog.Value;
((PostProcessEffectSettings)fog).SetAllOverridesTo(true, true);
((ParameterOverride<Color>)(object)fog.fogColorStart).value = Main.fogColorStart.Value;
((ParameterOverride<Color>)(object)fog.fogColorMid).value = Main.fogColorMid.Value;
((ParameterOverride<Color>)(object)fog.fogColorEnd).value = Main.fogColorEnd.Value;
((ParameterOverride<float>)(object)fog.skyboxStrength).value = 0.02f;
((ParameterOverride<float>)(object)fog.fogPower).value = 0.35f;
((ParameterOverride<float>)(object)fog.fogIntensity).value = Main.fogIntensity.Value;
((ParameterOverride<float>)(object)fog.fogZero).value = 0f;
((ParameterOverride<float>)(object)fog.fogOne).value = 0.05f;
ab = val5.AddSettings<ChromaticAberration>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ab).enabled).value = Main.enableAberration.Value;
((PostProcessEffectSettings)ab).SetAllOverridesTo(true, true);
((ParameterOverride<float>)(object)ab.intensity).value = 0.15f;
((ParameterOverride<bool>)(object)ab.fastMode).value = false;
dof = val5.AddSettings<DepthOfField>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)dof).enabled).value = Main.enableDoF.Value;
((PostProcessEffectSettings)dof).SetAllOverridesTo(true, true);
((ParameterOverride<float>)(object)dof.aperture).value = 5f;
((ParameterOverride<float>)(object)dof.focalLength).value = Main.depthOfFieldStrength.Value;
((ParameterOverride<float>)(object)dof.focusDistance).value = 5f;
grain = val5.AddSettings<Grain>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)grain).enabled).value = Main.enableGrain.Value;
((PostProcessEffectSettings)grain).SetAllOverridesTo(true, true);
((ParameterOverride<float>)(object)grain.intensity).value = 0.09f;
((ParameterOverride<float>)(object)grain.size).value = 4.57f;
((ParameterOverride<float>)(object)grain.lumContrib).value = 5.86f;
((ParameterOverride<bool>)(object)grain.colored).value = true;
vn = val5.AddSettings<Vignette>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)vn).enabled).value = Main.enableVignette.Value;
((PostProcessEffectSettings)vn).SetAllOverridesTo(true, true);
((ParameterOverride<float>)(object)vn.intensity).value = 0.15f;
((ParameterOverride<float>)(object)vn.roundness).value = 1f;
((ParameterOverride<float>)(object)vn.smoothness).value = 0.2f;
((ParameterOverride<bool>)(object)vn.rounded).value = false;
((ParameterOverride<Color>)(object)vn.color).value = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
val4.sharedProfile = val5;
CreateLang();
CreateArtifact();
Hooks();
}
public override void Hooks()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
CreateBuff();
CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal;
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
SceneDirector.Start += new hook_Start(SceneDirector_Start);
Run.onRunDestroyGlobal += Run_onRunDestroyGlobal;
}
private void CharacterBody_onBodyStartGlobal(CharacterBody body)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
if (ArtifactBase<ArtifactOfBlindness>.Instance.ArtifactEnabled && (int)body.teamComponent.teamIndex == 1)
{
HIFU_ArtifactOfBlindnessFogSphereController component = ((Component)body).GetComponent<HIFU_ArtifactOfBlindnessFogSphereController>();
if ((Object)(object)component == (Object)null)
{
HIFU_ArtifactOfBlindnessFogSphereController hIFU_ArtifactOfBlindnessFogSphereController = ((Component)body).gameObject.AddComponent<HIFU_ArtifactOfBlindnessFogSphereController>();
}
}
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if ((Object.op_Implicit((Object)(object)sender) && sender.HasBuff(regenBuff)) || sender.HasBuff(speedBuff) || sender.HasBuff(aspdBuff))
{
if (((Object)sender).name == "BrotherBody(Clone)" || ((Object)sender).name == "BrotherHurtBody(Clone)")
{
args.baseAttackSpeedAdd += Main.attackSpeedBuff.Value * Main.mithrixMultiplier.Value;
args.cooldownMultAdd += Main.cooldownReductionBuff.Value * Main.mithrixMultiplier.Value;
args.moveSpeedMultAdd += Main.moveSpeedBuff.Value * Main.mithrixMultiplier.Value;
args.baseRegenAdd += sender.healthComponent.combinedHealth * Main.percentRegenBuff.Value * Main.mithrixMultiplier.Value + Main.flatRegenBuff.Value * Main.mithrixMultiplier.Value + Main.flatRegenBuff.Value * Main.mithrixMultiplier.Value / 5f * (sender.level - 1f);
}
else
{
args.baseAttackSpeedAdd += Main.attackSpeedBuff.Value;
args.cooldownMultAdd += Main.cooldownReductionBuff.Value;
args.moveSpeedMultAdd += Main.moveSpeedBuff.Value;
args.baseRegenAdd += sender.healthComponent.combinedHealth * Main.percentRegenBuff.Value + Main.flatRegenBuff.Value + Main.flatRegenBuff.Value / 5f * (sender.level - 1f);
}
}
}
private void CreateBuff()
{
//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_0076: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
regenBuff = ScriptableObject.CreateInstance<BuffDef>();
speedBuff = ScriptableObject.CreateInstance<BuffDef>();
aspdBuff = ScriptableObject.CreateInstance<BuffDef>();
Texture2D val = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Croco/texBuffRegenBoostIcon.tif").WaitForCompletion();
regenBuff.canStack = false;
regenBuff.isDebuff = false;
((Object)regenBuff).name = "Darkness";
regenBuff.iconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f));
regenBuff.buffColor = Color32.op_Implicit(new Color32((byte)63, (byte)63, (byte)130, byte.MaxValue));
Texture2D val2 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/texMovespeedBuffIcon.tif").WaitForCompletion();
speedBuff.canStack = false;
speedBuff.isDebuff = false;
((Object)speedBuff).name = "Darkness";
speedBuff.iconSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0f, 0f));
speedBuff.buffColor = Color32.op_Implicit(new Color32((byte)63, (byte)63, (byte)130, byte.MaxValue));
Texture2D val3 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/AttackSpeedOnCrit/texBuffAttackSpeedOnCritIcon.tif").WaitForCompletion();
aspdBuff.canStack = false;
aspdBuff.isDebuff = false;
((Object)aspdBuff).name = "Darkness";
aspdBuff.iconSprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0f, 0f));
aspdBuff.buffColor = Color32.op_Implicit(new Color32((byte)63, (byte)63, (byte)130, byte.MaxValue));
ContentAddition.AddBuffDef(regenBuff);
ContentAddition.AddBuffDef(speedBuff);
ContentAddition.AddBuffDef(aspdBuff);
}
private void Run_onRunDestroyGlobal(Run obj)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
PostProcessVolume component = ppHolder.GetComponent<PostProcessVolume>();
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (!blacklistedScenes.Contains(name) && Object.op_Implicit((Object)(object)component))
{
component.weight = 0f;
}
}
private void SceneDirector_Start(orig_Start orig, SceneDirector self)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
PostProcessVolume component = ppHolder.GetComponent<PostProcessVolume>();
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (ArtifactBase<ArtifactOfBlindness>.Instance.ArtifactEnabled && !blacklistedScenes.Contains(name))
{
component.weight = 1f;
}
else
{
component.weight = 0f;
}
orig.Invoke(self);
}
}
public class HIFU_ArtifactOfBlindnessPostProcessingController : MonoBehaviour
{
public PostProcessVolume volume;
public void Start()
{
volume = ((Component)this).GetComponent<PostProcessVolume>();
}
}
public class HIFU_ArtifactOfBlindnessFogSphereController : MonoBehaviour
{
public CharacterBody bodyComponent;
public float checkInterval = 0.1f;
public float colorUpdateInterval = 2f;
public float timer;
public float timer2;
public float radius = Main.fogRadius.Value;
public static List<HIFU_ArtifactOfBlindnessFogSphereController> fogList = new List<HIFU_ArtifactOfBlindnessFogSphereController>();
public bool anyEnemiesOutside = true;
public Vector3 myPosition;
public Vector3 enemyPosition;
public GameObject radiusIndicator;
public Light light = null;
public Material indicatorMat;
public Transform radiusTrans;
private bool enableRadiusIndicator
{
get
{
return Object.op_Implicit((Object)(object)radiusIndicator);
}
set
{
//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)
if (enableRadiusIndicator != value)
{
if (value)
{
radiusIndicator = Object.Instantiate<GameObject>(ArtifactOfBlindness.indicator, bodyComponent.corePosition, Quaternion.identity);
radiusIndicator.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
}
else
{
Object.Destroy((Object)(object)radiusIndicator);
radiusIndicator = null;
}
}
}
}
public void Awake()
{
fogList.Add(this);
}
public void OnDestroy()
{
fogList.Remove(this);
}
public void Start()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
bodyComponent = ((Component)this).gameObject.GetComponent<CharacterBody>();
enableRadiusIndicator = Main.fogIndicator.Value;
radiusTrans = radiusIndicator.transform.GetChild(1);
radiusTrans.localScale = new Vector3(Main.fogRadius.Value * 2f, Main.fogRadius.Value * 2f, Main.fogRadius.Value * 2f);
indicatorMat = ((Renderer)((Component)radiusTrans).GetComponent<MeshRenderer>()).sharedMaterial;
if ((Object)(object)light == (Object)null)
{
light = ((Component)this).gameObject.AddComponent<Light>();
light.color = Main.glowColor.Value;
light.range = Main.glowRadius.Value;
light.intensity = Main.glowIntensity.Value;
light.type = (LightType)2;
light.shadows = (LightShadows)0;
}
}
public void FixedUpdate()
{
//IL_0054: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Invalid comparison between Unknown and I4
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
timer += Time.fixedDeltaTime;
timer2 += Time.fixedDeltaTime;
if (timer2 >= colorUpdateInterval)
{
timer2 = 0f;
light.color = Main.glowColor.Value;
light.range = Main.glowRadius.Value;
light.intensity = Main.glowIntensity.Value;
light.type = (LightType)2;
light.shadows = (LightShadows)0;
enableRadiusIndicator = Main.fogIndicator.Value;
radiusTrans.localScale = new Vector3(Main.fogRadius.Value * 2f, Main.fogRadius.Value * 2f, Main.fogRadius.Value * 2f);
indicatorMat.SetColor("_TintColor", Main.fogIndicatorColor.Value);
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ArtifactOfBlindness.fog).enabled).value = Main.enableFog.Value;
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ArtifactOfBlindness.dof).enabled).value = Main.enableDoF.Value;
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ArtifactOfBlindness.grain).enabled).value = Main.enableGrain.Value;
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ArtifactOfBlindness.ab).enabled).value = Main.enableAberration.Value;
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ArtifactOfBlindness.vn).enabled).value = Main.enableVignette.Value;
((ParameterOverride<Color>)(object)ArtifactOfBlindness.fog.fogColorStart).value = Main.fogColorStart.Value;
((ParameterOverride<Color>)(object)ArtifactOfBlindness.fog.fogColorMid).value = Main.fogColorMid.Value;
((ParameterOverride<Color>)(object)ArtifactOfBlindness.fog.fogColorEnd).value = Main.fogColorEnd.Value;
((ParameterOverride<float>)(object)ArtifactOfBlindness.fog.fogIntensity).value = Main.fogIntensity.Value;
((ParameterOverride<float>)(object)ArtifactOfBlindness.dof.focalLength).value = Main.depthOfFieldStrength.Value;
}
if (!(timer >= checkInterval))
{
return;
}
timer = 0f;
for (int i = 0; i < CharacterBody.instancesList.Count; i++)
{
CharacterBody val = CharacterBody.instancesList[i];
if (!Object.op_Implicit((Object)(object)val) || (int)val.teamComponent.teamIndex == 1)
{
continue;
}
enemyPosition = val.transform.position;
foreach (HIFU_ArtifactOfBlindnessFogSphereController fog in fogList)
{
myPosition = fog.bodyComponent.transform.position;
if (Vector3.Distance(enemyPosition, myPosition) < radius)
{
anyEnemiesOutside = false;
break;
}
anyEnemiesOutside = true;
}
if (anyEnemiesOutside)
{
AddBuffs(val);
}
else
{
RemoveBuffs(val);
}
}
}
private void AddBuffs(CharacterBody body)
{
if (!body.HasBuff(ArtifactOfBlindness.regenBuff) && !body.HasBuff(ArtifactOfBlindness.speedBuff) && !body.HasBuff(ArtifactOfBlindness.aspdBuff))
{
body.AddBuff(ArtifactOfBlindness.regenBuff);
body.AddBuff(ArtifactOfBlindness.speedBuff);
body.AddBuff(ArtifactOfBlindness.aspdBuff);
}
}
private void RemoveBuffs(CharacterBody body)
{
if (body.HasBuff(ArtifactOfBlindness.regenBuff) || body.HasBuff(ArtifactOfBlindness.speedBuff) || body.HasBuff(ArtifactOfBlindness.aspdBuff))
{
body.RemoveBuff(ArtifactOfBlindness.regenBuff);
body.RemoveBuff(ArtifactOfBlindness.speedBuff);
body.RemoveBuff(ArtifactOfBlindness.aspdBuff);
}
}
}
}