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 Empress Shop Price Editor v1.0.2
EmpressShopPriceEditor.dll
Decompiled 3 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressShopPriceEditor")] [assembly: AssemblyTitle("EmpressShopPriceEditor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Empress.PurchaseEditor { [BepInPlugin("Empress.PurchaseEditor", "Empress Purchase Editor", "1.5.0")] public class PurchaseEditorPlugin : BaseUnityPlugin { public const string PluginGuid = "Empress.PurchaseEditor"; public const string PluginName = "Empress Purchase Editor"; public const string PluginVersion = "1.5.0"; public static ConfigEntry<float> UpgradeIncreaseConfig; public static Dictionary<string, ConfigEntry<int>> ItemConfigEntries = new Dictionary<string, ConfigEntry<int>>(); public static PurchaseEditorPlugin Instance; public static ManualLogSource Log; private void Awake() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Instance = this; Log = ((BaseUnityPlugin)this).Logger; UpgradeIncreaseConfig = ((BaseUnityPlugin)this).Config.Bind<float>("0. Global Settings", "Upgrade Price Increase", 0.5f, "How much upgrade prices increase per purchase (percentage). 0.5 is 50%."); Harmony val = new Harmony("Empress.PurchaseEditor"); val.PatchAll(); Log.LogInfo((object)"Empress Purchase Editor Loaded - Persistence & Ranges Active"); } public static int GetOrCreateItemConfig(Item item) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown if ((Object)(object)item == (Object)null) { return 5000; } string text = "Items: " + ((object)(itemType)(ref item.itemType)).ToString(); string itemName = item.itemName; itemName = itemName.Replace("=", "").Replace("\n", "").Trim(); if (!ItemConfigEntries.ContainsKey(itemName)) { int num = (int)(item.value.valueMax * 4f); string text2 = $"Set the price for {itemName} in CREDITS.\n(Example: Type 5000 for $5K). Vanilla was approx: {num}"; ConfigDescription val = new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200000), Array.Empty<object>()); ConfigEntry<int> value = ((BaseUnityPlugin)Instance).Config.Bind<int>(text, itemName, num, val); ItemConfigEntries.Add(itemName, value); } return ItemConfigEntries[itemName].Value; } } [HarmonyPatch(typeof(ShopManager), "ShopInitialize")] public static class ShopPopulateConfigPatch { private static void Postfix() { if ((Object)(object)StatsManager.instance == (Object)null) { return; } PurchaseEditorPlugin.Log.LogInfo((object)"--- Generating Item Config List ---"); IOrderedEnumerable<Item> orderedEnumerable = from x in StatsManager.instance.itemDictionary.Values orderby ((object)(itemType)(ref x.itemType)).ToString(), x.itemName select x; foreach (Item item in orderedEnumerable) { if ((Object)(object)item != (Object)null && (Object)(object)item.value != (Object)null) { PurchaseEditorPlugin.GetOrCreateItemConfig(item); } } ((BaseUnityPlugin)PurchaseEditorPlugin.Instance).Config.Save(); } } [HarmonyPatch(typeof(ItemAttributes), "GetValue")] public static class ItemAttributesGetValuePatch { private static bool Prefix(ItemAttributes __instance) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) { return true; } if ((Object)(object)__instance.item == (Object)null) { return true; } int orCreateItemConfig = PurchaseEditorPlugin.GetOrCreateItemConfig(__instance.item); float num = (float)orCreateItemConfig / 1000f; if (__instance.shopItem && (Object)(object)ShopManager.instance != (Object)null) { ShopManager.instance.upgradeValueIncrease = PurchaseEditorPlugin.UpgradeIncreaseConfig.Value; if ((int)__instance.item.itemType == 3) { num = ShopManager.instance.UpgradeValueGet(num, __instance.item); } else if ((int)__instance.item.itemType == 8) { num = ShopManager.instance.HealthPackValueGet(num); } else if ((int)__instance.item.itemType == 5) { num = ShopManager.instance.CrystalValueGet(num); } } __instance.value = Mathf.CeilToInt(num); if (GameManager.Multiplayer() && (Object)(object)((Component)__instance).GetComponent<PhotonView>() != (Object)null) { ((Component)__instance).GetComponent<PhotonView>().RPC("GetValueRPC", (RpcTarget)1, new object[1] { __instance.value }); } return false; } } }