Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CircletExtended v1.1.9
CircletExtended.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AzuExtendedPlayerInventory; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ExtraSlotsAPI; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; [assembly: AssemblyFileVersion("1.1.9")] [assembly: Guid("01429425-f577-46f2-bba7-6faf98d54110")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyProduct("Circlet Extended")] [assembly: AssemblyCompany("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("Circlet Extended")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.9.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<deab28fe-a57b-48ac-93e0-309d00db76f3>Embedded] internal sealed class <deab28fe-a57b-48ac-93e0-309d00db76f3>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [<deab28fe-a57b-48ac-93e0-309d00db76f3>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <654741cb-9849-494a-9b2f-e275df8fe3ac>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <654741cb-9849-494a-9b2f-e275df8fe3ac>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <654741cb-9849-494a-9b2f-e275df8fe3ac>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<deab28fe-a57b-48ac-93e0-309d00db76f3>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <d4b0f3c0-4f2f-4c00-812f-371085695aa1>NullableContextAttribute : Attribute { public readonly byte Flag; public <d4b0f3c0-4f2f-4c00-812f-371085695aa1>NullableContextAttribute(byte P_0) { Flag = P_0; } } } internal class CustomPrefabs { [HarmonyPatch(typeof(ZNetView), "Awake")] public static class ZNetView_Awake_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(ZSyncTransform), "Awake")] public static class ZSyncTransform_Awake_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(ZSyncTransform), "OnEnable")] public static class ZSyncTransform_OnEnable_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(ItemDrop), "Awake")] public static class ItemDrop_Awake_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(ItemDrop), "Start")] public static class ItemDrop_Start_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(Piece), "Awake")] public static class Piece_Awake_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(WearNTear), "Awake")] public static class WearNTear_Awake_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(WearNTear), "Start")] public static class WearNTear_Start_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } [HarmonyPatch(typeof(GuidePoint), "Start")] public static class GuidePoint_Start_AddPrefab { [HarmonyPriority(800)] private static bool Prefix() { return !prefabInit; } } private const string c_rootObjectName = "_shudnalRoot"; private const string c_rootPrefabsName = "Prefabs"; private static GameObject rootObject; private static GameObject rootPrefabs; public static bool prefabInit; private static void InitRootObject() { //IL_0023: 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_008c: Expected O, but got Unknown if ((Object)(object)rootObject == (Object)null) { rootObject = (GameObject)(((object)GameObject.Find("_shudnalRoot")) ?? ((object)new GameObject("_shudnalRoot"))); } Object.DontDestroyOnLoad((Object)(object)rootObject); if ((Object)(object)rootPrefabs == (Object)null) { Transform obj = rootObject.transform.Find("Prefabs"); rootPrefabs = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)rootPrefabs == (Object)null) { rootPrefabs = new GameObject("Prefabs"); rootPrefabs.transform.SetParent(rootObject.transform, false); rootPrefabs.SetActive(false); } } } internal static GameObject InitPrefabClone(GameObject prefabToClone, string prefabName) { InitRootObject(); if ((Object)(object)rootPrefabs.transform.Find(prefabName) != (Object)null) { return ((Component)rootPrefabs.transform.Find(prefabName)).gameObject; } prefabInit = true; GameObject val = Object.Instantiate<GameObject>(prefabToClone, rootPrefabs.transform, false); prefabInit = false; ((Object)val).name = prefabName; return val; } internal static Component AddComponent(GameObject gameObject, Type type) { prefabInit = true; Component result = gameObject.AddComponent(type); prefabInit = false; return result; } } namespace CircletExtended { [Serializable] public class HumanoidHelmetCirclet { public ItemData circlet; public HumanoidHelmetCirclet() { circlet = null; } } public static class HumanoidExtension { [HarmonyPatch(typeof(Humanoid), "SetupVisEquipment")] public static class Humanoid_SetupVisEquipment_CustomItemType { private static void Postfix(Humanoid __instance, VisEquipment visEq) { if (CircletExtended.enablePutOnTop.Value) { ItemData circlet = __instance.GetCirclet(); if (CircletExtended.equipCircletUnderHelmet.Value) { visEq.SetCircletItem((circlet != null) ? ((Object)circlet.m_dropPrefab).name : ""); return; } string helmetItem = ((circlet != null) ? ((Object)circlet.m_dropPrefab).name : ((__instance.m_helmetItem != null) ? ((Object)__instance.m_helmetItem.m_dropPrefab).name : "")); visEq.SetHelmetItem(helmetItem); } } } [HarmonyPatch(typeof(Humanoid), "GetEquipmentWeight")] public static class Humanoid_GetEquipmentWeight_CustomItemType { private static void Postfix(Humanoid __instance, ref float __result) { if (CircletExtended.enablePutOnTop.Value) { ItemData circlet = __instance.GetCirclet(); if (circlet != null) { __result += circlet.m_shared.m_weight; } } } } private static readonly ConditionalWeakTable<Humanoid, HumanoidHelmetCirclet> data = new ConditionalWeakTable<Humanoid, HumanoidHelmetCirclet>(); public static HumanoidHelmetCirclet GetCircletData(this Humanoid humanoid) { return data.GetOrCreateValue(humanoid); } public static ItemData GetCirclet(this Humanoid humanoid) { return humanoid.GetCircletData().circlet; } public static ItemData SetCirclet(this Humanoid humanoid, ItemData item) { return humanoid.GetCircletData().circlet = item; } } [Serializable] public class VisEquipmentCirclet { public string m_circletItem = ""; public GameObject m_circletItemInstance; public int m_currentCircletItemHash = 0; public bool m_showCirclet = true; public static readonly int s_circletItem = StringExtensionMethods.GetStableHashCode("CircletItem"); } public static class VisEquipmentExtension { [HarmonyPatch(typeof(VisEquipment), "UpdateEquipmentVisuals")] public static class VisEquipment_UpdateEquipmentVisuals_CustomItemType { private static void Prefix(VisEquipment __instance) { int hash = 0; ZDO zDO = __instance.m_nview.GetZDO(); if (zDO != null) { hash = zDO.GetInt(VisEquipmentCirclet.s_circletItem, 0); } else { VisEquipmentCirclet circletData = __instance.GetCircletData(); if (!string.IsNullOrEmpty(circletData.m_circletItem)) { hash = StringExtensionMethods.GetStableHashCode(circletData.m_circletItem); } } if (__instance.SetCircletEquipped(hash)) { __instance.UpdateLodgroup(); } } } [HarmonyPatch(typeof(VisEquipment), "UpdateLodgroup")] public static class VisEquipment_UpdateLodgroup_CustomItemType { private static void Prefix(VisEquipment __instance) { if (!CircletExtended.enablePutOnTop.Value || (Object)(object)__instance.m_lodGroup == (Object)null) { return; } VisEquipmentCirclet circletData = __instance.GetCircletData(); if (Object.op_Implicit((Object)(object)circletData.m_circletItemInstance)) { bool flag = __instance.m_currentHelmetItemHash == 0 || CircletExtended.equipWithHelmetsList.Contains(__instance.m_currentHelmetItemHash) || CircletExtended.equipWithHelmetsList.Contains(CircletExtended.allHelmetsHash); if (circletData.m_showCirclet != flag) { ((Component)circletData.m_circletItemInstance.transform.Find("bronzehelmet")).gameObject.SetActive(flag); circletData.m_showCirclet = flag; } } } } private static readonly ConditionalWeakTable<VisEquipment, VisEquipmentCirclet> data = new ConditionalWeakTable<VisEquipment, VisEquipmentCirclet>(); public static VisEquipmentCirclet GetCircletData(this VisEquipment visEquipment) { return data.GetOrCreateValue(visEquipment); } public static void SetCircletItem(this VisEquipment visEquipment, string name) { VisEquipmentCirclet circletData = visEquipment.GetCircletData(); if (!(circletData.m_circletItem == name)) { circletData.m_circletItem = name; if (visEquipment.m_nview.GetZDO() != null && visEquipment.m_nview.IsOwner()) { visEquipment.m_nview.GetZDO().Set(VisEquipmentCirclet.s_circletItem, (!string.IsNullOrEmpty(name)) ? StringExtensionMethods.GetStableHashCode(name) : 0, false); } } } public static bool SetCircletEquipped(this VisEquipment visEquipment, int hash) { VisEquipmentCirclet circletData = visEquipment.GetCircletData(); if (circletData.m_currentCircletItemHash == hash) { return false; } if (Object.op_Implicit((Object)(object)circletData.m_circletItemInstance)) { Object.Destroy((Object)(object)circletData.m_circletItemInstance); circletData.m_circletItemInstance = null; } circletData.m_currentCircletItemHash = hash; if (hash != 0) { circletData.m_circletItemInstance = visEquipment.AttachItem(hash, 0, visEquipment.m_helmet, true, false); } circletData.m_showCirclet = true; return true; } } internal static class CustomItemType { [HarmonyPatch(typeof(Humanoid), "EquipItem")] public static class Humanoid_EquipItem_CircletOnTop { private static void Postfix(Humanoid __instance, ItemData item, ref bool __result, bool triggerEquipEffects) { if (!CircletExtended.enablePutOnTop.Value) { return; } if (CircletItem.IsCircletItem(__instance.m_helmetItem)) { CircletExtended.LogInfo("Unequipping circlet on circlet equipment"); __instance.UnequipItem(__instance.GetCirclet(), triggerEquipEffects); } else { if (!CircletItem.IsCircletItem(item)) { return; } if (!CircletItem.CanCircletBeEquippedWithHelmet(__instance.m_helmetItem)) { if (triggerEquipEffects) { ((Character)__instance).Message((MessageType)2, "$piece_armorstand_cantattach", 0, (Sprite)null); } return; } bool flag = __instance.GetCirclet() != null; __instance.UnequipItem(__instance.GetCirclet(), triggerEquipEffects); if (flag) { __instance.m_visEquipment.UpdateEquipmentVisuals(); } __instance.SetCirclet(item); if (__instance.IsItemEquiped(item)) { item.m_equipped = true; __result = true; } __instance.SetupEquipment(); if (triggerEquipEffects) { __instance.TriggerEquipEffect(item); } } } } [HarmonyPatch(typeof(Humanoid), "UnequipItem")] public static class Humanoid_UnequipItem_CircletOnTop { private static void Postfix(Humanoid __instance, ItemData item, bool triggerEquipEffects) { if (CircletExtended.enablePutOnTop.Value && CircletItem.IsCircletItem(item) && __instance.GetCirclet() == item) { __instance.SetCirclet(null); __instance.SetupEquipment(); } } } [HarmonyPatch(typeof(Humanoid), "UnequipAllItems")] public class Humanoid_UnequipAllItems_CircletOnTop { public static void Postfix(Humanoid __instance) { if (CircletExtended.enablePutOnTop.Value) { __instance.UnequipItem(__instance.GetCirclet(), false); } } } [HarmonyPatch(typeof(Humanoid), "IsItemEquiped")] public static class Humanoid_IsItemEquiped_CircletOnTop { private static void Postfix(Humanoid __instance, ItemData item, ref bool __result) { if (CircletExtended.enablePutOnTop.Value && CircletItem.IsCircletItem(item)) { __result = __result || __instance.GetCirclet() == item; } } } [HarmonyPatch(typeof(ItemData), "IsEquipable")] public static class ItemDropItemData_IsEquipable_CircletOnTop { private static void Postfix(ItemData __instance, ref bool __result) { if (CircletExtended.enablePutOnTop.Value) { __result = __result || CircletItem.IsCircletType(__instance); } } } [HarmonyPatch(typeof(Inventory), "Changed")] public static class Inventory_Changed_CustomItemType { private static void Prefix(Inventory __instance) { Player localPlayer = Player.m_localPlayer; if (__instance == ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null)) { ItemData circlet = ((Humanoid)(object)Player.m_localPlayer).GetCirclet(); if (circlet != null && (!__instance.ContainsItem(circlet) || !CircletItem.CanCircletBeEquippedWithHelmet(((Humanoid)Player.m_localPlayer).m_helmetItem))) { ((Humanoid)(object)Player.m_localPlayer).SetCirclet(null); ((Humanoid)Player.m_localPlayer).SetupEquipment(); } } } } [HarmonyPatch(typeof(ItemStand), "Awake")] public static class ItemStand_Awake_CircletOnTop { private static void Postfix(ItemStand __instance) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (CircletExtended.enablePutOnTop.Value && CircletExtended.visualStateItemStand.Value) { ZNetView nview = __instance.m_nview; if (nview != null && nview.IsValid() && __instance.m_supportedTypes.Contains((ItemType)6) && !__instance.m_supportedTypes.Contains(CircletItem.GetItemType())) { __instance.m_supportedTypes.Add(CircletItem.GetItemType()); } } } } [HarmonyPatch(typeof(ArmorStand), "Awake")] public static class ArmorStand_Awake_CircletOnTop { private static void Postfix(ArmorStand __instance) { if (!CircletExtended.enablePutOnTop.Value || !CircletExtended.visualStateArmorStand.Value) { return; } ZNetView nview = __instance.m_nview; if (nview != null && nview.IsValid()) { CollectionExtensions.Do<ArmorStandSlot>(__instance.m_slots.Where((ArmorStandSlot x) => (int)x.m_slot == 6 && x.m_supportedTypes.Contains((ItemType)6) && !x.m_supportedTypes.Contains(CircletItem.GetItemType())), (Action<ArmorStandSlot>)delegate(ArmorStandSlot x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) x.m_supportedTypes.Add(CircletItem.GetItemType()); }); } } } } [BepInIncompatibility("randyknapp.mods.dvergercolor")] [BepInPlugin("shudnal.CircletExtended", "Circlet Extended", "1.1.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("Azumatt.CircletDemister")] public class CircletExtended : BaseUnityPlugin { public const string pluginID = "shudnal.CircletExtended"; public const string pluginName = "Circlet Extended"; public const string pluginVersion = "1.1.9"; private readonly Harmony harmony = new Harmony("shudnal.CircletExtended"); internal static readonly ConfigSync configSync = new ConfigSync("shudnal.CircletExtended") { DisplayName = "Circlet Extended", CurrentVersion = "1.1.9", MinimumRequiredVersion = "1.1.9" }; private static ConfigEntry<bool> configLocked; private static ConfigEntry<bool> loggingEnabled; public static ConfigEntry<bool> equipCircletUnderHelmet; public static ConfigEntry<string> equipCircletWithHelmet; public static ConfigEntry<int> itemSlotType; public static ConfigEntry<bool> itemSlotAzuEPI; public static ConfigEntry<string> itemSlotNameAzuEPI; public static ConfigEntry<int> itemSlotIndexAzuEPI; public static ConfigEntry<bool> itemSlotExtraSlots; public static ConfigEntry<string> itemSlotNameExtraSlots; public static ConfigEntry<int> itemSlotIndexExtraSlots; public static ConfigEntry<bool> itemSlotExtraSlotsDiscovery; public static ConfigEntry<bool> getFeaturesByUpgrade; public static ConfigEntry<int> overloadChargesPerLevel; public static ConfigEntry<string> overloadEmote; public static ConfigEntry<bool> enableOverload; public static ConfigEntry<bool> enableDemister; public static ConfigEntry<bool> enablePutOnTop; public static ConfigEntry<bool> enableSpotLight; public static ConfigEntry<int> fuelMinutes; public static ConfigEntry<int> fuelPerLevel; public static ConfigEntry<float> fuelDrainMinIntensityFactor; public static ConfigEntry<float> fuelDrainMaxIntensityFactor; public static ConfigEntry<Color> circletColor; public static ConfigEntry<bool> disableOnSleep; public static ConfigEntry<bool> enableShadows; public static ConfigEntry<bool> enableOverloadDemister; public static ConfigEntry<float> overloadDemisterRange; public static ConfigEntry<float> overloadDemisterTime; public static ConfigEntry<bool> visualStateItemDrop; public static ConfigEntry<bool> visualStateItemStand; public static ConfigEntry<bool> visualStateArmorStand; public static ConfigEntry<bool> circletRecipeCraftingEnabled; public static ConfigEntry<string> circletRecipeCraftingStation; public static ConfigEntry<string> circletRecipeRepairStation; public static ConfigEntry<int> circletRecipeCraftingStationLvl; public static ConfigEntry<int> circletRecipeRepairStationLvl; public static ConfigEntry<string> circletRecipeQuality1; public static ConfigEntry<string> circletRecipeQuality2; public static ConfigEntry<string> circletRecipeQuality3; public static ConfigEntry<string> circletRecipeQuality4; public static ConfigEntry<string> circletHelmetWhiteList; public static ConfigEntry<string> circletHelmetBlackList; public static ConfigEntry<KeyboardShortcut> widenShortcut; public static ConfigEntry<KeyboardShortcut> narrowShortcut; public static ConfigEntry<KeyboardShortcut> toggleShortcut; public static ConfigEntry<KeyboardShortcut> toggleDemisterShortcut; public static ConfigEntry<KeyboardShortcut> increaseIntensityShortcut; public static ConfigEntry<KeyboardShortcut> decreaseIntensityShortcut; public static ConfigEntry<KeyboardShortcut> toggleShadowsShortcut; public static ConfigEntry<KeyboardShortcut> toggleSpotShortcut; public static ConfigEntry<bool> toggleSpotWithFront; public static ConfigEntry<KeyboardShortcut> overloadShortcut; public static ConfigEntry<int> maxSteps; public static ConfigEntry<float> minAngle; public static ConfigEntry<float> maxAngle; public static ConfigEntry<float> minIntensity; public static ConfigEntry<float> maxIntensity; public static ConfigEntry<float> minRange; public static ConfigEntry<float> maxRange; public static ConfigEntry<float> pointIntensity; public static ConfigEntry<float> pointRange; public static ConfigEntry<float> spotIntensity; public static ConfigEntry<float> spotRange; public static ConfigEntry<int> maxSteps2; public static ConfigEntry<float> minAngle2; public static ConfigEntry<float> maxAngle2; public static ConfigEntry<float> minIntensity2; public static ConfigEntry<float> maxIntensity2; public static ConfigEntry<float> minRange2; public static ConfigEntry<float> maxRange2; public static ConfigEntry<float> pointIntensity2; public static ConfigEntry<float> pointRange2; public static ConfigEntry<float> spotIntensity2; public static ConfigEntry<float> spotRange2; public static ConfigEntry<int> maxSteps3; public static ConfigEntry<float> minAngle3; public static ConfigEntry<float> maxAngle3; public static ConfigEntry<float> minIntensity3; public static ConfigEntry<float> maxIntensity3; public static ConfigEntry<float> minRange3; public static ConfigEntry<float> maxRange3; public static ConfigEntry<float> pointIntensity3; public static ConfigEntry<float> pointRange3; public static ConfigEntry<float> spotIntensity3; public static ConfigEntry<float> spotRange3; public static ConfigEntry<int> maxSteps4; public static ConfigEntry<float> minAngle4; public static ConfigEntry<float> maxAngle4; public static ConfigEntry<float> minIntensity4; public static ConfigEntry<float> maxIntensity4; public static ConfigEntry<float> minRange4; public static ConfigEntry<float> maxRange4; public static ConfigEntry<float> pointIntensity4; public static ConfigEntry<float> pointRange4; public static ConfigEntry<float> spotIntensity4; public static ConfigEntry<float> spotRange4; internal static CircletExtended instance; public static List<int> hotkeys = new List<int>(); public static HashSet<int> equipWithHelmetsList = new HashSet<int>(); public static string customDataKey = "shudnal.CircletExtended.DvergerLightState"; public static string allHelmetsString = "AllHelmets"; public static int allHelmetsHash = StringExtensionMethods.GetStableHashCode(allHelmetsString); private void Awake() { instance = this; ConfigInit(); configSync.AddLockingConfigEntry<bool>(configLocked); harmony.PatchAll(); Game.isModded = true; UpdateCustomEquipSlot(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); instance = null; Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } public static void LogInfo(object data) { if (loggingEnabled.Value) { ((BaseUnityPlugin)instance).Logger.LogInfo(data); } } public void ConfigInit() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_090c: 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_095a: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) config("General", "NexusID", 2617, "Nexus mod ID for updates", synchronizedSetting: false); configLocked = config("General", "Lock Configuration", defaultValue: true, "Configuration is locked and can be changed by server admins only."); loggingEnabled = config("General", "Logging enabled", defaultValue: false, "Enable logging. [Not Synced with Server]", synchronizedSetting: false); circletColor = config<Color>("Circlet", "Light color", new Color(1f, 0.9f, 0.75f, 1f), "Circlet beam light color. Changing this ingame will change current Circlet color [Not Synced with Server]", synchronizedSetting: false); disableOnSleep = config("Circlet", "Disable when sleeping", defaultValue: true, "Turn off the light when sleeping. [Not Synced with Server]", synchronizedSetting: false); enableShadows = config("Circlet", "Enables shadows toggle", defaultValue: true, "Enables option to toggle Circlet's light to emit shadows. Disable if it impacts your performance. [Not Synced with Server]", synchronizedSetting: false); getFeaturesByUpgrade = config("Circlet - Features", "Get features by circlet upgrade", defaultValue: true, "Get Circlet features by upgrading it. If False all features are available by default.\nIf True the order of upgrades are \"Default\" -> \"Put on top\" -> \"Overload\" -> \"Demister\""); overloadChargesPerLevel = config("Circlet - Features", "Overload charges", 20, "How many overload charges is available. It is the fraction of durability being damaged on Overload use. x2 if upgrades are disabled or quality is maximum."); enableOverload = config("Circlet - Features", "Enable overload", defaultValue: true, "Enables overload. Press hotkey to blind opponents with a bright flash at the cost of some Circlet durability"); enableDemister = config("Circlet - Features", "Enable demister", defaultValue: true, "Enables demister. Press hotkey to spawn a little wisp to push away the mists"); enablePutOnTop = config("Circlet - Features", "Enable put on top", defaultValue: true, "Enables equipping Circlet on top of other helmet. Equip Circlet without using a helmet slot."); enableSpotLight = config("Circlet - Features", "Enable spot light", defaultValue: true, "Enables toggleable omnidirectional dim light in a small radius around Circlet bearer. You may want to disable it if you use HipLantern mod."); overloadEmote = config("Circlet - Features", "Overload emote", "", "Play emote on overload use"); getFeaturesByUpgrade.SettingChanged += delegate { CircletItem.PatchCircletItemOnConfigChange(); }; getFeaturesByUpgrade.SettingChanged += delegate { CircletItem.FillRecipe(); }; enablePutOnTop.SettingChanged += delegate { CircletItem.PatchCircletItemOnConfigChange(); }; enableSpotLight.SettingChanged += delegate { DvergerLightController.UpdateSpotLights(); }; fuelMinutes = config("Circlet - Fuel", "Basic fuel capacity", 60, "Time in minutes required to consume all fuel. Set to 0 to not consume fuel."); fuelPerLevel = config("Circlet - Fuel", "Fuel per level", 20, "Time in minutes added per quality level"); fuelDrainMinIntensityFactor = config("Circlet - Fuel", "Fuel drain min intensity factor", 0.25f, new ConfigDescription("Factor of fuel drain when intensity is at minimum", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); fuelDrainMaxIntensityFactor = config("Circlet - Fuel", "Fuel drain max intensity factor", 3f, new ConfigDescription("Factor of fuel drain when intensity is at maximum", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>())); fuelMinutes.SettingChanged += delegate { CircletItem.PatchCircletItemOnConfigChange(); }; fuelPerLevel.SettingChanged += delegate { CircletItem.PatchCircletItemOnConfigChange(); }; enableOverloadDemister = config("Circlet - Overload demister", "Enable temporary demister on overload", defaultValue: true, "Push away mist on overload activation"); overloadDemisterRange = config("Circlet - Overload demister", "Range", 40f, "Maximum range"); overloadDemisterTime = config("Circlet - Overload demister", "Time", 10f, "Time to gradually decrease effect radius"); equipCircletUnderHelmet = config("Circlet - Put on top", "Equip under helmet", defaultValue: true, "If enabled - Circlet will be invisible if put on top of the helmet.\nIf disabled - Circlet will replace helmet"); equipCircletWithHelmet = config("Circlet - Put on top", "Show when helmet equipped", "HelmetTrollLeather", "Comma separated list. If you have \"Equip under helmet\" enabled and wear a helmet from that list the Circlet will be shown.\nAdd identifier \"" + allHelmetsString + "\" to show circlet with every helmet equiped. Use that to test how it looks with different helmets.\nThere is only Troll Leather Helmet of Vanilla helmets that looks good with Circlet."); equipCircletWithHelmet.SettingChanged += delegate { FillHelmets(); }; circletRecipeCraftingEnabled = config("Circlet - Crafting", "Crafting enabled", defaultValue: true, "Enabled recipe to craft circlet."); circletRecipeCraftingStation = config("Circlet - Crafting", "Crafting station", "$piece_forge", "Where to craft circet. Leave empty to disable crafting but set repair station."); circletRecipeRepairStation = config("Circlet - Crafting", "Repair station", "$piece_forge", "Additional station where circet can be repaired. Crafting station is always used as well if set."); circletRecipeCraftingStationLvl = config("Circlet - Crafting", "Crafting station lvl", 3, "Level of crafting station required"); circletRecipeRepairStationLvl = config("Circlet - Crafting", "Repair station lvl", 1, "Level of repair station required."); circletRecipeCraftingEnabled.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeCraftingStation.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeRepairStation.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeCraftingStationLvl.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeRepairStationLvl.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeQuality1 = config("Circlet - Recipe", "Create", "Bronze:10,Ruby:1,SilverNecklace:1,SurtlingCore:10", "Recipe to create circet"); circletRecipeQuality2 = config("Circlet - Recipe", "Upgrade quality 2", "Resin:20,LeatherScraps:10,IronNails:10,Chain:1", "Recipe to upgrade circet to quality 2"); circletRecipeQuality3 = config("Circlet - Recipe", "Upgrade quality 3", "Thunderstone:5,Silver:1,JuteRed:2", "Recipe to upgrade circet to quality 3"); circletRecipeQuality4 = config("Circlet - Recipe", "Upgrade quality 4", "Demister:1,BlackCore:1", "Recipe to upgrade circet to quality 4"); circletRecipeQuality1.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeQuality2.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeQuality3.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletRecipeQuality4.SettingChanged += delegate { CircletItem.FillRecipe(); }; circletHelmetWhiteList = config("Circlet - Restrictions", "Helmet white list", "", "List of helmets where hoop can ONLY be used with"); circletHelmetBlackList = config("Circlet - Restrictions", "Helmet black list", "", "List of helmets where hoop can NOT be used with"); circletHelmetWhiteList.SettingChanged += delegate { CircletItem.UpdateCompatibleHelmetLists(); }; circletHelmetBlackList.SettingChanged += delegate { CircletItem.UpdateCompatibleHelmetLists(); }; visualStateItemDrop = config("Circlet - Visual state", "Enable itemdrop state", defaultValue: true, "Circlet dropped on the ground will preserve light state"); visualStateItemStand = config("Circlet - Visual state", "Enable item stand state", defaultValue: true, "Circlet put on the item stand will preserve light state"); visualStateArmorStand = config("Circlet - Visual state", "Enable armor stand state", defaultValue: true, "Circlet put on the armor stand will preserve light state"); itemSlotType = config("Circlet - Custom slot", "Slot type", 55, "Custom item slot type. Change it only if you have issues with other mods compatibility. Game restart is recommended after change."); itemSlotType.SettingChanged += delegate { CircletItem.PatchCircletItemOnConfigChange(); }; itemSlotAzuEPI = config("Circlet - Custom slot", "AzuEPI - Create slot", defaultValue: false, "Create custom equipment slot with AzuExtendedPlayerInventory. Slot will be created/removed on config change."); itemSlotNameAzuEPI = config("Circlet - Custom slot", "AzuEPI - Slot name", "Circlet", "Custom equipment slot name. Game restart is required to apply changes."); itemSlotIndexAzuEPI = config("Circlet - Custom slot", "AzuEPI - Slot index", -1, "Slot index (position). Remove and add slot to apply changes."); itemSlotAzuEPI.SettingChanged += delegate { UpdateCustomEquipSlot(); }; itemSlotExtraSlots = config("Circlet - Custom slot", "ExtraSlots - Create slot", defaultValue: false, "Create custom equipment slot with ExtraSlots. Slot will be created/removed on config change."); itemSlotNameExtraSlots = config("Circlet - Custom slot", "ExtraSlots - Slot name", "Circlet", "Custom equipment slot name."); itemSlotIndexExtraSlots = config("Circlet - Custom slot", "ExtraSlots - Slot index", -1, "Slot index (position). Remove and add slot to apply changes."); itemSlotExtraSlotsDiscovery = config("Circlet - Custom slot", "ExtraSlots - Available after discovery", defaultValue: true, "If enabled - slot will be active only if you know circlet item."); itemSlotExtraSlots.SettingChanged += delegate { UpdateCustomEquipSlot(); ExtraSlotsAPI.API.UpdateSlots(); }; widenShortcut = config<KeyboardShortcut>("Hotkeys", "Beam widen", new KeyboardShortcut((KeyCode)275, Array.Empty<KeyCode>()), "Widen beam shortcut. [Not Synced with Server]", synchronizedSetting: false); narrowShortcut = config<KeyboardShortcut>("Hotkeys", "Beam narrow", new KeyboardShortcut((KeyCode)276, Array.Empty<KeyCode>()), "Narrow beam shortcut. [Not Synced with Server]", synchronizedSetting: false); overloadShortcut = config<KeyboardShortcut>("Hotkeys", "Overload", new KeyboardShortcut((KeyCode)116, Array.Empty<KeyCode>()), "Overload shortcut. Blind opponents with a bright flash at the cost of some circlet durability. [Not Synced with Server]", synchronizedSetting: false); toggleShortcut = config<KeyboardShortcut>("Hotkeys", "Toggle light", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), "Toggle main light shortcut. Enable/disable frontlight. [Not Synced with Server]", synchronizedSetting: false); toggleDemisterShortcut = config<KeyboardShortcut>("Hotkeys", "Toggle demister", new KeyboardShortcut((KeyCode)274, Array.Empty<KeyCode>()), "Toggle demister shortcut. Spawn/despawn demister wisplight. [Not Synced with Server]", synchronizedSetting: false); increaseIntensityShortcut = config<KeyboardShortcut>("Hotkeys - Extra", "Intensity increase", new KeyboardShortcut((KeyCode)273, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Increase intensity shortcut. Light becomes brighter and have more range. Intensity is capped at 150% [Not Synced with Server]", synchronizedSetting: false); decreaseIntensityShortcut = config<KeyboardShortcut>("Hotkeys - Extra", "Intensity decrease", new KeyboardShortcut((KeyCode)274, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Decrease intensity shortcut. Light becomes darker and have less range. Intensity is capped at 50% [Not Synced with Server]", synchronizedSetting: false); toggleShadowsShortcut = config<KeyboardShortcut>("Hotkeys - Extra", "Toggle shadows", new KeyboardShortcut((KeyCode)276, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Toggle shadows shortcut. Enables/disables the current light source to emit soft shadows. [Not Synced with Server]", synchronizedSetting: false); toggleSpotShortcut = config<KeyboardShortcut>("Hotkeys - Extra", "Toggle radiance", new KeyboardShortcut((KeyCode)275, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Toggle spotlight shortcut. Enables/disables the radiance when circlet is equipped. [Not Synced with Server]", synchronizedSetting: false); toggleSpotWithFront = config("Hotkeys - Extra", "Toggle radiance with main light", defaultValue: false, "Toggle spotlight with main light. [Not Synced with Server]", synchronizedSetting: false); widenShortcut.SettingChanged += delegate { FillShortcuts(); }; narrowShortcut.SettingChanged += delegate { FillShortcuts(); }; overloadShortcut.SettingChanged += delegate { FillShortcuts(); }; toggleShortcut.SettingChanged += delegate { FillShortcuts(); }; toggleDemisterShortcut.SettingChanged += delegate { FillShortcuts(); }; increaseIntensityShortcut.SettingChanged += delegate { FillShortcuts(); }; decreaseIntensityShortcut.SettingChanged += delegate { FillShortcuts(); }; toggleShadowsShortcut.SettingChanged += delegate { FillShortcuts(); }; toggleSpotShortcut.SettingChanged += delegate { FillShortcuts(); }; maxSteps = config("Light - Default", "Max Steps", 3, "Define how many steps of focus the Dverger light beam has. Must be at least 2."); minAngle = config("Light - Default", "Min Angle", 30f, "The angle of the beam at the narrowest setting."); maxAngle = config("Light - Default", "Max Angle", 110f, "The angle of the beam at the widest setting."); minIntensity = config("Light - Default", "Min Intensity", 1.4f, "The intensity of the beam at the widest setting."); maxIntensity = config("Light - Default", "Max Intensity", 2.2f, "The intensity of the beam at the narrowest setting"); minRange = config("Light - Default", "Min Range", 45f, "The range of the beam at the narrowest setting."); maxRange = config("Light - Default", "Max Range", 15f, "The range of the beam at the widest setting"); pointIntensity = config("Light - Default", "Point Intensity", 1.1f, "The intensity of the Dverger light pool on the point light setting."); pointRange = config("Light - Default", "Point Range", 10f, "The range of the Dverger light pool on the point light setting."); spotIntensity = config("Light - Default", "Spot Intensity", 1f, "The intensity of the Dverger spot light."); spotRange = config("Light - Default", "Spot Range", 10f, "The range of the Dverger spot light pool."); maxSteps2 = config("Light - Quality 2", "Max Steps", 3, "Define how many steps of focus the Dverger light beam has. Must be at least 2."); minAngle2 = config("Light - Quality 2", "Min Angle", 30f, "The angle of the beam at the narrowest setting."); maxAngle2 = config("Light - Quality 2", "Max Angle", 110f, "The angle of the beam at the widest setting."); minIntensity2 = config("Light - Quality 2", "Min Intensity", 1.4f, "The intensity of the beam at the widest setting."); maxIntensity2 = config("Light - Quality 2", "Max Intensity", 2.2f, "The intensity of the beam at the narrowest setting"); minRange2 = config("Light - Quality 2", "Min Range", 45f, "The range of the beam at the narrowest setting."); maxRange2 = config("Light - Quality 2", "Max Range", 15f, "The range of the beam at the widest setting"); pointIntensity2 = config("Light - Quality 2", "Point Intensity", 1.1f, "The intensity of the Dverger light pool on the point light setting."); pointRange2 = config("Light - Quality 2", "Point Range", 10f, "The range of the Dverger light pool on the point light setting."); spotIntensity2 = config("Light - Quality 2", "Spot Intensity", 1f, "The intensity of the Dverger spot light."); spotRange2 = config("Light - Quality 2", "Spot Range", 10f, "The range of the Dverger spot light pool."); maxSteps3 = config("Light - Quality 3", "Max Steps", 3, "Define how many steps of focus the Dverger light beam has. Must be at least 2."); minAngle3 = config("Light - Quality 3", "Min Angle", 30f, "The angle of the beam at the narrowest setting."); maxAngle3 = config("Light - Quality 3", "Max Angle", 110f, "The angle of the beam at the widest setting."); minIntensity3 = config("Light - Quality 3", "Min Intensity", 1.4f, "The intensity of the beam at the widest setting."); maxIntensity3 = config("Light - Quality 3", "Max Intensity", 2.2f, "The intensity of the beam at the narrowest setting"); minRange3 = config("Light - Quality 3", "Min Range", 45f, "The range of the beam at the narrowest setting."); maxRange3 = config("Light - Quality 3", "Max Range", 15f, "The range of the beam at the widest setting"); pointIntensity3 = config("Light - Quality 3", "Point Intensity", 1.1f, "The intensity of the Dverger light pool on the point light setting."); pointRange3 = config("Light - Quality 3", "Point Range", 10f, "The range of the Dverger light pool on the point light setting."); spotIntensity3 = config("Light - Quality 3", "Spot Intensity", 1f, "The intensity of the Dverger spot light."); spotRange3 = config("Light - Quality 3", "Spot Range", 10f, "The range of the Dverger spot light pool."); maxSteps4 = config("Light - Quality 4", "Max Steps", 3, "Define how many steps of focus the Dverger light beam has. Must be at least 2."); minAngle4 = config("Light - Quality 4", "Min Angle", 30f, "The angle of the beam at the narrowest setting."); maxAngle4 = config("Light - Quality 4", "Max Angle", 110f, "The angle of the beam at the widest setting."); minIntensity4 = config("Light - Quality 4", "Min Intensity", 1.4f, "The intensity of the beam at the widest setting."); maxIntensity4 = config("Light - Quality 4", "Max Intensity", 2.2f, "The intensity of the beam at the narrowest setting"); minRange4 = config("Light - Quality 4", "Min Range", 45f, "The range of the beam at the narrowest setting."); maxRange4 = config("Light - Quality 4", "Max Range", 15f, "The range of the beam at the widest setting"); pointIntensity4 = config("Light - Quality 4", "Point Intensity", 1.1f, "The intensity of the Dverger light pool on the point light setting."); pointRange4 = config("Light - Quality 4", "Point Range", 10f, "The range of the Dverger light pool on the point light setting."); spotIntensity4 = config("Light - Quality 4", "Spot Intensity", 1f, "The intensity of the Dverger spot light."); spotRange4 = config("Light - Quality 4", "Spot Range", 10f, "The range of the Dverger spot light pool."); CollectionExtensions.Do<ConfigEntry<float>>(from cfg in (IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)((BaseUnityPlugin)instance).Config where cfg.Key.Section.StartsWith("Light - ") && cfg.Value is ConfigEntry<float> select cfg.Value as ConfigEntry<float>, (Action<ConfigEntry<float>>)delegate(ConfigEntry<float> cfg) { cfg.SettingChanged += delegate { DvergerLightController.UpdateQualityLevels(); }; }); FillShortcuts(); FillHelmets(); } public static void UpdateCustomEquipSlot() { if (AzuExtendedPlayerInventory.API.IsLoaded()) { bool flag = AzuExtendedPlayerInventory.API.GetSlots().SlotNames.Any((string slotName) => slotName == itemSlotNameAzuEPI.Value); if (flag && !itemSlotAzuEPI.Value) { AzuExtendedPlayerInventory.API.RemoveSlot(itemSlotNameAzuEPI.Value); } else if (!flag && itemSlotAzuEPI.Value) { AzuExtendedPlayerInventory.API.AddSlot(itemSlotNameAzuEPI.Value, [<d4b0f3c0-4f2f-4c00-812f-371085695aa1>NullableContext(1)] [return: <654741cb-9849-494a-9b2f-e275df8fe3ac>Nullable(2)] (Player player) => ((Humanoid)(object)player).GetCirclet(), [<d4b0f3c0-4f2f-4c00-812f-371085695aa1>NullableContext(1)] (ItemData item) => CircletItem.IsCircletItem(item), itemSlotIndexAzuEPI.Value); } } else { if (!ExtraSlotsAPI.API.IsReady()) { return; } bool flag2 = ExtraSlotsAPI.API.FindSlot("CircletExtended") != null; if (!flag2 && itemSlotExtraSlots.Value) { if (itemSlotIndexExtraSlots.Value < 0) { ExtraSlotsAPI.API.AddSlotBefore("CircletExtended", () => itemSlotNameExtraSlots.Value, (ItemData item) => CircletItem.IsCircletItem(item), () => CircletItem.IsCircletSlotAvailable(), "HipLantern"); } else { ExtraSlotsAPI.API.AddSlotWithIndex("CircletExtended", itemSlotIndexExtraSlots.Value, () => itemSlotNameExtraSlots.Value, (ItemData item) => CircletItem.IsCircletItem(item), () => CircletItem.IsCircletSlotAvailable()); } } else if (flag2 && !itemSlotExtraSlots.Value) { ExtraSlotsAPI.API.RemoveSlot("CircletExtended"); } } } private void FillShortcuts() { Dictionary<int, int> dictionary = new Dictionary<int, int>(); AddShortcut(dictionary, widenShortcut); AddShortcut(dictionary, narrowShortcut); AddShortcut(dictionary, toggleShortcut); AddShortcut(dictionary, toggleSpotShortcut); AddShortcut(dictionary, increaseIntensityShortcut); AddShortcut(dictionary, decreaseIntensityShortcut); AddShortcut(dictionary, toggleShadowsShortcut); AddShortcut(dictionary, overloadShortcut); AddShortcut(dictionary, toggleDemisterShortcut); hotkeys = (from x in dictionary orderby x.Value descending select x.Key).Distinct().ToList(); } private void FillHelmets() { equipWithHelmetsList = new HashSet<int>(from c in equipCircletWithHelmet.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select StringExtensionMethods.GetStableHashCode(c.Trim())); } private void AddShortcut(Dictionary<int, int> shortcuts, ConfigEntry<KeyboardShortcut> shortcut) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) int hashCode = ((object)((ConfigEntryBase)shortcut).Definition).GetHashCode(); KeyboardShortcut value = shortcut.Value; shortcuts.Add(hashCode, ((KeyboardShortcut)(ref value)).Modifiers.Count()); } private ConfigEntry<T> config<T>(string group, string name, T defaultValue, ConfigDescription description, bool synchronizedSetting = true) { ConfigEntry<T> val = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, defaultValue, description); SyncedConfigEntry<T> syncedConfigEntry = configSync.AddConfigEntry<T>(val); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val; } private ConfigEntry<T> config<T>(string group, string name, T defaultValue, string description, bool synchronizedSetting = true) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return config(group, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } public static int GetMaxSteps(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => maxSteps.Value, 2 => maxSteps2.Value, 3 => maxSteps3.Value, 4 => maxSteps4.Value, _ => maxSteps.Value, }; } public static float GetMinAngle(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => minAngle.Value, 2 => minAngle2.Value, 3 => minAngle3.Value, 4 => minAngle4.Value, _ => minAngle.Value, }; } public static float GetMaxAngle(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => maxAngle.Value, 2 => maxAngle2.Value, 3 => maxAngle3.Value, 4 => maxAngle4.Value, _ => maxAngle.Value, }; } public static float GetMinIntensity(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => minIntensity.Value, 2 => minIntensity2.Value, 3 => minIntensity3.Value, 4 => minIntensity4.Value, _ => minIntensity.Value, }; } public static float GetMaxIntensity(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => maxIntensity.Value, 2 => maxIntensity2.Value, 3 => maxIntensity3.Value, 4 => maxIntensity4.Value, _ => maxIntensity.Value, }; } public static float GetMinRange(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => minRange.Value, 2 => minRange2.Value, 3 => minRange3.Value, 4 => minRange4.Value, _ => minRange.Value, }; } public static float GetMaxRange(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => maxRange.Value, 2 => maxRange2.Value, 3 => maxRange3.Value, 4 => maxRange4.Value, _ => maxRange.Value, }; } public static float GetPointIntensity(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => pointIntensity.Value, 2 => pointIntensity2.Value, 3 => pointIntensity3.Value, 4 => pointIntensity4.Value, _ => pointIntensity.Value, }; } public static float GetPointRange(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => pointRange.Value, 2 => pointRange2.Value, 3 => pointRange3.Value, 4 => pointRange4.Value, _ => pointRange.Value, }; } public static float GetSpotIntensity(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => spotIntensity.Value, 2 => spotIntensity2.Value, 3 => spotIntensity3.Value, 4 => spotIntensity4.Value, _ => spotIntensity.Value, }; } public static float GetSpotRange(int quality) { return ((!getFeaturesByUpgrade.Value) ? 1 : Mathf.Clamp(quality, 1, 4)) switch { 1 => spotRange.Value, 2 => spotRange2.Value, 3 => spotRange3.Value, 4 => spotRange4.Value, _ => spotRange.Value, }; } } public static class CircletItem { [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class ObjectDB_Awake_CircletStats { private static void Postfix() { DvergerLightController.RegisterEffects(); FillRecipe(); UpdateCompatibleHelmetLists(); } } [HarmonyPatch(typeof(Player), "AddKnownItem")] public static class Player_AddKnownItem_CircletRecipeAvailableAfterAcquiring { private static void Prefix(Player __instance, ItemData item, ref bool __state) { if (!IsCircletItemData(item)) { return; } if (__instance.IsKnownMaterial("$item_helmet_dverger")) { if (!__instance.IsRecipeKnown("$item_helmet_dverger")) { Recipe val = ((IEnumerable<Recipe>)ObjectDB.instance.m_recipes).FirstOrDefault((Func<Recipe, bool>)((Recipe x) => IsCircletItemName(((Object)x).name))); if (val != null) { __instance.AddKnownRecipe(val); } } } else { __state = true; } } private static void Postfix(Player __instance, ItemData item, bool __state) { if (__state) { Recipe val = ((IEnumerable<Recipe>)ObjectDB.instance.m_recipes).FirstOrDefault((Func<Recipe, bool>)((Recipe x) => IsCircletItemName(((Object)x).name))); if (val != null) { __instance.AddKnownRecipe(val); } } if (CircletExtended.enablePutOnTop.Value && IsCircletItemData(item) && (item.m_quality > 1 || !CircletExtended.getFeaturesByUpgrade.Value) && __instance.IsKnownMaterial("$item_helmet_dverger") && !__instance.IsKnownMaterial("$item_helmet_dverger_quality_lvl_2")) { __instance.m_knownMaterial.Add("$item_helmet_dverger_quality_lvl_2"); } } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class Player_OnSpawned_CircletStats { public static void Postfix(Player __instance) { if (CircletExtended.getFeaturesByUpgrade.Value && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { PatchInventory(((Humanoid)__instance).GetInventory()); } } } [HarmonyPatch(typeof(Inventory), "Load")] public static class Inventory_Load_CircletStats { public static void Postfix(Inventory __instance) { PatchInventory(__instance); } } [HarmonyPatch(typeof(ItemDrop), "Start")] public static class ItemDrop_Start_CircletStats { private static void Postfix(ItemDrop __instance) { if (CircletExtended.getFeaturesByUpgrade.Value && IsCircletItem(__instance)) { PatchCircletItemData(__instance.m_itemData); } } } [HarmonyPatch(typeof(Requirement), "GetAmount")] public static class PieceRequirement_GetAmount_CircletUpgrade { public static void Postfix(Requirement __instance, int qualityLevel, ref int __result) { if (CircletExtended.getFeaturesByUpgrade.Value && IsCircletItem(__instance.m_resItem)) { __result = ((qualityLevel <= 1) ? 1 : 0); } } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class InventoryGui_DoCrafting_CircletUpgrade { private static bool PatchMethod(ItemData ___m_craftUpgradeItem, Recipe ___m_craftRecipe) { if (!CircletExtended.getFeaturesByUpgrade.Value) { return false; } if ((Object)(object)___m_craftRecipe == (Object)null || ___m_craftUpgradeItem == null) { return false; } if (!IsCircletItemData(___m_craftUpgradeItem)) { return false; } return true; } [HarmonyPriority(800)] public static void Prefix(Player player, ref Recipe ___m_craftRecipe, ref KeyValuePair<bool, Requirement[]> __state, ItemData ___m_craftUpgradeItem) { if (PatchMethod(___m_craftUpgradeItem, ___m_craftRecipe)) { int key = ___m_craftUpgradeItem.m_quality + 1; __state = new KeyValuePair<bool, Requirement[]>(player.m_noPlacementCost, ___m_craftRecipe.m_resources.ToArray()); ___m_craftRecipe.m_resources = recipeRequirements[key].ToArray(); player.m_noPlacementCost = true; } } [HarmonyPriority(0)] public static void Postfix(Player player, ref Recipe ___m_craftRecipe, KeyValuePair<bool, Requirement[]> __state, ItemData ___m_craftUpgradeItem) { if (PatchMethod(___m_craftUpgradeItem, ___m_craftRecipe)) { player.m_noPlacementCost = __state.Key; if (!player.m_noPlacementCost) { player.ConsumeResources(___m_craftRecipe.m_resources, 1, -1, 1); } ___m_craftRecipe.m_resources = __state.Value.ToArray(); PatchCircletItemData(___m_craftUpgradeItem, inventoryItemUpdate: false); } } } [HarmonyPatch(typeof(InventoryGui), "SetupRequirementList")] public static class InventoryGui_SetupRequirementList_CircletUpgrade { private static bool PatchMethod(KeyValuePair<Recipe, ItemData> ___m_selectedRecipe) { if (!CircletExtended.getFeaturesByUpgrade.Value) { return false; } return IsCircletItem(___m_selectedRecipe.Key.m_item); } [HarmonyPriority(800)] public static void Prefix(ref int quality, ref KeyValuePair<Recipe, ItemData> ___m_selectedRecipe, ref KeyValuePair<int, Requirement[]> __state) { if (PatchMethod(___m_selectedRecipe)) { __state = new KeyValuePair<int, Requirement[]>(quality, ___m_selectedRecipe.Key.m_resources.ToArray()); ___m_selectedRecipe.Key.m_resources = recipeRequirements[quality].ToArray(); quality = 1; } } [HarmonyPriority(0)] public static void Postfix(ref int quality, ref KeyValuePair<Recipe, ItemData> ___m_selectedRecipe, KeyValuePair<int, Requirement[]> __state) { if (PatchMethod(___m_selectedRecipe)) { ___m_selectedRecipe.Key.m_resources = __state.Value.ToArray(); quality = __state.Key; } } } [HarmonyPatch(typeof(Player), "HaveRequirementItems")] public static class Player_HaveRequirementItems_CircletUpgrade { private static bool PatchMethod(bool discover, Recipe piece) { if (!CircletExtended.getFeaturesByUpgrade.Value) { return false; } if (discover) { return false; } return IsCircletItem(piece.m_item); } [HarmonyPriority(800)] public static void Prefix(ref Recipe piece, bool discover, ref int qualityLevel, ref KeyValuePair<int, Requirement[]> __state) { if (PatchMethod(discover, piece)) { __state = new KeyValuePair<int, Requirement[]>(qualityLevel, piece.m_resources.ToArray()); piece.m_resources = recipeRequirements[qualityLevel].ToArray(); qualityLevel = 1; } } [HarmonyPriority(0)] public static void Postfix(ref Recipe piece, bool discover, ref int qualityLevel, KeyValuePair<int, Requirement[]> __state) { if (PatchMethod(discover, piece)) { piece.m_resources = __state.Value.ToArray(); qualityLevel = __state.Key; } } } [HarmonyPatch(typeof(Humanoid), "UpdateEquipment")] public static class Humanoid_UpdateEquipment_CircletEquipmentDrain { public static void Postfix(Humanoid __instance, float dt) { if (((Character)__instance).IsPlayer()) { ItemData circlet = __instance.GetCirclet(); if (circlet != null && circlet != __instance.m_helmetItem) { __instance.DrainEquipedItemDurability(circlet, dt * DvergerLightController.GetCircletDrainMultiplier(circlet)); } } } } [HarmonyPatch(typeof(Humanoid), "DrainEquipedItemDurability")] public static class Humanoid_DrainEquipedItemDurability_CircletEquipmentDrain { [HarmonyPriority(800)] public static void Prefix(Humanoid __instance, ItemData item, ref float dt, ref float __state) { if (IsCircletItemData(item) && (!UseFuel() || !item.IsCircletLightEnabled() || !((Character)__instance).IsPlayer() || !((Object)(object)((Player)((__instance is Player) ? __instance : null)).GetCurrentCraftingStation() == (Object)null))) { __state = dt; dt = 0f; } } [HarmonyPriority(800)] public static void Postfix(Humanoid __instance, ItemData item, ref float dt, float __state) { if (__state != 0f) { dt = __state; } } } [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int) })] private static class ItemDropItemData_GetTooltip_ItemTooltip { [HarmonyPriority(0)] private static void Postfix(ItemData item, ref string __result) { if (IsCircletItemData(item) && UseFuel()) { __result = __result.Replace("$item_durability", "$piece_fire_fuel"); } } } [HarmonyPatch(typeof(Inventory), "GetWornItems")] public static class Inventory_GetWornItems_CircletAlwaysLastToRepair { public static void Postfix(Inventory __instance, List<ItemData> worn) { if (worn.Count <= 0) { return; } Player localPlayer = Player.m_localPlayer; if (__instance != ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null) || !UseFuel()) { return; } for (int num = worn.Count - 1; num >= 0; num--) { ItemData val = worn[num]; if (val != null && IsCircletItemData(val) && val.m_equipped && ((Humanoid)Player.m_localPlayer).IsItemEquiped(val)) { worn.Add(val); worn.RemoveAt(num); } } } } [HarmonyPatch(typeof(Recipe), "GetRequiredStationLevel")] public static class Recipe_GetRequiredStationLevel_CraftingStationLevel { private static void Prefix(Recipe __instance, ref int __state) { __state = -1; if (!((Object)(object)__instance != (Object)(object)recipe)) { __state = __instance.m_minStationLevel; __instance.m_minStationLevel = CircletExtended.circletRecipeCraftingStationLvl.Value; } } private static void Postfix(Recipe __instance, int __state) { if (__state != -1) { __instance.m_minStationLevel = __state; } } } [HarmonyPatch(typeof(Inventory), "Changed")] public static class Inventory_Changed_PatchCirclets { private static void Prefix(Inventory __instance) { PatchInventory(__instance); } } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(ItemData), typeof(int), typeof(int), typeof(int) })] private static class Inventory_AddItem_ItemData_amount_x_y_PatchCircletItemDataOnLoad { [HarmonyPriority(800)] [HarmonyBefore(new string[] { "shudnal.ExtraSlots" })] private static void Prefix(ItemData item) { if (CircletExtended.getFeaturesByUpgrade.Value && IsCircletItemData(item)) { PatchCircletItemData(item); } } } [HarmonyPatch(typeof(Player), "GetAvailableRecipes")] public static class Player_GetAvailableRecipes_RemoveUncraftableRecipe { [HarmonyPriority(800)] private static void Postfix(Player __instance, ref List<Recipe> available) { if (!CircletExtended.circletRecipeCraftingEnabled.Value) { available.RemoveAll((Recipe rec) => (Object)(object)rec == (Object)(object)recipe); } } } public const string itemNameHelmetDverger = "HelmetDverger"; public const string itemDropNameHelmetDverger = "$item_helmet_dverger"; public const string itemDropNameHelmetDvergerLvl2 = "$item_helmet_dverger_quality_lvl_2"; public static int itemHashHelmetDverger = StringExtensionMethods.GetStableHashCode("HelmetDverger"); public static GameObject circletPrefab; public static List<string> helmetWhiteList = new List<string>(); public static List<string> helmetBlackList = new List<string>(); public static bool helmetListFilled = false; public const int maxQuality = 4; public static Recipe recipe; public static Dictionary<int, Requirement[]> recipeRequirements = new Dictionary<int, Requirement[]>(); public static void UpdateCompatibleHelmetLists() { helmetWhiteList.Clear(); CollectionExtensions.Do<string>(from p in CircletExtended.circletHelmetWhiteList.Value.Split(',') select p.Trim().ToLower() into p where !string.IsNullOrWhiteSpace(p) select p, (Action<string>)helmetWhiteList.Add); helmetBlackList.Clear(); CollectionExtensions.Do<string>(from p in CircletExtended.circletHelmetBlackList.Value.Split(',') select p.Trim().ToLower() into p where !string.IsNullOrWhiteSpace(p) select p, (Action<string>)helmetBlackList.Add); helmetListFilled = helmetWhiteList.Count + helmetBlackList.Count > 0; } internal static bool CanCircletBeEquippedWithHelmet(ItemData helmet) { if (helmet == null) { return true; } if (!helmetListFilled) { return true; } if (helmetWhiteList.Contains(helmet.m_shared.m_name.ToLower())) { return true; } List<string> list = helmetWhiteList; GameObject dropPrefab = helmet.m_dropPrefab; if (list.Contains((dropPrefab != null) ? ((Object)dropPrefab).name.ToLower() : null)) { return true; } if (helmetWhiteList.Count > 0) { return false; } if (helmetBlackList.Contains(helmet.m_shared.m_name.ToLower())) { return false; } List<string> list2 = helmetBlackList; GameObject dropPrefab2 = helmet.m_dropPrefab; if (list2.Contains((dropPrefab2 != null) ? ((Object)dropPrefab2).name.ToLower() : null)) { return false; } return true; } internal static ItemType GetItemType() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return (ItemType)CircletExtended.itemSlotType.Value; } internal static bool IsCircletType(ItemData item) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return item != null && item.m_shared.m_itemType == GetItemType(); } internal static bool IsCircletItem(ItemDrop item) { return (Object)(object)item != (Object)null && (IsCircletItemName(item.GetPrefabName(((Object)item).name)) || IsCircletItemData(item.m_itemData)); } internal static bool IsCircletItemData(ItemData item) { return item != null && (((Object)(object)item.m_dropPrefab != (Object)null && IsCircletItemName(((Object)item.m_dropPrefab).name)) || IsCircletItemDropName(item.m_shared.m_name)); } internal static bool IsCircletItem(ItemData item) { return IsCircletItemData(item) && IsCircletType(item); } internal static bool IsCircletItemDropName(string name) { return name == "$item_helmet_dverger"; } internal static bool IsCircletItemName(string name) { return name == "HelmetDverger"; } public static bool IsCircletSlotKnown() { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || Player.m_localPlayer.m_isLoading) { return true; } return Player.m_localPlayer.IsKnownMaterial("$item_helmet_dverger") && (!CircletExtended.getFeaturesByUpgrade.Value || Player.m_localPlayer.IsKnownMaterial("$item_helmet_dverger_quality_lvl_2")); } public static bool IsCircletSlotAvailable() { return CircletExtended.itemSlotExtraSlots.Value && (!CircletExtended.itemSlotExtraSlotsDiscovery.Value || IsCircletSlotKnown()); } internal static void PatchCircletItemData(ItemData item, bool inventoryItemUpdate = true) { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (item != null) { item.m_shared.m_maxQuality = ((!CircletExtended.getFeaturesByUpgrade.Value) ? 1 : 4); item.m_shared.m_durabilityPerLevel = (CircletExtended.getFeaturesByUpgrade.Value ? CircletExtended.fuelPerLevel.Value : 100); item.m_shared.m_useDurability = UseFuel() || item.GetDurabilityPercentage() != 1f || item.m_quality >= 3; item.m_shared.m_maxDurability = (UseFuel() ? CircletExtended.fuelMinutes.Value : 1000); item.m_shared.m_useDurabilityDrain = (UseFuel() ? 1f : 0f); item.m_shared.m_durabilityDrain = (UseFuel() ? (Time.fixedDeltaTime * (5f / 6f)) : 0f); item.m_shared.m_destroyBroken = false; item.m_shared.m_canBeReparied = true; if (!inventoryItemUpdate || item.m_durability > item.GetMaxDurability()) { item.m_durability = item.GetMaxDurability(); } if (CircletExtended.enablePutOnTop.Value && ((CircletExtended.getFeaturesByUpgrade.Value && item.m_quality >= 2) || !CircletExtended.getFeaturesByUpgrade.Value)) { item.m_shared.m_itemType = GetItemType(); item.m_shared.m_attachOverride = (ItemType)6; } } } internal static void PatchInventory(Inventory inventory) { if (inventory == null) { return; } List<ItemData> list = new List<ItemData>(); inventory.GetAllItems("$item_helmet_dverger", list); foreach (ItemData item in list) { PatchCircletItemData(item); } } internal static void PatchCircletItemOnConfigChange() { GameObject obj = circletPrefab; PatchCircletItemData((obj == null) ? null : obj.GetComponent<ItemDrop>()?.m_itemData, inventoryItemUpdate: false); Player localPlayer = Player.m_localPlayer; PatchInventory((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null); } internal static bool UseFuel() { return CircletExtended.fuelMinutes.Value > 0; } public static bool IsCircletLightEnabled(this ItemData item) { return DvergerLightController.IsCircletLightEnabled(item); } internal static void FillRecipe() { if (!Object.op_Implicit((Object)(object)ObjectDB.instance)) { return; } if (ObjectDB.instance.m_recipes.RemoveAll(delegate(Recipe x) { int result; if (x != null) { result = (IsCircletItemName(((Object)x).name) ? 1 : 0); } else { result = 0; } return (byte)result != 0; }) > 0) { CircletExtended.LogInfo("Recipe removed HelmetDverger"); } circletPrefab = ObjectDB.instance.GetItemPrefab(itemHashHelmetDverger); if (!((Object)(object)circletPrefab == (Object)null)) { ItemDrop component = circletPrefab.GetComponent<ItemDrop>(); PatchCircletItemData(component.m_itemData, inventoryItemUpdate: false); if ((Object)(object)recipe != (Object)null) { Object.Destroy((Object)(object)recipe); } FillRecipeRequirements(); CraftingStation val = ((IEnumerable<Recipe>)ObjectDB.instance.m_recipes).FirstOrDefault((Func<Recipe, bool>)((Recipe rec) => rec.m_craftingStation?.m_name == "$piece_forge"))?.m_craftingStation; CraftingStation val2 = ((IEnumerable<Recipe>)ObjectDB.instance.m_recipes).FirstOrDefault((Func<Recipe, bool>)((Recipe rec) => rec.m_craftingStation?.m_name == CircletExtended.circletRecipeCraftingStation.Value))?.m_craftingStation; CraftingStation val3 = ((IEnumerable<Recipe>)ObjectDB.instance.m_recipes).FirstOrDefault((Func<Recipe, bool>)((Recipe rec) => rec.m_craftingStation?.m_name == CircletExtended.circletRecipeRepairStation.Value))?.m_craftingStation; recipe = ScriptableObject.CreateInstance<Recipe>(); ((Object)recipe).name = "HelmetDverger"; recipe.m_amount = 1; recipe.m_minStationLevel = Math.Min(CircletExtended.circletRecipeCraftingStationLvl.Value, CircletExtended.circletRecipeRepairStationLvl.Value); recipe.m_item = component; recipe.m_enabled = true; recipe.m_craftingStation = val2 ?? val; recipe.m_repairStation = val3 ?? null; recipe.m_resources = recipeRequirements[1]; ObjectDB.instance.m_recipes.Add(recipe); CircletExtended.LogInfo("Recipe added HelmetDverger"); } } private static void FillRecipeRequirements() { recipeRequirements.Clear(); for (int i = 0; i <= 5; i++) { recipeRequirements.Add(i, GetRequirements(i)); } } private static string GetRecipe(int quality) { if (1 == 0) { } string result = quality switch { 1 => CircletExtended.circletRecipeQuality1.Value, 2 => CircletExtended.circletRecipeQuality2.Value, 3 => CircletExtended.circletRecipeQuality3.Value, 4 => CircletExtended.circletRecipeQuality4.Value, _ => "", }; if (1 == 0) { } return result; } private static Requirement[] GetRequirements(int quality) { //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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown List<Requirement> list = new List<Requirement>(); string[] array = GetRecipe(quality).Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (array2.Length != 2) { continue; } int num = int.Parse(array2[1]); if (num > 0) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(array2[0].Trim()); if (!((Object)(object)itemPrefab == (Object)null)) { list.Add(new Requirement { m_amount = num, m_resItem = itemPrefab.GetComponent<ItemDrop>() }); } } } return list.ToArray(); } } public class DvergerLightController : MonoBehaviour { [Serializable] private class LightState { public bool on = true; public int level = 2; public int intensity = 100; public Color color = new Color(0.25f, 0.38f, 0.37f); public bool shadows = true; public bool spot = false; public bool overloaded = false; public float overload = 1f; public bool demister = false; public int quality = 1; public bool demisted = false; public float demistedrange = 1f; public bool forceoff = false; [NonSerialized] public int hash = 0; [NonSerialized] public string json = ""; public void UpdateHash() { json = JsonUtility.ToJson((object)this); hash = StringExtensionMethods.GetStableHashCode(json); } } [CompilerGenerated] private sealed class <OverloadDemister>d__61 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public DvergerLightController <>4__this; private int <i>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OverloadDemister>d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.m_state.demisted = true; <>4__this.SaveState(); <i>5__1 = 0; break; case 1: <>1__state = -1; <i>5__1++; break; } if ((float)<i>5__1 < CircletExtended.overloadDemisterTime.Value) { <>4__this.m_state.demistedrange = 10f + (CircletExtended.overloadDemisterRange.Value - 10f) * (1f - (float)<i>5__1 / CircletExtended.overloadDemisterTime.Value); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <>4__this.m_state.demisted = false; <>4__this.SaveState(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OverloadIntensity>d__60 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public DvergerLightController <>4__this; private float <increment>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OverloadIntensity>d__60(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.m_state.overloaded = true; <>4__this.m_state.overload = 4f; <increment>5__1 = 1.75f * Time.fixedDeltaTime; goto IL_00d1; case 1: <>1__state = -1; goto IL_00d1; case 2: <>1__state = -1; goto IL_015a; case 3: <>1__state = -1; goto IL_015a; case 4: <>1__state = -1; break; case 5: { <>1__state = -1; break; } IL_015a: if (<>4__this.m_state.overload <= 1.05f) { <>4__this.m_state.overload += <increment>5__1; <>4__this.SaveState(); <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 3; return true; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 4; return true; IL_00d1: if (<>4__this.m_state.overload > 0.5f) { <>4__this.m_state.overload -= <increment>5__1; <>4__this.SaveState(); <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; } if (<>4__this.m_state.overload >= 1f) { <>4__this.m_state.overload -= <increment>5__1; <>4__this.SaveState(); <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 5; return true; } <>4__this.m_state.overload = 1f; <>4__this.m_state.overloaded = false; <>4__this.SaveState(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ZNetView m_nview; private Light m_frontLight; private Light m_spotLight; private Player m_playerAttached; private ItemData m_item; private int m_zdoIndex; private GameObject m_visual; private LightState m_state = new LightState(); private ParticleSystemForceField m_overloadDemister; private int m_maxLevel = 3; private float m_minAngle = 30f; private float m_maxAngle = 110f; private float m_minIntensity = 1.4f; private float m_maxIntensity = 2.2f; private float m_minRange = 45f; private float m_maxRange = 15f; private float m_pointIntensity = 1.1f; private float m_pointRange = 10f; private float m_spotIntensity = 0.8f; private float m_spotRange = 8f; private int m_overloadCharges = 20; private MeshRenderer m_gemRenderer; private Color m_gemColor; private const int intensityIncrement = 10; private const int intensityFactorMax = 150; private const int intensityFactorMin = 50; private const float overloadIntensityInterval = 2f; private const float overloadIntensityMin = 0.5f; private const float overloadIntensityMax = 4f; private static int s_rayMaskSolids = 0; private static int s_rayMaskCharacters = 0; private static readonly MaterialPropertyBlock s_matBlock = new MaterialPropertyBlock(); public static GameObject overloadEffect; public const string overloadItemName = "circletExtendedOverload"; public static int overloadItemHash = StringExtensionMethods.GetStableHashCode("circletExtendedOverload"); public static Color overloadColor; public static int demisterEffectHash = StringExtensionMethods.GetStableHashCode("Demister"); public static GameObject demisterForceField; public const string forceFieldDemisterName = "Particle System Force Field"; public static int s_lightMaskNonPlayer; private float m_updateVisualTimer = 0f; private static readonly List<DvergerLightController> Instances = new List<DvergerLightController>(); private static readonly Dictionary<ItemData, LightState> itemState = new Dictionary<ItemData, LightState>(); private static readonly List<Character> s_hitCharacters = new List<Character>(); private const int c_characterLayer = 9; public static readonly int s_stateHash = StringExtensionMethods.GetStableHashCode("circletStateHash"); public static readonly int s_state = StringExtensionMethods.GetStableHashCode("circletState"); private void Awake() { m_nview = ((Component)this).GetComponentInParent<ZNetView>(); m_gemRenderer = ((Component)this).GetComponentInChildren<MeshRenderer>(); if (s_lightMaskNonPlayer == 0) { s_lightMaskNonPlayer = LayerMask.GetMask(new string[12] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle", "item" }); } } private void Start() { UpdateSpotLight(); Player playerAttached = m_playerAttached; m_visual = ((playerAttached != null) ? ((Character)playerAttached).GetVisual() : null); UpdateVisualLayers(); } private void FixedUpdate() { if (m_updateVisualTimer > 0f) { m_updateVisualTimer = Mathf.Max(0f, m_updateVisualTimer - Time.fixedDeltaTime); if (m_updateVisualTimer == 0f) { UpdateVisualLayers(); } } } private void OnEnable() { Instances.Add(this); if (m_item != null) { itemState[m_item] = m_state; } } private void OnDisable() { Instances.Remove(this); if (m_item != null) { itemState.Remove(m_item); } } private void ApplyGemColor(Color gemColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_gemRenderer == (Object)null) && !(m_gemColor == gemColor)) { m_gemColor = gemColor; ((Renderer)m_gemRenderer).GetPropertyBlock(s_matBlock, 0); s_matBlock.SetColor("_EmissionColor", m_gemColor); ((Renderer)m_gemRenderer).SetPropertyBlock(s_matBlock, 0); } } private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && (Object)(object)localPlayer == (Object)(object)m_playerAttached && ((Character)localPlayer).TakeInput() && StateChanged(localPlayer, out var playerMessage)) { SaveState(changedByPlayer: true, playerMessage); } UpdateLights(); } private void OnDestroy() { Player playerAttached = m_playerAttached; if ((Object)(object)playerAttached != (Object)null && m_state.demister && (Object)(object)((Character)playerAttached).GetSEMan().GetStatusEffect(demisterEffectHash) != (Object)null && !((Humanoid)playerAttached).GetInventory().GetEquippedItems().Any(delegate(ItemData item) { StatusEffect equipStatusEffect = item.m_shared.m_equipStatusEffect; return ((equipStatusEffect != null) ? new int?(equipStatusEffect.NameHash()) : null) == demisterEffectHash && !CircletItem.IsCircletItem(item); })) { ((Character)playerAttached).GetSEMan().RemoveStatusEffect(demisterEffectHash, false); } } private bool QualityLevelAvailable(int quality) { return !CircletExtended.getFeaturesByUpgrade.Value || m_state.quality >= quality; } private bool ForceOff() { return CircletExtended.disableOnSleep.Value && (Object)(object)m_playerAttached != (Object)null && ((Character)m_playerAttached).InBed(); } private bool StateChanged(Player player, out string playerMessage) { if (m_item != null) { m_state.quality = m_item.m_quality; } playerMessage = string.Empty; if (m_state.forceoff != ForceOff()) { m_state.forceoff = ForceOff(); CircletExtended.LogInfo("Force off " + (m_state.forceoff ? "enabled" : "disabled")); return true; } foreach (int hotkey in CircletExtended.hotkeys) { if (IsShortcutDown(hotkey, CircletExtended.toggleShortcut)) { m_state.on = !m_state.on; CircletExtended.LogInfo("Toggle " + (m_state.on ? "on" : "off")); if (CircletExtended.toggleSpotWithFront.Value) { m_state.spot = !m_state.spot; CircletExtended.LogInfo("Toggle spot " + (m_state.spot ? "on" : "off")); } return true; } if (QualityLevelAvailable(2) && Object.op_Implicit((Object)(object)m_spotLight) && IsShortcutDown(hotkey, CircletExtended.toggleSpotShortcut)) { m_state.spot = !m_state.spot; CircletExtended.LogInfo("Toggle spot " + (m_state.spot ? "on" : "off")); return true; } if (CircletExtended.enableDemister.Value && QualityLevelAvailable(4) && IsShortcutDown(hotkey, CircletExtended.toggleDemisterShortcut)) { m_state.demister = !m_state.demister; CircletExtended.LogInfo("Toggle demister " + (m_state.demister ? "on" : "off")); return true; } if (!m_state.on) { continue; } if (m_state.level > 0 && IsShortcutDown(hotkey, CircletExtended.widenShortcut)) { m_state.level--; CircletExtended.LogInfo($"Widen {m_state.level}"); return true; } if (m_state.level < m_maxLevel && IsShortcutDown(hotkey, CircletExtended.narrowShortcut)) { m_state.level++; CircletExtended.LogInfo($"Narrow {m_state.level}"); return true; } if (m_state.intensity < 150 && IsShortcutDown(hotkey, CircletExtended.increaseIntensityShortcut)) { m_state.intensity = Mathf.Clamp(m_state.intensity + 10, 50, 150); CircletExtended.LogInfo($"Increase intensity {m_state.intensity}%"); return true; } if (m_state.intensity > 50 && IsShortcutDown(hotkey, CircletExtended.decreaseIntensityShortcut)) { m_state.intensity = Mathf.Clamp(m_state.intensity - 10, 50, 150); CircletExtended.LogInfo($"Decrease intensity {m_state.intensity}%"); return true; } if (IsShortcutDown(hotkey, CircletExtended.toggleShadowsShortcut)) { m_state.shadows = !m_state.shadows; CircletExtended.LogInfo("Toggle shadows " + (m_state.shadows ? "on" : "off")); playerMessage = "$settings_pointlightshadows: " + (m_state.shadows ? "$hud_on" : "$hud_off"); return true; } if (!CircletExtended.enableOverload.Value || !QualityLevelAvailable(3) || !IsShortcutDown(hotkey, CircletExtended.overloadShortcut)) { continue; } CircletExtended.LogInfo("Overload"); if (m_state.overloaded) { MessageHud.instance.ShowMessage((MessageType)2, "$item_helmet_dverger: $hud_powernotready", 0, (Sprite)null, false); } else { ApplyOverloadEffect(player); } return true; } return false; } private void ApplyOverloadEffect(Player player) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ad: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_02c8: 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_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: 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_03c7: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) if (m_item == null) { return; } if (s_rayMaskSolids == 0) { s_rayMaskSolids = LayerMask.GetMask(new string[7] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "vehicle" }); s_rayMaskCharacters = LayerMask.GetMask(new string[4] { "character", "character_net", "character_ghost", "character_noenv" }); } ZNetView nview = ((Character)player).m_nview; if (nview == null || !nview.IsOwner()) { return; } ZNetScene.instance.SpawnObject(((Component)player).transform.position, ((Component)m_frontLight).transform.rotation, overloadEffect); if (((Character)player).InWater()) { ((Character)player).AddLightningDamage(5f); ((Character)player).AddStaggerDamage(((Character)player).GetStaggerTreshold() + 1f, -((Component)player).transform.forward, (HitData)null); } ((MonoBehaviour)this).StartCoroutine(OverloadIntensity()); if (CircletExtended.enableOverloadDemister.Value && (Object)(object)m_overloadDemister != (Object)null && CircletExtended.overloadDemisterTime.Value != 0f) { ((MonoBehaviour)this).StartCoroutine(OverloadDemister()); } float num = (float)Math.Tan((double)(m_frontLight.spotAngle / 2f) * (Math.PI / 180.0)) * m_frontLight.range; RaycastHit[] array = Physics.SphereCastAll(((Component)m_frontLight).transform.position, num, ((Component)m_frontLight).transform.forward, m_frontLight.range, s_rayMaskCharacters); if (array.Length != 0) { s_hitCharacters.Clear(); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; GameObject val2 = (Object.op_Implicit((Object)((RaycastHit)(ref val)).collider) ? Projectile.FindHitObject(((RaycastHit)(ref val)).collider) : null); bool flag = false; IDestructible val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent<IDestructible>() : null); if (val3 != null) { flag = val3 is Character; if (!IsValidTarget(val3)) { continue; } } if (!flag) { continue; } Character val4 = (Character)(object)((val3 is Character) ? val3 : null); if (!s_hitCharacters.Contains(val4)) { s_hitCharacters.Add(val4); Vector3 val5 = (((Object)(object)val4.m_head != (Object)null) ? val4.GetHeadPoint() : val4.GetTopPoint()); Vector3 val6 = val5 - ((Component)m_frontLight).transform.position; bool flag2 = Vector3.Angle(((Component)m_frontLight).transform.forward, ((Vector3)(ref val6)).normalized) <= (m_frontLight.spotAngle + 5f) / 2f; float num2 = Utils.DistanceXZ(((Component)m_frontLight).transform.position, val5); if (num2 <= 5f || (flag2 && num2 <= m_frontLight.range && !Physics.Linecast(((Component)m_frontLight).transform.position, val5, s_rayMaskSolids))) { float staggerEnemyAdrenaline = player.m_staggerEnemyAdrenaline; player.m_staggerEnemyAdrenaline = 1f; val4.AddStaggerDamage(val4.GetStaggerTreshold() + 1f, ((Vector3)(ref val6)).normalized, new HitData(0f) { m_attacker = ((Character)player).GetZDOID() }); player.m_staggerEnemyAdrenaline = staggerEnemyAdrenaline; } } } } m_item.m_shared.m_useDurability = true; m_item.m_durability = Mathf.Max(m_item.m_durability - m_item.GetMaxDurability() / (float)m_overloadCharges, 0f); if (!string.IsNullOrWhiteSpace(CircletExtended.overloadEmote.Value)) { player.StartEmote(CircletExtended.overloadEmote.Value.ToLower(), true); } } [IteratorStateMachine(typeof(<OverloadIntensity>d__60))] public IEnumerator OverloadIntensity() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OverloadIntensity>d__60(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<OverloadDemister>d__61))] public IEnumerator OverloadDemister() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OverloadDemister>d__61(0) { <>4__this = this }; } public bool IsValidTarget(IDestructible destr) { Character val = (Character)(object)((destr is Character) ? destr : null); if (Object.op_Implicit((Object)(object)val)) { if ((Object)(object)val == (Object)(object)m_playerAttached) { return false; } if ((Object)(object)m_playerAttached != (Object)null) { bool flag = BaseAI.IsEnemy((Character)(object)m_playerAttached, val) || (Object.op_Implicit((Object)(object)val.GetBaseAI()) && val.GetBaseAI().IsAggravatable() && ((Character)m_playerAttached).IsPlayer()); if (!((Character)m_playerAttached).IsPlayer() && !flag) { return false; } if (((Character)m_playerAttached).IsPlayer() && !((Character)m_playerAttached).IsPVPEnabled() && !flag) { return false; } } if (val.IsDodgeInvincible()) { return false; } } return true; } private bool IsShortcutDown(int hotkey, ConfigEntry<KeyboardShortcut> shortcut) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) int result; if (hotkey == ((object)((ConfigEntryBase)shortcut).Definition).GetHashCode()) { KeyboardShortcut value = shortcut.Value; if (!((KeyboardShortcut)(ref value)).IsDown()) { value = shortcut.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { value = shortcut.Value; result = ((!((KeyboardShortcut)(ref value)).Modifiers.Any()) ? 1 : 0); } else { result = 0; } } else { result = 1; } } else { result = 0; } return (byte)result != 0; } private void ShowMessage(string message) { if ((Object)(object)MessageHud.instance != (Object)null && (Object)(object)m_playerAttached != (Object)null && (Object)(object)Player.m_localPlayer == (Object)(object)m_playerAttached) { MessageHud.instance.m_msgQeue.Clear(); MessageHud.instance.m_msgQueueTimer = 1f; if (!string.IsNullOrWhiteSpace(message)) { MessageHud.instance.ShowMessage((MessageType)1, "$item_helmet_dverger: " + message, 0, (Sprite)null, false); } else if (!m_state.forceoff && m_state.on) { MessageHud.instance.ShowMessage((MessageType)1, $"$item_helmet_dverger: $msg_level {m_state.level} ({m_state.intensity}%)", 0, (Sprite)null, false); } else { MessageHud.instance.ShowMessage((MessageType)1, "$item_helmet_dverger: $hud_off", 0, (Sprite)null, false); } } } public void Initialize(Light light, Player player = null, ItemData item = null, int zdoIndex = 0) { m_frontLight = light; m_playerAttached = player; m_item = item; m_zdoIndex = zdoIndex; if (CircletExtended.enableOverloadDemister.Value && Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)demisterForceField) && !Object.op_Implicit((Object)(object)m_overloadDemister)) { GameObject val = Object.Instantiate<GameObject>(demisterForceField, ((Component)this).transform); ((Object)val).name = "Particle System Force Field"; val.SetActive(false); m_overloadDemister = val.GetComponent<ParticleSystemForceField>(); m_overloadDemister.endRange = CircletExtended.overloadDemisterRange.Value; } ((Behaviour)m_frontLight).enabled = false; LoadState(); } private void LoadState() { UpdateQualityLevel(); if (m_state.overloaded || m_state.demisted || ((Object)(object)m_nview != (Object)null && m_nview.IsValid() && m_nview.IsOwner() && m_nview.GetZDO().GetInt(s_stateHash, 0) == 0)) { m_state.overloaded = false; m_state.demisted = false; SaveState(); } if (m_item != null) { itemState[m_item] = m_state; } } private void UpdateQualityLevel() { if (IsStateLoaded()) { SetQuality(); } } private bool IsStateLoaded() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown string text = ""; if (m_item != null) { text = GeneralExtensions.GetValueSafe<string, string>(m_item.m_customData, CircletExtended.customDataKey); if (string.IsNullOrWhiteSpace(text)) { m_state = new LightState { quality = m_item.m_quality }; SaveState(); } CircletExtended.LogInfo("Loading state from item: " + text); } if (string.IsNullOrWhiteSpace(text) && (Object)(object)m_nview != (Object)null && m_nview.IsValid()) { ZDO zDO = m_nview.GetZDO(); ItemData val = new ItemData(); ItemDrop.LoadFromZDO(val, zDO); text = GeneralExtensions.GetValueSafe<string, string>(val.m_customData, CircletExtended.customDataKey); CircletExtended.LogInfo("Loading state from item zdo: " + text); if (string.IsNullOrWhiteSpace(text)) { ItemDrop.LoadFromZDO(m_zdoIndex, val, zDO); text = GeneralExtensions.GetValueSafe<string, string>(val.m_customData, CircletExtended.customDataKey); CircletExtended.LogInfo($"Loading state from zdo index {m_zdoIndex}: {text}"); } if (string.IsNullOrWhiteSpace(text)) { text = zDO.GetString(s_state, ""); CircletExtended.LogInfo("Loading state from zdo state: " + text); } } if (!string.IsNullOrWhiteSpace(text)) { try { m_state = JsonUtility.FromJson<LightState>(text); } catch (Exception arg) { CircletExtended.LogInfo($"State parsing error:\n{arg}"); return false; } } return true; } private void SaveState(bool changedByPlayer = false, string message = "") { //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) m_state.color = CircletExtended.circletColor.Value; m_state.UpdateHash(); if (m_item != null) { m_item.m_customData[CircletExtended.customDataKey] = m_state.json; } if ((Object)(object)m_nview != (Object)null && m_nview.IsValid() && m_nview.IsOwner()) { m_nview.GetZDO().Set(s_stateHash, m_state.hash, false); m_nview.GetZDO().Set(s_state, m_state.json); } if (changedByPlayer) { if (m_item != null) { itemState[m_item] = m_state; } ShowMessage(message); } m_state.hash = 0; } private void SetQuality() { m_maxLevel = Mathf.Clamp(CircletExtended.GetMaxSteps(m_state.quality), 1, 50); m_minAngle = Mathf.Clamp(CircletExtended.GetMinAngle(m_state.quality), 1f, 360f); m_maxAngle = Mathf.Clamp(CircletExtended.GetMaxAngle(m_state.quality), 1f, 360f); m_minIntensity = Mathf.Clamp(CircletExtended.GetMaxIntensity(m_state.quality), 0f, 10f); m_maxIntensity = Mathf.Clamp(CircletExtended.GetMinIntensity(m_state.quality), 0f, 10f); m_minRange = Mathf.Clamp(CircletExtended.GetMinRange(m_state.quality), 0f, 1000f); m_maxRange = Mathf.Clamp(CircletExtended.GetMaxRange(m_state.quality), 0f, 1000f); m_pointIntensity = Mathf.Clamp(CircletExtended.GetPointIntensity(m_state.quality), 0f, 10f); m_pointRange = Mathf.Clamp(CircletExtended.GetPointRange(m_state.quality), 0f, 1000f); m_spotIntensity = Mathf.Clamp(CircletExtended.GetSpotIntensity(m_state.quality), 0f, 10f); m_spotRange = Mathf.Clamp(CircletExtended.GetSpotRange(m_state.quality), 0f, 1000f); m_overloadCharges = CircletExtended.overloadChargesPerLevel.Value * ((!QualityLevelAvailable(4)) ? 1 : 2); } private void UpdateLights() { //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unk