using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.GoldGat;
using HG.Reflection;
using IL.EntityStates.GoldGat;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Chinchi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Gesture of the Drowned and Bottled Chaos switch item tiers.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("SwitchChaosAndGesture")]
[assembly: AssemblyTitle("SwitchChaosAndGesture")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/schinchi/SwitchChaosAndGesture")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[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 SwitchChaosAndGesture
{
internal class Hooks
{
[CompilerGenerated]
private static class <>O
{
public static hook_SetItemDefs <0>__ItemCatalog_SetItemDefs;
public static hook_SetEquipmentDefs <1>__EquipmentCatalog_SetEquipmentDefs;
public static hook_OnEnable <2>__CharacterMaster_OnEnable;
public static hook_OnDisable <3>__CharacterMaster_OnDisable;
public static Manipulator <4>__EquipmentSlot_FixedUpdate;
public static Manipulator <5>__Inventory_SetEquipmentInternal;
public static Manipulator <6>__Inventory_UpdateEquipment;
public static Manipulator <7>__EquipmentSlot_OnEquipmentExecuted;
public static Manipulator <8>__BaseGoldGatState_FixedUpdate;
public static Action<Inventory> <9>__Inventory_onInventoryChangedGlobal;
public static Action<Run> <10>__Run_onRunDestroyGlobal;
}
private const string BASE_ERROR_MESSAGE = "Failed to patch method: ";
private static bool popNextCooldown = false;
internal static readonly Dictionary<CharacterMaster, List<float>[]> masterCooldowns = new Dictionary<CharacterMaster, List<float>[]>();
private static readonly HashSet<EquipmentIndex> bannedAutocastEquipment = new HashSet<EquipmentIndex>();
public static void Init()
{
//IL_0010: 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)
//IL_001b: Expected O, but got Unknown
//IL_0030: 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_003b: Expected O, but got Unknown
//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_005b: Expected O, but got Unknown
//IL_0070: 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_007b: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//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_00db: Expected O, but got Unknown
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Expected O, but got Unknown
//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_011b: Expected O, but got Unknown
object obj = <>O.<0>__ItemCatalog_SetItemDefs;
if (obj == null)
{
hook_SetItemDefs val = ItemCatalog_SetItemDefs;
<>O.<0>__ItemCatalog_SetItemDefs = val;
obj = (object)val;
}
ItemCatalog.SetItemDefs += (hook_SetItemDefs)obj;
object obj2 = <>O.<1>__EquipmentCatalog_SetEquipmentDefs;
if (obj2 == null)
{
hook_SetEquipmentDefs val2 = EquipmentCatalog_SetEquipmentDefs;
<>O.<1>__EquipmentCatalog_SetEquipmentDefs = val2;
obj2 = (object)val2;
}
EquipmentCatalog.SetEquipmentDefs += (hook_SetEquipmentDefs)obj2;
object obj3 = <>O.<2>__CharacterMaster_OnEnable;
if (obj3 == null)
{
hook_OnEnable val3 = CharacterMaster_OnEnable;
<>O.<2>__CharacterMaster_OnEnable = val3;
obj3 = (object)val3;
}
CharacterMaster.OnEnable += (hook_OnEnable)obj3;
object obj4 = <>O.<3>__CharacterMaster_OnDisable;
if (obj4 == null)
{
hook_OnDisable val4 = CharacterMaster_OnDisable;
<>O.<3>__CharacterMaster_OnDisable = val4;
obj4 = (object)val4;
}
CharacterMaster.OnDisable += (hook_OnDisable)obj4;
object obj5 = <>O.<4>__EquipmentSlot_FixedUpdate;
if (obj5 == null)
{
Manipulator val5 = EquipmentSlot_FixedUpdate;
<>O.<4>__EquipmentSlot_FixedUpdate = val5;
obj5 = (object)val5;
}
EquipmentSlot.FixedUpdate += (Manipulator)obj5;
object obj6 = <>O.<5>__Inventory_SetEquipmentInternal;
if (obj6 == null)
{
Manipulator val6 = Inventory_SetEquipmentInternal;
<>O.<5>__Inventory_SetEquipmentInternal = val6;
obj6 = (object)val6;
}
Inventory.SetEquipmentInternal += (Manipulator)obj6;
object obj7 = <>O.<6>__Inventory_UpdateEquipment;
if (obj7 == null)
{
Manipulator val7 = Inventory_UpdateEquipment;
<>O.<6>__Inventory_UpdateEquipment = val7;
obj7 = (object)val7;
}
Inventory.UpdateEquipment += (Manipulator)obj7;
object obj8 = <>O.<7>__EquipmentSlot_OnEquipmentExecuted;
if (obj8 == null)
{
Manipulator val8 = EquipmentSlot_OnEquipmentExecuted;
<>O.<7>__EquipmentSlot_OnEquipmentExecuted = val8;
obj8 = (object)val8;
}
EquipmentSlot.OnEquipmentExecuted += (Manipulator)obj8;
object obj9 = <>O.<8>__BaseGoldGatState_FixedUpdate;
if (obj9 == null)
{
Manipulator val9 = BaseGoldGatState_FixedUpdate;
<>O.<8>__BaseGoldGatState_FixedUpdate = val9;
obj9 = (object)val9;
}
BaseGoldGatState.FixedUpdate += (Manipulator)obj9;
Inventory.onInventoryChangedGlobal += Inventory_onInventoryChangedGlobal;
Run.onRunDestroyGlobal += Run_onRunDestroyGlobal;
}
private static void EquipmentSlot_FixedUpdate(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "AutoCastEquipment"),
(Instruction x) => ILPatternMatchingExt.MatchCall<Inventory>(x, "GetItemCount"),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCgt(x)
}))
{
SwitchChaosAndGesture.Logger.LogError((object)"Failed to patch method: EquipmentSlot.FixedUpdate");
return;
}
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<bool, EquipmentSlot, bool>>((Func<bool, EquipmentSlot, bool>)((bool autocast, EquipmentSlot equipmentSlot) => autocast && !bannedAutocastEquipment.Contains(equipmentSlot.equipmentIndex)));
}
private static void BaseGoldGatState_FixedUpdate(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = default(ILLabel);
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[5]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Inventory>(x, "GetItemCount"),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1)
}))
{
SwitchChaosAndGesture.Logger.LogError((object)"Failed to patch method: EntityStates.GoldGat.BaseGoldGatState.FixedUpdate");
return;
}
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<bool, BaseGoldGatState, bool>>((Func<bool, BaseGoldGatState, bool>)((bool autocast, BaseGoldGatState state) => state.shouldFire || (autocast && !bannedAutocastEquipment.Contains(Equipment.GoldGat.equipmentIndex))));
}
private static void ItemCatalog_SetItemDefs(orig_SetItemDefs orig, ItemDef[] newItemDefs)
{
foreach (ItemDef val in newItemDefs)
{
if ((Object)(object)val == (Object)(object)Items.RandomEquipmentTrigger)
{
UpdateItemDef(val, (ItemTier)3, "texBottledChaosIcon", isDroppable: true);
}
else if ((Object)(object)val == (Object)(object)Items.AutoCastEquipment)
{
UpdateItemDef(val, (ItemTier)2, "texFossilIcon", SwitchChaosAndGesture.isGestureAllowed.Value);
AddOrRemoveTag(val, (ItemTag)4, SwitchChaosAndGesture.isGestureBlacklisted.Value);
}
}
orig.Invoke(newItemDefs);
}
private static void EquipmentCatalog_SetEquipmentDefs(orig_SetEquipmentDefs orig, EquipmentDef[] newEquipmentDefs)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(newEquipmentDefs);
string[] array = SwitchChaosAndGesture.bannedAutocastEquipment.Value.Split(new char[1] { ',' });
foreach (string text in array)
{
bannedAutocastEquipment.Add(EquipmentCatalog.FindEquipmentIndex(text.Trim()));
}
bannedAutocastEquipment.Remove((EquipmentIndex)(-1));
}
private static void UpdateItemDef(ItemDef itemDef, ItemTier tier, string sprite, bool isDroppable)
{
//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_0008: Unknown result type (might be due to invalid IL or missing references)
itemDef.deprecatedTier = tier;
itemDef.tier = tier;
AssetBundle assetBundle = SwitchChaosAndGesture.assetBundle;
if ((Object)(object)assetBundle != (Object)null)
{
itemDef.pickupIconSprite = assetBundle.LoadAsset<Sprite>(sprite);
}
AddOrRemoveTag(itemDef, (ItemTag)9, isDroppable);
}
private static void AddOrRemoveTag(ItemDef itemDef, ItemTag tag, bool add)
{
//IL_0009: 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_001e: 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)
if (add && itemDef.tags.Contains(tag))
{
List<ItemTag> list = itemDef.tags.ToList();
list.Remove(tag);
itemDef.tags = list.ToArray();
}
else if (!add && !itemDef.tags.Contains(tag))
{
List<ItemTag> list2 = itemDef.tags.ToList();
list2.Add(tag);
itemDef.tags = list2.ToArray();
}
}
private static void CharacterMaster_OnEnable(orig_OnEnable orig, CharacterMaster self)
{
orig.Invoke(self);
if (NetworkServer.active && !masterCooldowns.ContainsKey(self))
{
masterCooldowns[self] = new List<float>[0];
}
}
private static void CharacterMaster_OnDisable(orig_OnDisable orig, CharacterMaster self)
{
orig.Invoke(self);
if (NetworkServer.active && masterCooldowns.ContainsKey(self))
{
masterCooldowns.Remove(self);
}
}
private static void Inventory_SetEquipmentInternal(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00af: 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)
ILCursor val = new ILCursor(il);
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<Inventory>(x, "equipmentStateSlots"),
(Instruction x) => ILPatternMatchingExt.MatchLdlen(x),
(Instruction x) => ILPatternMatchingExt.MatchConvI4(x)
}))
{
SwitchChaosAndGesture.Logger.LogError((object)"Failed to patch method: Inventory.SetEquipmentInternal");
return;
}
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldarg_2);
val.EmitDelegate<Func<int, Inventory, uint, int>>((Func<int, Inventory, uint, int>)delegate(int num, Inventory inventory, uint slot)
{
if (NetworkServer.active)
{
CharacterMaster component = ((Component)inventory).GetComponent<CharacterMaster>();
if ((Object)(object)component != (Object)null && masterCooldowns.TryGetValue(component, out var value) && value.Length <= slot)
{
Array.Resize(ref value, (int)(slot + 1));
for (int i = num; i < value.Length; i++)
{
value[i] = new List<float>();
}
masterCooldowns[component] = value;
}
}
return num;
});
}
private static void Inventory_UpdateEquipment(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<EquipmentState>(x, "equipmentDef"),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<EquipmentDef>(x, "cooldown")
}))
{
SwitchChaosAndGesture.Logger.LogError((object)"Failed to patch method: RoR2.Inventory.UpdateEquipment");
return;
}
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldloc_1);
val.Emit(OpCodes.Ldloc_2);
val.EmitDelegate<Func<float, Inventory, uint, byte, float>>((Func<float, Inventory, uint, byte, float>)delegate(float equipmentCooldown, Inventory inventory, uint maxCharges, byte slot)
{
//IL_0057: 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_005d: Unknown result type (might be due to invalid IL or missing references)
CharacterMaster component = ((Component)inventory).GetComponent<CharacterMaster>();
if ((Object)(object)component != (Object)null && masterCooldowns.TryGetValue(component, out var value))
{
if (value.Length <= slot)
{
SwitchChaosAndGesture.Logger.LogWarning((object)"IL.Inventory.UpdateEquipment cooldown array not resized properly.");
return equipmentCooldown;
}
List<float> list = value[slot];
if (list.Count > 0 && popNextCooldown)
{
EquipmentState val2 = inventory.equipmentStateSlots[slot];
if (val2.charges + 1 < maxCharges || ((FixedTimeStamp)(ref val2.chargeFinishTime)).isPositiveInfinity)
{
float num = list[0];
list.RemoveAt(0);
return equipmentCooldown + num * SwitchChaosAndGesture.chaosCooldownPenalty.Value;
}
}
}
return equipmentCooldown;
});
}
private static void EquipmentSlot_OnEquipmentExecuted(ILContext il)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
string text = "Failed to patch method: RoR2.EquipmentSlot.OnEquipmentExecuted";
Inventory inventory = null;
CharacterMaster master = null;
byte slot = 0;
bool addCooldownNow = false;
ILCursor val = new ILCursor(il);
if (!val.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCall<EquipmentSlot>(x, "get_equipmentIndex")
}))
{
SwitchChaosAndGesture.Logger.LogError((object)text);
return;
}
val.Index += 1;
val.EmitDelegate<Func<EquipmentSlot, EquipmentSlot>>((Func<EquipmentSlot, EquipmentSlot>)delegate(EquipmentSlot equipmentSlot)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
popNextCooldown = false;
inventory = equipmentSlot.inventory;
master = ((Component)inventory).GetComponent<CharacterMaster>();
slot = inventory.activeEquipmentSlot;
EquipmentState val2 = inventory.equipmentStateSlots[slot];
bool flag = inventory.GetItemCount(Items.RandomEquipmentTrigger) > 0;
if (flag)
{
masterCooldowns[master][slot].Add(0f);
}
addCooldownNow = ((FixedTimeStamp)(ref val2.chargeFinishTime)).isPositiveInfinity && flag;
return equipmentSlot;
});
if (!val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<EquipmentSlot>(x, "PerformEquipmentAction")
}))
{
SwitchChaosAndGesture.Logger.LogError((object)text);
return;
}
val.Index += 3;
val.EmitDelegate<Func<EquipmentIndex, EquipmentIndex>>((Func<EquipmentIndex, EquipmentIndex>)delegate(EquipmentIndex equipmentIndex)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
List<float> list = masterCooldowns[master][slot];
if (list.Count == 0)
{
SwitchChaosAndGesture.Logger.LogError((object)"IL.EquipmentSlot.OnEquipmentExecuted: Empty cooldown queue");
}
else
{
list[list.Count - 1] += EquipmentCatalog.GetEquipmentDef(equipmentIndex).cooldown;
}
return equipmentIndex;
});
if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(EffectManager), "SpawnEffect")
}))
{
SwitchChaosAndGesture.Logger.LogError((object)text);
return;
}
val.EmitDelegate<Action>((Action)delegate
{
//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_0075: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_0087: 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)
if (addCooldownNow)
{
float num = masterCooldowns[master][slot][0] * inventory.CalculateEquipmentCooldownScale() * SwitchChaosAndGesture.chaosCooldownPenalty.Value;
masterCooldowns[master][slot].RemoveAt(0);
EquipmentState equipment = inventory.GetEquipment((uint)slot);
inventory.SetEquipment(new EquipmentState(equipment.equipmentIndex, equipment.chargeFinishTime + num, equipment.charges), (uint)slot);
}
popNextCooldown = true;
});
}
private static void Inventory_onInventoryChangedGlobal(Inventory inventory)
{
if (!NetworkServer.active || inventory.GetItemCount(Items.RandomEquipmentTrigger) > 0)
{
return;
}
CharacterMaster component = ((Component)inventory).GetComponent<CharacterMaster>();
if ((Object)(object)component != (Object)null && masterCooldowns.TryGetValue(component, out var value))
{
List<float>[] array = value;
for (int i = 0; i < array.Length; i++)
{
array[i].Clear();
}
}
}
private static void Run_onRunDestroyGlobal(Run obj)
{
masterCooldowns.Clear();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("GChinchi.SwitchChaosAndGesture", "SwitchChaosAndGesture", "1.1.0")]
public class SwitchChaosAndGesture : BaseUnityPlugin
{
public const string PluginGUID = "GChinchi.SwitchChaosAndGesture";
public const string PluginAuthor = "GChinchi";
public const string PluginName = "SwitchChaosAndGesture";
public const string PluginVersion = "1.1.0";
internal static ConfigEntry<bool> isGestureAllowed;
internal static ConfigEntry<bool> isGestureBlacklisted;
internal static ConfigEntry<string> bannedAutocastEquipment;
internal static ConfigEntry<float> chaosCooldownPenalty;
internal static AssetBundle assetBundle;
internal static ManualLogSource Logger;
public void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
isGestureAllowed = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "allowGesture", true, "Allow Gesture of the Drowned to be in the item pool.");
isGestureBlacklisted = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "blacklistGesture", false, "Blacklist the item for enemies.");
bannedAutocastEquipment = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "bannedAutocastEquipment", "Recycle,GoldGat,BossHunter,FireBallDash", "Which equipment will not be autocast with Gesture. Run the 'equipment_list' command on the console for a list of all internal name options.");
chaosCooldownPenalty = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "chaosCooldown", 0.2f, "The percent of the activated equipment's cooldown that will be added on due to Bottled Chaos' effect.");
if (chaosCooldownPenalty.Value < 0f)
{
chaosCooldownPenalty.Value = 0f;
Logger.LogWarning((object)"The 'chaosCooldown' config setting has a negative value. Readjusting to 0.0");
}
LoadBundle(((BaseUnityPlugin)this).Info.Location);
Hooks.Init();
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ApplyModelChanges));
}
private void LoadBundle(string directory)
{
string text = "assetdata.bundle";
assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(directory), text));
if ((Object)(object)assetBundle == (Object)null)
{
Logger.LogError((object)("Failed to load '" + text + "'"));
}
}
private void ApplyModelChanges()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_002e: 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)
Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/RandomEquipmentTrigger/matBottledChaos.mat").WaitForCompletion().mainTexture = (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texLunarWispTracer 1.png").WaitForCompletion();
GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RandomEquipmentTrigger/RandomEquipmentTriggerProcEffect.prefab").WaitForCompletion();
SetMaterial(((Component)val.transform.Find("Vase")).gameObject, "RoR2/Base/LunarWisp/matLunarWispStones.mat", 0);
SetMaterial(((Component)val.transform.Find("Trails")).gameObject, "RoR2/Base/LunarWisp/matLunarWispMinigunTracer.mat", 1);
}
private void SetMaterial(GameObject go, string material, int index)
{
//IL_0010: 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)
ParticleSystemRenderer component = go.GetComponent<ParticleSystemRenderer>();
Material[] sharedMaterials = ((Renderer)component).sharedMaterials;
sharedMaterials[index] = Addressables.LoadAssetAsync<Material>((object)material).WaitForCompletion();
((Renderer)component).sharedMaterials = sharedMaterials;
}
}
}