using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.UI.LogBook;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.UI;
using RoR2.UI.LogBook;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
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("Impermanence")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bb793b838638f3dc819d44b841d1a7e0ea85fba9")]
[assembly: AssemblyProduct("Impermanence")]
[assembly: AssemblyTitle("Impermanence")]
[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 Impermanence
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Braquen.Impermanance", "Impermanance", "1.0.3")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class ImpermanencePlugin : BaseUnityPlugin
{
public const string PluginGUID = "Braquen.Impermanance";
public const string PluginAuthor = "Braquen";
public const string PluginName = "Impermanance";
public const string PluginVersion = "1.0.3";
public static PluginInfo pluginInfo;
public static AssetBundle AssetBundle;
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
pluginInfo = ((BaseUnityPlugin)this).Info;
AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "impermanenceassetbundle"));
if ((bool)ExtraItemsLunar.isEnabled)
{
GenericGameEvents.Init();
ExtraItemsLunar.Init();
}
}
}
public class ExtraItemsLunar
{
public class ImpermanenceBehaviour : ItemBehavior
{
public float countdownTimer = baseTimer;
public bool diedFromTimer = false;
private bool bossDefeated = false;
public bool countdown10Played = false;
public uint countdown10ID;
public HUD bodyHud;
public GameObject hudPanel = null;
public void Start()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
Log.Debug("ImpermanenceBehavior:Start()");
hudPanel = null;
UpdateItemBasedInfo();
base.body.onInventoryChanged += Body_onInventoryChanged;
Stage.onStageStartGlobal += Stage_onStageStartGlobal;
BossGroup.OnDefeatedServer += new hook_OnDefeatedServer(BossGroup_onDefeatedServer);
}
public void Update()
{
//IL_0147: 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)
if ((Object)(object)bodyHud == (Object)null)
{
foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList)
{
if ((Object)(object)readOnlyInstance.targetBodyObject == (Object)(object)((Component)base.body).gameObject)
{
bodyHud = readOnlyInstance;
}
}
}
if (base.stack > 0 && !bossDefeated)
{
countdownTimer -= Time.deltaTime;
if (diedFromTimer)
{
return;
}
SetHudCountdownEnabled(shouldEnableCountdownPanel: true);
SetCountdownTime(countdownTimer);
if (countdownTimer <= 10f && !countdown10Played)
{
countdown10Played = true;
countdown10ID = Util.PlaySound("Play_UI_arenaMode_coundown_loop", ((Component)base.body).gameObject);
}
if (countdownTimer <= 0f)
{
SetCountdownTime(0.0);
diedFromTimer = true;
if (NetworkServer.active)
{
base.body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
}
if (countdown10Played)
{
countdown10Played = false;
AkSoundEngine.StopPlayingID(countdown10ID);
}
}
}
else
{
SetHudCountdownEnabled(shouldEnableCountdownPanel: false);
SetTimer(baseTimer);
if (countdown10Played)
{
countdown10Played = false;
AkSoundEngine.StopPlayingID(countdown10ID);
}
}
}
public void OnDestroy()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
SetHudCountdownEnabled(shouldEnableCountdownPanel: false);
if (Object.op_Implicit((Object)(object)base.body))
{
base.body.onInventoryChanged -= Body_onInventoryChanged;
}
Stage.onStageStartGlobal -= Stage_onStageStartGlobal;
BossGroup.OnDefeatedServer -= new hook_OnDefeatedServer(BossGroup_onDefeatedServer);
}
public void Body_onInventoryChanged()
{
UpdateItemBasedInfo();
}
public void Stage_onStageStartGlobal(Stage stage)
{
UpdateItemBasedInfo();
bossDefeated = false;
}
public void BossGroup_onDefeatedServer(orig_OnDefeatedServer orig, BossGroup self)
{
if (((Object)self).name != "SuperRoboBallEncounter" && ((Object)self).name != "ShadowCloneEncounter(Clone)")
{
bossDefeated = true;
}
orig.Invoke(self);
}
public void UpdateItemBasedInfo()
{
if (Object.op_Implicit((Object)(object)base.body))
{
if (base.stack < 1)
{
countdownTimer = baseTimer;
}
else
{
countdownTimer = Mathf.Min((float)baseTimer * Mathf.Pow(1f - timerDecreasePercent, (float)(base.stack - 1)), countdownTimer);
}
}
}
public void SetTimer(float time)
{
countdownTimer = time;
}
public int TryDoubleItem()
{
if (!Object.op_Implicit((Object)(object)base.body) || bossDefeated)
{
return 1;
}
float num = bonusChancePercent * (float)base.stack;
int num2 = (int)MathF.Floor(num);
if (Util.CheckRoll((num - (float)num2) * 100f, base.body.master))
{
num2++;
}
return num2 + 1;
}
public void SetHudCountdownEnabled(bool shouldEnableCountdownPanel)
{
if ((Object)(object)hudPanel != (Object)null == shouldEnableCountdownPanel)
{
return;
}
if (shouldEnableCountdownPanel && (Object)(object)bodyHud != (Object)null)
{
Transform obj = ((Component)bodyHud).GetComponent<ChildLocator>().FindChild("TopCenterCluster");
RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null);
if (Object.op_Implicit((Object)(object)val))
{
hudPanel = Object.Instantiate<GameObject>(hudTimer, (Transform)(object)val);
}
}
else
{
Object.Destroy((Object)(object)hudPanel);
hudPanel = null;
}
}
public void SetCountdownTime(double secondsRemaining)
{
if (!((Object)(object)hudPanel == (Object)null))
{
hudPanel.GetComponent<TimerText>().seconds = secondsRemaining;
}
}
public void OnEnable()
{
InstanceTracker.Add<ImpermanenceBehaviour>(this);
}
public void OnDisable()
{
InstanceTracker.Remove<ImpermanenceBehaviour>(this);
}
}
public class ImpermanenceMultiplyItemBehaviour : MonoBehaviour
{
public int multiplier;
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action <>9__8_0;
public static hook_OnInventoryChanged <>9__9_0;
public static hook_OnInteractionBegin <>9__9_1;
public static hook_ItemDrop <>9__9_2;
internal void <Init>b__8_0()
{
if (Object.op_Implicit((Object)(object)itemDef))
{
itemDef.tier = (ItemTier)3;
}
}
internal void <Hooks>b__9_0(orig_OnInventoryChanged orig, CharacterBody self)
{
self.AddItemBehavior<ImpermanenceBehaviour>(self.inventory.GetItemCount(itemDef));
orig.Invoke(self);
}
internal void <Hooks>b__9_1(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
if (!self.saleStarCompatible || !self.CanBeAffordedByInteractor(activator))
{
orig.Invoke(self, activator);
return;
}
CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
ImpermanenceBehaviour component2 = ((Component)component).GetComponent<ImpermanenceBehaviour>();
if (!Object.op_Implicit((Object)(object)component2))
{
orig.Invoke(self, activator);
return;
}
int num = component2.TryDoubleItem();
if (num > 1)
{
Util.PlaySound("Play_item_proc_lowerPricedChest", ((Component)component).gameObject);
ImpermanenceMultiplyItemBehaviour impermanenceMultiplyItemBehaviour = ((Component)self).gameObject.AddComponent<ImpermanenceMultiplyItemBehaviour>();
impermanenceMultiplyItemBehaviour.multiplier = num;
}
}
orig.Invoke(self, activator);
}
internal void <Hooks>b__9_2(orig_ItemDrop orig, ChestBehavior self)
{
PurchaseInteraction component = ((Component)self).gameObject.GetComponent<PurchaseInteraction>();
if (Object.op_Implicit((Object)(object)component))
{
ImpermanenceMultiplyItemBehaviour component2 = ((Component)component).GetComponent<ImpermanenceMultiplyItemBehaviour>();
if (Object.op_Implicit((Object)(object)component2))
{
self.dropCount *= component2.multiplier;
}
}
orig.Invoke(self);
}
internal string <.cctor>b__16_0(int i)
{
return "PLAYER_DEATH_QUOTE_EXTRAITEMSLUNAR_" + TextSerialization.ToStringInvariant(i);
}
}
public static ItemDef itemDef;
private static GameObject hudTimer;
public static ConfigurableValue<bool> isEnabled = new ConfigurableValue<bool>("Item: Impermanence", "Enabled", defaultValue: true, "Whether or not the item is enabled.", new List<string> { "ITEM_EXTRAITEMSLUNAR_DESC" });
public static ConfigurableValue<float> baseTimer = new ConfigurableValue<float>("Item: Impermanence", "Base Time Limit", 600f, "The time limit with one stack of impermanence.", new List<string> { "ITEM_EXTRAITEMSLUNAR_DESC" });
public static ConfigurableValue<float> bonusChancePerStack = new ConfigurableValue<float>("Item: Impermanence", "Chance per Stack", 20f, "The chance of getting bonus items as a percentage.", new List<string> { "ITEM_EXTRAITEMSLUNAR_DESC" });
public static ConfigurableValue<float> timePerStack = new ConfigurableValue<float>("Item: Impermanence", "Time Decrease per Stack", 15f, "The decrease in remaining time as a percentage.", new List<string> { "ITEM_EXTRAITEMSLUNAR_DESC" });
public static float bonusChancePercent = (float)bonusChancePerStack / 100f;
public static float timerDecreasePercent = (float)timePerStack / 100f;
public static string[] impermanenceDeathQuoteTokens = (from i in Enumerable.Range(0, 5)
select "PLAYER_DEATH_QUOTE_EXTRAITEMSLUNAR_" + TextSerialization.ToStringInvariant(i)).ToArray();
internal static void Init()
{
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: 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)
Debug.Log((object)"Initializing Impermanence Item");
itemDef = ScriptableObject.CreateInstance<ItemDef>();
((Object)itemDef).name = "EXTRAITEMSLUNAR";
itemDef.nameToken = "ITEM_EXTRAITEMSLUNAR_NAME";
itemDef.pickupToken = "ITEM_EXTRAITEMSLUNAR_PICKUP";
itemDef.descriptionToken = "ITEM_EXTRAITEMSLUNAR_DESC";
itemDef.loreToken = "ITEM_EXTRAITEMSLUNAR_LORE";
itemDef.AutoPopulateTokens();
((ResourceAvailability)(ref ItemTierCatalog.availability)).CallWhenAvailable((Action)delegate
{
if (Object.op_Implicit((Object)(object)itemDef))
{
itemDef.tier = (ItemTier)3;
}
});
ItemDef obj = itemDef;
ItemTag[] array = new ItemTag[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
obj.tags = (ItemTag[])(object)array;
itemDef.pickupIconSprite = ImpermanencePlugin.AssetBundle.LoadAsset<Sprite>("Assets/Items/impermanence/Icon.png");
itemDef.pickupModelPrefab = ImpermanencePlugin.AssetBundle.LoadAsset<GameObject>("Assets/Items/impermanence/Model.prefab");
ModelPanelParameters val = itemDef.pickupModelPrefab.AddComponent<ModelPanelParameters>();
val.minDistance = 5f;
val.maxDistance = 10f;
itemDef.canRemove = true;
itemDef.hidden = false;
ItemDisplayRuleDict val2 = makeDisplayRules();
ItemAPI.Add(new CustomItem(itemDef, val2));
hudTimer = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/HudCountdownPanel.prefab").WaitForCompletion(), "ImpermanenceCountdownPanel");
((Component)hudTimer.transform.Find("Juice/Container/CountdownTitleLabel")).GetComponent<LanguageTextMeshController>().token = "IMPERMANENCE_TIMER_FLAVOUR";
Color32 val3 = default(Color32);
((Color32)(ref val3))..ctor((byte)0, (byte)157, byte.MaxValue, byte.MaxValue);
((Graphic)((Component)hudTimer.transform.Find("Juice/Container/Border")).GetComponent<Image>()).color = Color32.op_Implicit(val3);
((Graphic)((Component)hudTimer.transform.Find("Juice/Container/CountdownLabel")).GetComponent<HGTextMeshProUGUI>()).color = Color32.op_Implicit(val3);
Hooks();
Debug.Log((object)"Impermanence Initialized");
}
public static void Hooks()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
object obj = <>c.<>9__9_0;
if (obj == null)
{
hook_OnInventoryChanged val = delegate(orig_OnInventoryChanged orig, CharacterBody self)
{
self.AddItemBehavior<ImpermanenceBehaviour>(self.inventory.GetItemCount(itemDef));
orig.Invoke(self);
};
<>c.<>9__9_0 = val;
obj = (object)val;
}
CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj;
object obj2 = <>c.<>9__9_1;
if (obj2 == null)
{
hook_OnInteractionBegin val2 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
if (!self.saleStarCompatible || !self.CanBeAffordedByInteractor(activator))
{
orig.Invoke(self, activator);
}
else
{
CharacterBody component3 = ((Component)activator).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component3))
{
ImpermanenceBehaviour component4 = ((Component)component3).GetComponent<ImpermanenceBehaviour>();
if (!Object.op_Implicit((Object)(object)component4))
{
orig.Invoke(self, activator);
return;
}
int num = component4.TryDoubleItem();
if (num > 1)
{
Util.PlaySound("Play_item_proc_lowerPricedChest", ((Component)component3).gameObject);
ImpermanenceMultiplyItemBehaviour impermanenceMultiplyItemBehaviour = ((Component)self).gameObject.AddComponent<ImpermanenceMultiplyItemBehaviour>();
impermanenceMultiplyItemBehaviour.multiplier = num;
}
}
orig.Invoke(self, activator);
}
};
<>c.<>9__9_1 = val2;
obj2 = (object)val2;
}
PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2;
object obj3 = <>c.<>9__9_2;
if (obj3 == null)
{
hook_ItemDrop val3 = delegate(orig_ItemDrop orig, ChestBehavior self)
{
PurchaseInteraction component = ((Component)self).gameObject.GetComponent<PurchaseInteraction>();
if (Object.op_Implicit((Object)(object)component))
{
ImpermanenceMultiplyItemBehaviour component2 = ((Component)component).GetComponent<ImpermanenceMultiplyItemBehaviour>();
if (Object.op_Implicit((Object)(object)component2))
{
self.dropCount *= component2.multiplier;
}
}
orig.Invoke(self);
};
<>c.<>9__9_2 = val3;
obj3 = (object)val3;
}
ChestBehavior.ItemDrop += (hook_ItemDrop)obj3;
GenericGameEvents.OnPlayerCharacterDeath += GenericGameEvents_OnPlayerCharacterDeath;
}
public static void GenericGameEvents_OnPlayerCharacterDeath(DamageReport damageReport, ref string deathQuote)
{
if (Object.op_Implicit((Object)(object)damageReport.victimBody))
{
ImpermanenceBehaviour component = ((Component)damageReport.victimBody).GetComponent<ImpermanenceBehaviour>();
if (Object.op_Implicit((Object)(object)component) && component.diedFromTimer)
{
deathQuote = impermanenceDeathQuoteTokens[Random.Range(0, impermanenceDeathQuoteTokens.Length)];
}
}
}
public static ItemDisplayRuleDict makeDisplayRules()
{
//IL_000b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0067: 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_0087: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//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_010b: 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_0117: 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_0130: 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_0168: 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_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: 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_01a5: 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_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: 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_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_042c: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_046c: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04db: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_050e: Unknown result type (might be due to invalid IL or missing references)
//IL_0517: Unknown result type (might be due to invalid IL or missing references)
//IL_054a: Unknown result type (might be due to invalid IL or missing references)
//IL_054f: Unknown result type (might be due to invalid IL or missing references)
//IL_0565: Unknown result type (might be due to invalid IL or missing references)
//IL_056a: Unknown result type (might be due to invalid IL or missing references)
//IL_0580: Unknown result type (might be due to invalid IL or missing references)
//IL_0585: Unknown result type (might be due to invalid IL or missing references)
//IL_058a: Unknown result type (might be due to invalid IL or missing references)
//IL_058c: Unknown result type (might be due to invalid IL or missing references)
//IL_059d: Unknown result type (might be due to invalid IL or missing references)
//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
//IL_060f: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_061b: Unknown result type (might be due to invalid IL or missing references)
//IL_062c: Unknown result type (might be due to invalid IL or missing references)
//IL_0635: Unknown result type (might be due to invalid IL or missing references)
//IL_0668: Unknown result type (might be due to invalid IL or missing references)
//IL_066d: Unknown result type (might be due to invalid IL or missing references)
//IL_0683: Unknown result type (might be due to invalid IL or missing references)
//IL_0688: Unknown result type (might be due to invalid IL or missing references)
//IL_069e: Unknown result type (might be due to invalid IL or missing references)
//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
//IL_06bb: 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_06f7: Unknown result type (might be due to invalid IL or missing references)
//IL_06fc: 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_0717: Unknown result type (might be due to invalid IL or missing references)
//IL_072d: Unknown result type (might be due to invalid IL or missing references)
//IL_0732: Unknown result type (might be due to invalid IL or missing references)
//IL_0737: 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_074a: Unknown result type (might be due to invalid IL or missing references)
//IL_0753: Unknown result type (might be due to invalid IL or missing references)
//IL_0786: Unknown result type (might be due to invalid IL or missing references)
//IL_078b: Unknown result type (might be due to invalid IL or missing references)
//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
//IL_07c6: Unknown result type (might be due to invalid IL or missing references)
//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0815: Unknown result type (might be due to invalid IL or missing references)
//IL_081a: Unknown result type (might be due to invalid IL or missing references)
//IL_0830: Unknown result type (might be due to invalid IL or missing references)
//IL_0835: Unknown result type (might be due to invalid IL or missing references)
//IL_084b: Unknown result type (might be due to invalid IL or missing references)
//IL_0850: Unknown result type (might be due to invalid IL or missing references)
//IL_0855: Unknown result type (might be due to invalid IL or missing references)
//IL_0857: Unknown result type (might be due to invalid IL or missing references)
//IL_0868: Unknown result type (might be due to invalid IL or missing references)
//IL_0871: Unknown result type (might be due to invalid IL or missing references)
//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
//IL_08a9: Unknown result type (might be due to invalid IL or missing references)
//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
//IL_08da: Unknown result type (might be due to invalid IL or missing references)
//IL_08df: Unknown result type (might be due to invalid IL or missing references)
//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
//IL_08e6: Unknown result type (might be due to invalid IL or missing references)
//IL_08f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0900: Unknown result type (might be due to invalid IL or missing references)
//IL_0933: Unknown result type (might be due to invalid IL or missing references)
//IL_0938: Unknown result type (might be due to invalid IL or missing references)
//IL_094e: Unknown result type (might be due to invalid IL or missing references)
//IL_0953: Unknown result type (might be due to invalid IL or missing references)
//IL_0969: Unknown result type (might be due to invalid IL or missing references)
//IL_096e: Unknown result type (might be due to invalid IL or missing references)
//IL_0973: Unknown result type (might be due to invalid IL or missing references)
//IL_0975: Unknown result type (might be due to invalid IL or missing references)
//IL_0986: Unknown result type (might be due to invalid IL or missing references)
//IL_098f: Unknown result type (might be due to invalid IL or missing references)
//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
//IL_09c7: Unknown result type (might be due to invalid IL or missing references)
//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
//IL_09e2: Unknown result type (might be due to invalid IL or missing references)
//IL_09f8: Unknown result type (might be due to invalid IL or missing references)
//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0a02: Unknown result type (might be due to invalid IL or missing references)
//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
//IL_0a0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0a13: Expected O, but got Unknown
ItemDisplayRule[] array = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Head",
localPos = new Vector3(0f, 0.43f, 0f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array2 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Head",
localPos = new Vector3(0f, 0.43f, 0f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array3 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Head",
localPos = new Vector3(0f, 0.35f, -0.09f),
localAngles = new Vector3(345f, 0f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array4 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Head",
localPos = new Vector3(0f, 0.23f, 0f),
localAngles = new Vector3(355f, 0f, 0f),
localScale = new Vector3(0.04f, 0.04f, 0.04f)
}
};
ItemDisplayRule[] array5 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Head",
localPos = new Vector3(-1.44f, 3.71f, 0.37f),
localAngles = new Vector3(55f, 0f, 0f),
localScale = new Vector3(0.2f, 0.2f, 0.2f)
}
};
ItemDisplayRule[] array6 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "MuzzleRight",
localPos = new Vector3(-0.1725f, -0.17242f, -0.29035f),
localAngles = new Vector3(315f, 270f, 180f),
localScale = new Vector3(0.031f, 0.03f, 0.031f)
}
};
ItemDisplayRule[] array7 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Chest",
localPos = new Vector3(-0.11179f, 0.33944f, -0.17685f),
localAngles = new Vector3(10f, 0f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array8 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Chest",
localPos = new Vector3(0.00322f, 0.28508f, -0.22849f),
localAngles = new Vector3(0f, 90f, 0f),
localScale = new Vector3(0.02f, 0.02f, 0.02f)
}
};
ItemDisplayRule[] array9 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "FlowerBase",
localPos = new Vector3(-0.66143f, 0.72885f, 0.48302f),
localAngles = new Vector3(0f, 180f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array10 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "MechBase",
localPos = new Vector3(0.15849f, 0.38956f, 0.42917f),
localAngles = new Vector3(0f, 180f, 0f),
localScale = new Vector3(0.02f, 0.02f, 0.02f)
}
};
ItemDisplayRule[] array11 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "SpineChest1",
localPos = new Vector3(1.61135f, 3.34974f, 5.01534f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.2f, 0.2f, 0.2f)
}
};
ItemDisplayRule[] array12 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "ClavicleL",
localPos = new Vector3(-0.00551f, 0.00861f, -0.13122f),
localAngles = new Vector3(270f, 0f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array13 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Backpack",
localPos = new Vector3(-0.16635f, 0.43282f, 0.00679f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array14 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Chest",
localPos = new Vector3(-0.13114f, 0.28689f, -0.30823f),
localAngles = new Vector3(290f, 0f, 0f),
localScale = new Vector3(0.03f, 0.05f, 0.03f)
}
};
ItemDisplayRule[] array15 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Pack",
localPos = new Vector3(-0.26289f, 0.1602f, -0.21764f),
localAngles = new Vector3(345f, 90f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array16 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Chest",
localPos = new Vector3(-0.3189f, 0.16636f, -0.2061f),
localAngles = new Vector3(0f, 0f, 90f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array17 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Pelvis",
localPos = new Vector3(0.05234f, 0.12436f, 0.11509f),
localAngles = new Vector3(5f, 225f, 0f),
localScale = new Vector3(0.05f, 0.05f, 0.05f)
}
};
ItemDisplayRule[] array18 = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = itemDef.pickupModelPrefab,
childName = "Head",
localPos = new Vector3(2.87f, 6.93f, -2.89f),
localAngles = new Vector3(35f, 0f, 0f),
localScale = new Vector3(0.5f, 0.75f, 0.5f)
}
};
ItemDisplayRuleDict val = new ItemDisplayRuleDict(array);
val.Add("CommandoBody", array2);
val.Add("HuntressBody", array3);
val.Add("Bandit2Body", array4);
val.Add("ToolbotBody", array5);
val.Add("EngiBody", array6);
val.Add("MageBody", array7);
val.Add("MercBody", array8);
val.Add("TreebotBody", array9);
val.Add("LoaderBody", array10);
val.Add("CrocoBody", array11);
val.Add("CaptainBody", array12);
val.Add("RailgunnerBody", array13);
val.Add("VoidSurvivorBody", array14);
val.Add("SeekerBody", array15);
val.Add("ChefBody", array16);
val.Add("FalseSonBody", array17);
val.Add("ScavBody", array18);
return val;
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
public static class ConfigManager
{
public static class Scaling
{
public static ConfigFile config = new ConfigFile(Paths.ConfigPath + "\\Impermanence.cfg", true);
public static string categoryName = "Impermanence Config";
public static string categoryGUID = "Braquen.Impermanance_config";
public static ConfigOptions.ConfigurableValue<bool> useCustomValues = ConfigOptions.ConfigurableValue.CreateBool(categoryGUID, categoryName, config, "! Important !", "Use Custom Config", defaultValue: false, "Set to true to enable custom configurations.");
}
}
public class ConfigurableValue<T> : ConfigOptions.ConfigurableValue<T>
{
public ConfigurableValue(string section, string key, float defaultValue, string description = "", List<string> stringsToAffect = null, Action<float> onChanged = null)
: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
{
ConfigOptions.ConfigurableValue.CreateFloat(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, 0f, 1000000f, description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
}
public ConfigurableValue(string section, string key, int defaultValue, string description = "", List<string> stringsToAffect = null, Action<int> onChanged = null)
: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
{
ConfigOptions.ConfigurableValue.CreateInt(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, 0, 1000000, description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
}
public ConfigurableValue(string section, string key, bool defaultValue, string description = "", List<string> stringsToAffect = null, Action<bool> onChanged = null)
: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
{
ConfigOptions.ConfigurableValue.CreateBool(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
}
public ConfigurableValue(string section, string key, string defaultValue, string description = "", List<string> stringsToAffect = null, Action<string> onChanged = null)
: base(ConfigManager.Scaling.config, section, key, (T)Convert.ChangeType(defaultValue, typeof(T)), description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, (Action<T>)null)
{
ConfigOptions.ConfigurableValue.CreateString(ConfigManager.Scaling.categoryGUID, ConfigManager.Scaling.categoryName, ConfigManager.Scaling.config, section, key, defaultValue, description, stringsToAffect, ConfigManager.Scaling.useCustomValues.bepinexConfigEntry, restartRequired: false, onChanged);
}
}
public static class ConfigOptions
{
public abstract class ConfigurableValue
{
public static List<ConfigurableValue> instancesList = new List<ConfigurableValue>();
public List<string> stringsToAffect = new List<string>();
public string key = "";
public string id = "";
public static ConfigurableValue<T> Create<T>(ConfigFile configFile, string section, string key, T defaultValue, string description = "", List<string> stringsToAffect = null, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<T> onChanged = null)
{
return new ConfigurableValue<T>(configFile, section, key, defaultValue, description, stringsToAffect, useCustomValueConfigEntry, restartRequired, onChanged);
}
public static ConfigurableValue<int> CreateInt(string modGUID, string modName, ConfigFile configFile, string section, string key, int defaultValue, int min = 0, int max = 1000, string description = "", List<string> stringsToAffect = null, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<int> onChanged = null)
{
return Create(configFile, section, key, defaultValue, description, stringsToAffect, useCustomValueConfigEntry, restartRequired, onChanged);
}
public static ConfigurableValue<float> CreateFloat(string modGUID, string modName, ConfigFile configFile, string section, string key, float defaultValue, float min = 0f, float max = 1000f, string description = "", List<string> stringsToAffect = null, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<float> onChanged = null)
{
return Create(configFile, section, key, defaultValue, description, stringsToAffect, useCustomValueConfigEntry, restartRequired, onChanged);
}
public static ConfigurableValue<bool> CreateBool(string modGUID, string modName, ConfigFile configFile, string section, string key, bool defaultValue, string description = "", List<string> stringsToAffect = null, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<bool> onChanged = null)
{
return Create(configFile, section, key, defaultValue, description, stringsToAffect, useCustomValueConfigEntry, restartRequired, onChanged);
}
public static ConfigurableValue<string> CreateString(string modGUID, string modName, ConfigFile configFile, string section, string key, string defaultValue, string description = "", List<string> stringsToAffect = null, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<string> onChanged = null)
{
return Create(configFile, section, key, defaultValue, description, stringsToAffect, useCustomValueConfigEntry, restartRequired, onChanged);
}
}
public class ConfigurableValue<T> : ConfigurableValue
{
public ConfigEntry<T> bepinexConfigEntry;
private ConfigEntry<bool> useCustomValueConfigEntry;
private T defaultValue;
public T Value
{
get
{
if (useCustomValueConfigEntry != null && useCustomValueConfigEntry.Value)
{
return bepinexConfigEntry.Value;
}
return defaultValue;
}
}
public ConfigurableValue(ConfigFile configFile, string section, string key, T defaultValue, string description = "", List<string> stringsToAffect = null, ConfigEntry<bool> useCustomValueConfigEntry = null, bool restartRequired = false, Action<T> onChanged = null)
{
ConfigurableValue<T> configurableValue = this;
id = Path.GetFileNameWithoutExtension(configFile.ConfigFilePath) + "." + section + "." + key;
ConfigurableValue configurableValue2 = ConfigurableValue.instancesList.FirstOrDefault((ConfigurableValue x) => x.id == configurableValue.id);
if (configurableValue2 != null)
{
ConfigurableValue<T> configurableValue3 = configurableValue2 as ConfigurableValue<T>;
bepinexConfigEntry = configurableValue3.bepinexConfigEntry;
this.useCustomValueConfigEntry = useCustomValueConfigEntry;
}
else
{
bepinexConfigEntry = configFile.Bind<T>(section, key, defaultValue, description);
ConfigurableValue.instancesList.Add(this);
}
this.useCustomValueConfigEntry = useCustomValueConfigEntry;
base.key = key;
this.defaultValue = defaultValue;
if (stringsToAffect != null)
{
base.stringsToAffect = stringsToAffect;
}
else
{
base.stringsToAffect = new List<string>();
}
if (onChanged != null)
{
bepinexConfigEntry.SettingChanged += delegate
{
onChanged(configurableValue.bepinexConfigEntry.Value);
reloadLogbook = true;
};
onChanged(bepinexConfigEntry.Value);
reloadLogbook = true;
}
}
public override string ToString()
{
return Convert.ToString(Value, CultureInfo.InvariantCulture);
}
public static implicit operator T(ConfigurableValue<T> configurableValue)
{
return configurableValue.Value;
}
}
[CompilerGenerated]
private static class <>O
{
public static hook_Awake <0>__LogBookController_Awake;
public static hook_GetLocalizedStringByToken <1>__Language_GetLocalizedStringByToken;
}
private static bool reloadLogbook;
internal static void Init()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
object obj = <>O.<0>__LogBookController_Awake;
if (obj == null)
{
hook_Awake val = LogBookController_Awake;
<>O.<0>__LogBookController_Awake = val;
obj = (object)val;
}
LogBookController.Awake += (hook_Awake)obj;
object obj2 = <>O.<1>__Language_GetLocalizedStringByToken;
if (obj2 == null)
{
hook_GetLocalizedStringByToken val2 = Language_GetLocalizedStringByToken;
<>O.<1>__Language_GetLocalizedStringByToken = val2;
obj2 = (object)val2;
}
Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj2;
}
private static void LogBookController_Awake(orig_Awake orig, LogBookController self)
{
orig.Invoke(self);
if (reloadLogbook)
{
reloadLogbook = false;
LogBookController.BuildStaticData();
}
}
private static string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token)
{
string text = orig.Invoke(self, token);
foreach (ConfigurableValue item in ConfigurableValue.instancesList.FindAll((ConfigurableValue x) => x.stringsToAffect.Contains(token)))
{
text = text.Replace("{" + item.key + "}", item.ToString());
}
return text;
}
}
public class GenericGameEvents
{
public delegate void PlayerCharacterDeathEventHandler(DamageReport damageReport, ref string deathQuote);
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<Instruction, bool> <>9__5_2;
public static Func<Instruction, bool> <>9__5_4;
public static Func<string, DamageReport, string> <>9__5_1;
public static Manipulator <>9__5_0;
internal void <Init>b__5_0(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0();
ILCursor val = new ILCursor(il);
CS$<>8__locals0.deathQuotePos = -1;
if (val.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_DEATH_QUOTE_VOIDDEATH"),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.deathQuotePos)
}) && val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld<GlobalEventManager>(x, "standardDeathQuoteTokens")
}) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, CS$<>8__locals0.deathQuotePos)
}))
{
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Func<string, DamageReport, string>>((Func<string, DamageReport, string>)delegate(string deathQuote, DamageReport damageReport)
{
if (GenericGameEvents.OnPlayerCharacterDeath != null)
{
GenericGameEvents.OnPlayerCharacterDeath(damageReport, ref deathQuote);
}
return deathQuote;
});
}
else
{
ErrorHookFailed("on player character death");
}
}
internal bool <Init>b__5_2(Instruction x)
{
return ILPatternMatchingExt.MatchLdstr(x, "PLAYER_DEATH_QUOTE_VOIDDEATH");
}
internal bool <Init>b__5_4(Instruction x)
{
return ILPatternMatchingExt.MatchLdsfld<GlobalEventManager>(x, "standardDeathQuoteTokens");
}
internal string <Init>b__5_1(string deathQuote, DamageReport damageReport)
{
if (GenericGameEvents.OnPlayerCharacterDeath != null)
{
GenericGameEvents.OnPlayerCharacterDeath(damageReport, ref deathQuote);
}
return deathQuote;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass5_0
{
public int deathQuotePos;
internal bool <Init>b__3(Instruction x)
{
return ILPatternMatchingExt.MatchStloc(x, ref deathQuotePos);
}
internal bool <Init>b__5(Instruction x)
{
return ILPatternMatchingExt.MatchStloc(x, deathQuotePos);
}
}
public static event PlayerCharacterDeathEventHandler OnPlayerCharacterDeath;
internal static void ErrorHookFailed(string name)
{
Log.Error("generic game event '" + name + "' hook failed");
}
internal static void Init()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
object obj = <>c.<>9__5_0;
if (obj == null)
{
Manipulator val = delegate(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
ILCursor val2 = new ILCursor(il);
int deathQuotePos = -1;
if (val2.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_DEATH_QUOTE_VOIDDEATH"),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref deathQuotePos)
}) && val2.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld<GlobalEventManager>(x, "standardDeathQuoteTokens")
}) && val2.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, deathQuotePos)
}))
{
val2.Emit(OpCodes.Ldarg_1);
val2.EmitDelegate<Func<string, DamageReport, string>>((Func<string, DamageReport, string>)delegate(string deathQuote, DamageReport damageReport)
{
if (GenericGameEvents.OnPlayerCharacterDeath != null)
{
GenericGameEvents.OnPlayerCharacterDeath(damageReport, ref deathQuote);
}
return deathQuote;
});
}
else
{
ErrorHookFailed("on player character death");
}
};
<>c.<>9__5_0 = val;
obj = (object)val;
}
GlobalEventManager.OnPlayerCharacterDeath += (Manipulator)obj;
}
}
}