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 MultiplyingPrices v1.0.3
MultiplyingPrices.dll
Decompiled 8 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using ScalingPrices.Config; using ScalingPrices.Helpers; using ScalingPrices.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ScalingPrices")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScalingPrices")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b44f6998-ed7b-478f-a3b6-3791193d4005")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ScalingPrices { [BepInPlugin("Geloog.REPO.PlayerCountPricing", "Multiplying Prices", "1.0.0")] public class ScalingPricingBase : BaseUnityPlugin { private const string mod_guid = "Geloog.REPO.PlayerCountPricing"; private const string mod_name = "Multiplying Prices"; private const string mod_version = "1.0.0"; private readonly Harmony harmony = new Harmony("Geloog.REPO.PlayerCountPricing"); private static ScalingPricingBase instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("Geloog.REPO.PlayerCountPricing"); Configuration.Init(((BaseUnityPlugin)this).Config); mls.LogInfo((object)"Player Count Pricing mod has been activated"); harmony.PatchAll(typeof(ScalingPricingBase)); harmony.PatchAll(typeof(ShopManagerPatch)); harmony.PatchAll(typeof(ItemAttributesPatch)); } } } namespace ScalingPrices.Patches { [HarmonyPatch(typeof(ItemAttributes), "GetValue")] internal class ItemAttributesPatch { public static bool Prefix(ItemAttributes __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 ItemAttributesHelper.Instance = __instance; if (!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient) { float num = Random.Range(ItemAttributesHelper.ItemValueMin, ItemAttributesHelper.ItemValueMax) * ShopManagerHelper.ItemValueMultiplier; if (num < 1000f) { num = 1000f; } if (num >= 1000f) { num = Mathf.Ceil(num / 1000f); } itemType itemType = ItemAttributesHelper.ItemType; itemType val = itemType; if ((int)val != 3) { if ((int)val != 5) { if ((int)val == 8) { num += num * ShopManagerHelper.HealthPackIncrease * (float)RunManager.instance.levelsCompleted; num += num * (float)(SemiFunc.PlayerGetAll().Count - 1) * Configuration.HealthPackMultiplyPerPlayer.Value; } } else { num += num * ShopManagerHelper.CrystalIncrease * (float)RunManager.instance.levelsCompleted; num += num * (float)(SemiFunc.PlayerGetAll().Count - 1) * Configuration.CrystalMultiplyPerPlayer.Value; } } else { num += num * ShopManagerHelper.UpgradeIncrease * (float)StatsManager.instance.GetItemsUpgradesPurchased(ItemAttributesHelper.ItemAssetName); num += num * (float)(SemiFunc.PlayerGetAll().Count - 1) * Configuration.UpgradeMultiplyPerPlayer.Value; } ItemAttributesHelper.ItemValue = (int)num; if (GameManager.Multiplayer()) { ItemAttributesHelper.PhotonView.RPC("GetValueRPC", (RpcTarget)1, new object[1] { ItemAttributesHelper.ItemValue }); } } return false; } } [HarmonyPatch(typeof(ShopManager), "Update")] internal class ShopManagerPatch { private static void Postfix(ShopManager __instance) { ShopManagerHelper.Instance = __instance; ShopManagerHelper.ItemValueMultiplier = Configuration.ItemValueMultiplier.Value; ShopManagerHelper.UpgradeIncrease = Configuration.UpgradeIncrease.Value; ShopManagerHelper.HealthPackIncrease = Configuration.HealthPackIncrease.Value; ShopManagerHelper.CrystalIncrease = Configuration.CrystalIncrease.Value; } } } namespace ScalingPrices.Helpers { internal class ItemAttributesHelper { private static readonly FieldRef<ItemAttributes, PhotonView> photon_view_ref = AccessTools.FieldRefAccess<ItemAttributes, PhotonView>("photonView"); private static readonly FieldRef<ItemAttributes, string> item_asset_name_ref = AccessTools.FieldRefAccess<ItemAttributes, string>("itemAssetName"); private static readonly FieldRef<ItemAttributes, itemType> item_type_ref = AccessTools.FieldRefAccess<ItemAttributes, itemType>("itemType"); private static readonly FieldRef<ItemAttributes, int> item_value_ref = AccessTools.FieldRefAccess<ItemAttributes, int>("value"); private static readonly FieldRef<ItemAttributes, float> item_value_min_ref = AccessTools.FieldRefAccess<ItemAttributes, float>("itemValueMin"); private static readonly FieldRef<ItemAttributes, float> item_value_max_ref = AccessTools.FieldRefAccess<ItemAttributes, float>("itemValueMax"); public static ItemAttributes Instance { get; set; } public static PhotonView PhotonView => photon_view_ref.Invoke(Instance); public static string ItemAssetName { get { return item_asset_name_ref.Invoke(Instance); } set { item_asset_name_ref.Invoke(Instance) = value; } } public static itemType ItemType { get { return item_type_ref.Invoke(Instance); } set { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected I4, but got Unknown item_type_ref.Invoke(Instance) = (itemType)(int)value; } } public static int ItemValue { get { return item_value_ref.Invoke(Instance); } set { item_value_ref.Invoke(Instance) = value; } } public static float ItemValueMin { get { return item_value_min_ref.Invoke(Instance); } set { item_value_min_ref.Invoke(Instance) = value; } } public static float ItemValueMax { get { return item_value_max_ref.Invoke(Instance); } set { _ = ref item_value_max_ref.Invoke(Instance); } } } internal class ShopManagerHelper { private static readonly FieldRef<ShopManager, float> item_value_multiplier_ref = AccessTools.FieldRefAccess<ShopManager, float>("itemValueMultiplier"); private static readonly FieldRef<ShopManager, float> upgrade_increase_ref = AccessTools.FieldRefAccess<ShopManager, float>("upgradeValueIncrease"); private static readonly FieldRef<ShopManager, float> health_pack_increase_ref = AccessTools.FieldRefAccess<ShopManager, float>("healthPackValueIncrease"); private static readonly FieldRef<ShopManager, float> crystal_increase_ref = AccessTools.FieldRefAccess<ShopManager, float>("crystalValueIncrease"); public static ShopManager Instance { get; set; } public static float ItemValueMultiplier { get { return item_value_multiplier_ref.Invoke(Instance); } set { item_value_multiplier_ref.Invoke(Instance) = value; } } public static float UpgradeIncrease { get { return upgrade_increase_ref.Invoke(Instance); } set { upgrade_increase_ref.Invoke(Instance) = value; } } public static float HealthPackIncrease { get { return health_pack_increase_ref.Invoke(Instance); } set { health_pack_increase_ref.Invoke(Instance) = value; } } public static float CrystalIncrease { get { return crystal_increase_ref.Invoke(Instance); } set { crystal_increase_ref.Invoke(Instance) = value; } } } } namespace ScalingPrices.Config { internal class Configuration { public static ConfigEntry<float> ItemValueMultiplier; public static ConfigEntry<float> UpgradeIncrease; public static ConfigEntry<float> HealthPackIncrease; public static ConfigEntry<float> CrystalIncrease; public static ConfigEntry<float> UpgradeMultiplyPerPlayer; public static ConfigEntry<float> HealthPackMultiplyPerPlayer; public static ConfigEntry<float> CrystalMultiplyPerPlayer; public static void Init(ConfigFile config) { ItemValueMultiplier = config.Bind<float>("原逻辑", "ValueMultiplier", 4f, "我真的懒得写这个了,反正别动就完事了"); UpgradeIncrease = config.Bind<float>("原逻辑", "UpgradeIncrease", 0.5f, "我真的懒得写这个了,反正别动就完事了"); HealthPackIncrease = config.Bind<float>("原逻辑", "HealthPackIncrease", 0.05f, "我真的懒得写这个了,反正别动就完事了"); CrystalIncrease = config.Bind<float>("原逻辑", "CrystalIncrease", 0.2f, "我真的懒得写这个了,反正别动就完事了"); UpgradeMultiplyPerPlayer = config.Bind<float>("额外乘数", "UpgradeIncrease", 1f, "将[参数值*(玩家数-1)*原价格]加算到原本的价格上,作用于升级物品"); HealthPackMultiplyPerPlayer = config.Bind<float>("额外乘数", "HealthPackIncrease", 0f, "将[参数值*(玩家数-1)*原价格]加算到原本的价格上,作用于回血物品"); CrystalMultiplyPerPlayer = config.Bind<float>("额外乘数", "CrystalIncrease", 0f, "将[参数值*(玩家数-1)*原价格]加算到原本的价格上,作用于水晶"); } } }